Skip to content

Commit 71c4db2

Browse files
committed
remot: handle CancelledError when press Ctrl-C
1 parent a7fd893 commit 71c4db2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pwnlib/tubes/remote.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def _connect(self, fam, typ):
112112

113113
async def resolve_hostname(host, port, fam=0, typ=0, proto=0, flags=0):
114114
loop = asyncio.get_event_loop()
115-
result = await loop.getaddrinfo(host, port, family=fam, type=typ, proto=proto, flags=flags)
115+
try:
116+
result = await loop.getaddrinfo(host, port, family=fam, type=typ, proto=proto, flags=flags)
117+
except asyncio.exceptions.CancelledError:
118+
result = []
116119
return result
117120

118121
with self.waitfor('Opening connection to %s on port %s' % (self.rhost, self.rport)) as h:

0 commit comments

Comments
 (0)