(array)
| 41 | return [x for x in array if x !=''] |
| 42 | |
| 43 | def _convert_ip_port(array): |
| 44 | host,port = array.split(':') |
| 45 | # convert host from mangled-per-four-bytes form as used by kernel |
| 46 | host = bytes.fromhex(host) |
| 47 | host_out = '' |
| 48 | for x in range(0, len(host) // 4): |
| 49 | (val,) = struct.unpack('=I', host[x*4:(x+1)*4]) |
| 50 | host_out += '%08x' % val |
| 51 | |
| 52 | return host_out,int(port,16) |
| 53 | |
| 54 | def netstat(typ='tcp'): |
| 55 | ''' |