diff --git a/src/python/devtest/os/test/cases/LsofNet.py b/src/python/devtest/os/test/cases/LsofNet.py new file mode 100644 index 0000000..1a2b326 --- /dev/null +++ b/src/python/devtest/os/test/cases/LsofNet.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from ..ListCmd import ListCmd + +class LsofNet(ListCmd): # export + + # Override as needed. + def _row_info(self): + return ( + r'lsof +c 15 -i -n | egrep "LISTEN|UDP|COM"', + # COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME + # systemd 1 root 42u IPv4 9763 0t0 TCP * : 222 (LISTEN) + # confd.smp 1190 root 77u IPv4 27916 0t0 TCP *:ssh (LISTEN) + "^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +([0-9]+) +(\S+) +(UDP|TCP) +([^: ])+:([0-9a-z]+) +(\(LISTEN\))", + [ 'cmd', 'pid', 'user','fd', 'type', 'device','size/off','prot', 'addr', 'port', 'attrib' ], + [ 'cmd', 'user', 'prot', 'addr', 'port' ], + [ 'prot', 'port' ] + )