Пример #1
0
    def on_connect(self):
        import imp
        from rpyc.core.service import ModuleNamespace

        sys.modules["__oldmain__"] = sys.modules["__main__"]
        sys.modules["__main__"] = imp.new_module("__main__")
        self.exposed_namespace = sys.modules["__main__"].__dict__

        self._conn._config.update(
            dict(
                allow_all_attrs=True,
                allow_pickle=True,
                allow_getattr=True,
                allow_setattr=True,
                allow_delattr=True,
                import_custom_exceptions=True,
                instantiate_custom_exceptions=True,
                instantiate_oldstyle_exceptions=True,
            ))
        # shortcuts
        self._conn.modules = ModuleNamespace(self._conn.root.getmodule)
        self._conn.eval = self._conn.root.eval
        self._conn.execute = self._conn.root.execute
        self._conn.namespace = self._conn.root.namespace
        if sys.version_info[0] > 2:
            self._conn.builtin = self._conn.modules.builtins
        else:
            self._conn.builtin = self._conn.modules.__builtin__
Пример #2
0
 def __init__(self):
     self._conn = None
     self.namespace = {}
     self.modules = ModuleNamespace(self.getmodule)
     if is_py3k:
         self.builtin = self.modules.builtins
     else:
         self.builtin = self.modules.__builtin__
     self.builtins = self.builtin
Пример #3
0
 def on_connect(self):
     self.exposed_namespace = {}
     self._conn._config.update(REVERSE_SLAVE_CONF)
     import pupy
     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))
Пример #4
0
 def on_connect(self):
     self.exposed_namespace = {}
     self._conn._config.update(REVERSE_SLAVE_CONF)
     import pupy
     try:
         from pupy_credentials import BIND_PAYLOADS_PASSWORD
         password = BIND_PAYLOADS_PASSWORD
     except:
         from network.transports import DEFAULT_BIND_PAYLOADS_PASSWORD
         password = DEFAULT_BIND_PAYLOADS_PASSWORD
     if self._conn.root.get_password() != password:
         self._conn.close()
         raise KeyboardInterrupt("wrong password")
     self._conn.root.set_modules(ModuleNamespace(self.exposed_getmodule))
Пример #5
0
	def on_connect(self):
		self.exposed_namespace = {}
		self._conn._config.update(dict(
			allow_all_attrs = True,
			allow_public_attrs = True,
			allow_pickle = True,
			allow_getattr = True,
			allow_setattr = True,
			allow_delattr = True,
			import_custom_exceptions = False,
			propagate_SystemExit_locally=False,
			propagate_KeyboardInterrupt_locally=True,
			instantiate_custom_exceptions = True,
			instantiate_oldstyle_exceptions = True,
		))
		# shortcuts
		self._conn.root.set_modules(ModuleNamespace(self.exposed_getmodule))
Пример #6
0
 def on_connect(self):
     self._conn._config.update(
         dict(
             allow_all_attrs=True,
             allow_pickle=True,
             allow_getattr=True,
             allow_setattr=True,
             allow_delattr=True,
             import_custom_exceptions=True,
             instantiate_custom_exceptions=True,
             instantiate_oldstyle_exceptions=True,
         ))
     # shortcuts
     self._conn.modules = ModuleNamespace(self._conn.root.getmodule)
     self._conn.eval = self._conn.root.eval
     self._conn.execute = self._conn.root.execute
     self._conn.namespace = self._conn.root.namespace
     if is_py3k:
         self._conn.builtin = self._conn.modules.builtins
     else:
         self._conn.builtin = self._conn.modules.__builtin__
     self._conn.builtins = self._conn.builtin
Пример #7
0
 def on_connect(self):
     """ Set these attributes once implant connects to server. """
     try:
         self.exposed_namespace = {}
         self._conn._config.update(
             dict(
                 allow_all_attrs=True,
                 allow_public_attrs=True,
                 allow_pickle=True,
                 allow_getattr=True,
                 allow_setattr=True,
                 allow_delattr=True,
                 import_custom_exceptions=False,
                 propagate_SystemExit_locally=True,
                 propagate_KeyboardInterrupt_locally=True,
                 instantiate_custom_exceptions=True,
                 instantiate_oldstyle_exceptions=True,
             ))
         self._conn.root.set_modules(ModuleNamespace(
             self.exposed_getmodule))
     except Exception as e:
         print e
Пример #8
0
 def on_connect(self):
     self.exposed_namespace = {}
     self._conn._config.update(REVERSE_SLAVE_CONF)
     self._conn.root.set_modules(ModuleNamespace(self.exposed_getmodule))
Пример #9
0
 def on_connect(self):
     SlaveService.on_connect(self)
     self._conn.cg_modules = ModuleNamespace(self._conn.root.getmodule)