Exemplo n.º 1
0
    def start_server(self, handler):
        try:
            server = core.server.Server(self, handler)
            self.shell.stagers.append(server)
            server.start()

            self.shell.play_sound('STAGER')
            self.shell.print_good('Spawned a stager at %s' %
                                  (server.options.get('URL')))
            self.shell.print_warning(
                "Don't edit this URL! (See: 'help portfwd')")
            server.print_payload()
            return server.get_payload().decode()
        except OSError as e:
            port = str(self.options.get('SRVPORT'))
            if e.errno == 98:
                self.shell.print_error('Port %s is already bound!' % (port))
            elif e.errno == 13:
                self.shell.print_error('Port %s bind permission denied!' %
                                       (port))
            else:
                raise
            return
        except Exception as ex:
            import traceback
            template = 'An exception of type {0} occured. Arguments:\n{1!r}'
            message = template.format(type(ex).__name__, ex.args)
            self.shell.print_error(message)
            traceback.print_exc()
            return
        except:
            self.shell.print_error('Failed to spawn stager')
            raise
            return
Exemplo n.º 2
0
    def start_server(self, handler):
        try:
            server = core.server.Server(self, handler)
            self.shell.stagers.append(server)
            server.start()

            self.shell.print_good("Spawned a stager at %s" %
                                  (server.options.get("URL")))
            self.shell.print_warning("Avoid manually editing this URL!!!")
            server.print_payload()
        except OSError as e:
            port = str(self.options.get("SRVPORT"))
            if e.errno == 98:
                self.shell.print_error("Port %s is already bound!" % (port))
            elif e.errno == 13:
                self.shell.print_error("Port %s bind permission denied!" %
                                       (port))
            else:
                raise
            return
        except Exception as ex:
            import traceback
            template = "An exception of type {0} occured. Arguments:\n{1!r}"
            message = template.format(type(ex).__name__, ex.args)
            self.shell.print_error(message)
            traceback.print_exc()
        except:
            self.shell.print_error("Failed to spawn stager")
            raise
Exemplo n.º 3
0
    def start_server(self, handler):
        try:
            server = core.server.Server(self, handler)
            self.shell.stagers.append(server)
            server.start()

            self.shell.print_good("Spawned a stager at %s" % (server.options.get("URL")))
            server.print_payload()
        except OSError as e:
            port = str(self.options.get("LPORT"))
            if e.errno == 98:
                self.shell.print_error("Port %s is already bound!" % (port))
            elif e.errno == 13:
                self.shell.print_error("Port %s bind permission denied!" % (port))
            else:
                raise
            return
        except Exception as ex:
            template = "An exception of type {0} occured. Arguments:\n{1!r}"
            message = template.format(type(ex).__name__, ex.args)
            self.shell.print_error(message)
        except:
            self.shell.print_error("Failed to spawn stager")
            raise