Gallopsled / Gallopsled/pwntools

Script stuck (cannot ctrl-C to quit) when DNS resolution hang (using `remote()`)

Open
#2,540 3 comments 0 reactions 0 assignees View on GitHub
backport-required bug
Dominant language
Python
Stars
13.7k
Forks
1.9k
Avg merge
6d 23h
Merged PRs (30d)
3

Description

## Debug Output

Having the extra debug output really helps us, and might help you diagnose the problem yourself.

The command is stuck around 30 seconds before quitting.
```sh
> py run.py DEBUG REMOTE
[┤] ] ening connection to chall.lac.tf on port 31174
Traceback (most recent call last):
File "/home/hacker/venv/lib/python3.12/site-packages/pwnlib/tubes/remote.py", line 111, in _connect
for res in socket.getaddrinfo(self.rhost, self.rport, fam, typ, 0, socket.AI_PASSIVE):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/socket.py", line 976, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Temporary failure in name resolution
```

## Expectaion

I would like to use ctrl-C to quit immediately in these cases.

## Verify on Ubuntu

I'm using Debian Sid (Latest) if it worths mentioning.

Contributor guide

Open the contributing guide

Research direction

Reproduce the hang with the reported `py run.py DEBUG REMOTE` command, then inspect `pwnlib/tubes/remote.py` around `_connect` and line 111, where DNS resolution is running. Done means Ctrl-C interrupts the stuck resolution promptly instead of waiting about 30 seconds before quitting.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.