Return ss information for Linux distros
    (netstat is deprecated and may not be available)

def _ss_linux():
    '''
    Return ss information for Linux distros
    (netstat is deprecated and may not be available)
    '''
    ret = []
    cmd = 'ss -tulpnea'
    out = __salt__['cmd.run'](cmd)
    for line in out.splitlines():
        comps = line.split()
        ss_user = 0
        ss_inode = 0
        ss_program = ''
        length = len(comps)
        if line.startswith('tcp') or line.startswith('udp'):
            i = 6
            while i < (length - 1):
                fields = comps[i].split(":")
                if fields[0] == "users":
                    users = fields[1].split(",")
                    ss_program = users[0].split("\"")[1]

                if fields[0] == "uid":
                    ss_user = fields[1]

                if fields[0] == "ino":
                    ss_inode = fields[1]

                i += 1

        if line.startswith('tcp'):
            ss_state = comps[1]
            if ss_state == "ESTAB":
                ss_state = "ESTABLISHED"
            ret.append({
                'proto': comps[0],
                'recv-q': comps[2],
                'send-q': comps[3],
                'local-address': comps[4],
                'remote-address': comps[5],
                'state': ss_state,
                'user': ss_user,
                'inode': ss_inode,
                'program': ss_program})
        if line.startswith('udp'):
            ret.append({
                'proto': comps[0],
                'recv-q': comps[2],
                'send-q': comps[3],
                'local-address': comps[4],
                'remote-address': comps[5],
                'user': ss_user,
                'inode': ss_inode,
                'program': ss_program})
    return ret