Beispiel #1
0
 def _start_http_server(self):
     """
     Starts custom http server that waits for GET requests
     :return: httpd (IndicationHTTPServer daemon object handler), lock (acquired lock)
     """
     lock = threading.Lock()
     local_port = get_free_tcp_port()
     local_ip = get_interface_to_target(self.host.ip_addr)
     httpd = self.IndicationHTTPServer(local_ip, local_port, lock)
     lock.acquire()
     httpd.start()
     lock.acquire()
     return httpd, lock
Beispiel #2
0
    def run_server(self):
        """ Configures and runs the ftp server to listen forever until stopped.
        """

        # Defining an authorizer and configuring the ftp user
        authorizer = DummyAuthorizer()
        authorizer.add_user(self.user,
                            self.password,
                            self.working_dir,
                            perm='elr')

        # Normal ftp handler
        handler = FTPHandler
        handler.authorizer = authorizer

        address = (get_interface_to_target(self.dst_ip), FTP_SERVER_PORT)

        # Configuring the server using the address and handler. Global usage in stop_server thats why using self keyword
        self.server = FTPServer(address, handler)

        # Starting ftp server, this server has no auto stop or stop clause, and also, its blocking on use, thats why I
        # multiproccess is being used here.
        self.server.serve_forever()
Beispiel #3
0
 def __init__(self, payload_path, cursor, host):
     super(CmdShellAttack, self).__init__(payload_path)
     self.ftp_server, self.ftp_server_p = self.__init_ftp_server(host)
     self.cursor = cursor
     self.attacker_ip = get_interface_to_target(host.ip_addr)