Mattia Russo
Mattia Russo

Reputation: 33

GDBProtocol was unable to connect

I'm building a project using angr and the symbion plugin. To examinate the sample, a gdb process is required:

gdbserver_proc = subprocess.Popen("gdbserver %s:%s '%s'" % (GDB_SERVER_IP, GDB_SERVER_PORT, binary_path),
            stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)


# Instantiation of the AvatarGDBConcreteTarget
avatar_gdb = AvatarGDBConcreteTarget(avatar2.archs.x86.X86_64,GDB_SERVER_IP, GDB_SERVER_PORT)

When reaching last line during execution, the following error is ecountered:

Traceback (most recent call last):
  File "/home/blabla/MyFramework/MySE/se.py", line 221, in <module>
    main()
  File "/home/blabla/MyFramework/MySE/se.py", line 217, in main
    start_server(binary_path)
  File "/home/blabla/MyFramework/MySE/se.py", line 184, in start_server
    avatar_gdb = AvatarGDBConcreteTarget(avatar2.archs.x86.X86_64,GDB_SERVER_IP, GDB_SERVER_PORT)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/blabla/.virtualenvs/angr/lib/python3.12/site-packages/angr_targets/targets/avatar_gdb.py", line 25, in __init__
    self.avatar.init_targets()
  File "/home/blabla/.virtualenvs/angr/lib/python3.12/site-packages/avatar2/avatar2.py", line 233, in init_targets
    t[1].init()
  File "/home/blabla/.virtualenvs/angr/lib/python3.12/site-packages/avatar2/targets/gdb_target.py", line 60, in init
    if gdb.remote_connect(ip=self.gdb_ip, port=self.gdb_port):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/blabla/.virtualenvs/angr/lib/python3.12/site-packages/avatar2/protocols/gdb.py", line 399, in remote_connect
    return self._remote_connect_common('%s:%d' % (ip, int(port)))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/blabla/.virtualenvs/angr/lib/python3.12/site-packages/avatar2/protocols/gdb.py", line 384, in _remote_connect_common
    raise Exception("GDBProtocol was unable to connect")
Exception: GDBProtocol was unable to connect

I checked that the gdb server is on with netstat. Moreover, I also controlled the connection via command line, and it works.

Upvotes: 0

Views: 19

Answers (0)

Related Questions