예제 #1
0
 def gdbserver(self, ip=None, port=None):
     path = self.path
     try:
         if ip is None:
             ip = '127.0.0.1'
         if port is None:
             port = 9999
         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         sock.bind((ip, port))
         self.nprint("gdb> initializing loadbase 0x%x" % (self.loadbase))
         self.nprint("gdb> listening on %s:%d" % (ip, port))
         sock.listen(1)
         conn, addr = sock.accept()
     except:
         self.nprint("gdb> Error: Address already in use")
         raise
     try:
         mappings = [(hex(self.entry_point), 0x10)]
         exit_point = self.entry_point + os.path.getsize(path)
         self.gdbsession = GDBSession(self, conn, exit_point, mappings)
     except:
         self.nprint("gdb> Error: Not able to initialize GDBServer")
         raise
예제 #2
0
    def gdbserver(self, ip=None, port=None):
        path = self.path
        try:
            with open(path, "rb") as bf:
                GUEST_BINARY = bf.read()

            if ip is None:
                ip = '127.0.0.1'
            if port is None:
                port = 9999
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.bind((ip, port))
            sock.listen(1)
            conn, addr = sock.accept()
        except:
            self.nprint("[!] Error: Address already in use")
            raise
        try:
            mappings = [(hex(self.entry_point), 0x10)]
            exit_point = self.entry_point + len(GUEST_BINARY)
            self.gdbsession = GDBSession(self, conn, exit_point, mappings)
        except:
            self.nprint("[!] Error: Not able to initialize GDBServer")
            raise