mirror of https://github.com/n1nj4sec/pupy.git
Socket and family numbers are differs from OS to OS
This commit is contained in:
parent
decb45f52b
commit
4cd1825690
|
@ -23,16 +23,12 @@ class IPModule(PupyModule):
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
try:
|
try:
|
||||||
data = obtain(self.client.conn.modules.pupyps.interfaces())
|
rpupyps = self.client.conn.modules.pupyps
|
||||||
|
data = obtain(rpupyps.interfaces())
|
||||||
|
families = { int(x):y for x,y in obtain(rpupyps.families).iteritems() }
|
||||||
|
|
||||||
addrlen = max([len(x) for x in data['addrs']])+1
|
addrlen = max([len(x) for x in data['addrs']])+1
|
||||||
|
|
||||||
families = {
|
|
||||||
v:k[3:] for k,v in socket.__dict__.iteritems() if k.startswith('AF_')
|
|
||||||
}
|
|
||||||
|
|
||||||
families.update({-1: 'LINK'})
|
|
||||||
|
|
||||||
familylen = max([len(v)-3 for v in families.itervalues()])+1
|
familylen = max([len(v)-3 for v in families.itervalues()])+1
|
||||||
|
|
||||||
for addr, addresses in data['addrs'].iteritems():
|
for addr, addresses in data['addrs'].iteritems():
|
||||||
|
|
|
@ -29,15 +29,10 @@ class NetStatModule(PupyModule):
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
try:
|
try:
|
||||||
data = obtain(self.client.conn.modules.pupyps.connections())
|
rpupyps = self.client.conn.modules.pupyps
|
||||||
|
data = obtain(rpupyps.connections())
|
||||||
families = {
|
sock = { int(x):y for x,y in obtain(rpupyps.socktypes).iteritems() }
|
||||||
v:k for k,v in socket.__dict__.iteritems() if k.startswith('AF_')
|
families = { int(x):y for x,y in obtain(rpupyps.families).iteritems() }
|
||||||
}
|
|
||||||
|
|
||||||
sock = {
|
|
||||||
v:k for k,v in socket.__dict__.iteritems() if k.startswith('SOCK_')
|
|
||||||
}
|
|
||||||
|
|
||||||
limit = []
|
limit = []
|
||||||
|
|
||||||
|
@ -55,8 +50,8 @@ class NetStatModule(PupyModule):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
color = ""
|
color = ""
|
||||||
family = families[connection['family']][3:]
|
family = families[connection['family']]
|
||||||
stype = sock[connection['type']][5:]
|
stype = sock[connection['type']]
|
||||||
|
|
||||||
if limit and not stype in limit:
|
if limit and not stype in limit:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -6,6 +6,17 @@ import collections
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import socket
|
||||||
|
|
||||||
|
families = {
|
||||||
|
v:k[3:] for k,v in socket.__dict__.iteritems() if k.startswith('AF_')
|
||||||
|
}
|
||||||
|
families.update({-1: 'LINK'})
|
||||||
|
|
||||||
|
socktypes = {
|
||||||
|
v:k[5:] for k,v in socket.__dict__.iteritems() if k.startswith('SOCK_')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def pstree():
|
def pstree():
|
||||||
data = {}
|
data = {}
|
||||||
|
|
Loading…
Reference in New Issue