pwntools
pwntools copied to clipboard
Raise AttributeError when closing a socket
I want pwnlib to listen on a port, but when I close the socket it raise AssertionError.
Here's my code:
from pwnlib import tubes
import os
p = tubes.listen.listen(1337, "127.0.0.1")
os.system("nohup curl 127.0.0.1:1337/start123end >/dev/null 2>/dev/null &")
print(p.recvregex(b"start([\s\S]+)end"))
p.close()
And here's the error message:
Exception in thread Thread-1 (accepter):
Traceback (most recent call last):
File "/usr/lib64/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "MYHOME/.local/lib/python3.10/site-packages/pwnlib/tubes/listen.py", line 129, in accepter
self.settimeout(self.timeout)
File "MYHOME/.local/lib/python3.10/site-packages/pwnlib/tubes/tube.py", line 1186, in settimeout
self.timeout = timeout
File "MYHOME/.local/lib/python3.10/site-packages/pwnlib/timeout.py", line 146, in timeout
assert not self._stop
AssertionError
b'GET /start123end'
Traceback (most recent call last):
File "THE PYTHON SCRIPT ABOVE", line 10, in <module>
p.close()
File "MYHOME/.local/lib/python3.10/site-packages/pwnlib/tubes/listen.py", line 177, in close
super(listen, self).close()
File "MYHOME/.local/lib/python3.10/site-packages/pwnlib/tubes/sock.py", line 173, in close
self._close_msg()
File "MYHOME/.local/lib/python3.10/site-packages/pwnlib/tubes/sock.py", line 176, in _close_msg
self.info('Closed connection to %s port %d', self.rhost, self.rport)
File "MYHOME/.local/lib/python3.10/site-packages/pwnlib/tubes/listen.py", line 170, in __getattr__
return getattr(super(listen, self), key)
AttributeError: 'super' object has no attribute 'rhost'. Did you mean: 'lhost'?