Skip to content

Instantly share code, notes, and snippets.

@ionrock
Created January 17, 2015 04:30
Show Gist options
  • Save ionrock/497354792ff8b98cf130 to your computer and use it in GitHub Desktop.
Save ionrock/497354792ff8b98cf130 to your computer and use it in GitHub Desktop.
# Need to find the IP address so we'll wrap socket.connect to print
# the addr info
def logging_connect(self, addr, *args, **kw):
log('%s:%s', *addr)
return socket.socket._original_connect(self, addr, *args, **kw)
socket.socket._original_connect = socket.socket.connect
socket.socket.connect = logging_connect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment