Skip to content

Error in get_netstat

some errors occur during the process. you can change the command as below:

def get_netstat():
    """
    Get ports and applications
    """
    try:
        pipe = os.popen( #error happened if ipv6 exist, replace -tnp to -tn4 
        "ss -tn4 | grep ESTAB | awk '{print $4, $5}'| awk -F: '{print $1, $2}' "
        "| awk 'NF > 0' | sort -n | uniq -c")
        data = pipe.read().strip().split('\n')
        pipe.close()

        if data == [""]:  #error happened when no connect, check it.
            data=None
        else:
            data = [i.split(None, 4) for i in data]

    except Exception as err:
        data = str(err)

    return data

@login_required(login_url='/login/')
Edited by EvolSmily
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information