From 24ceb0f7ac23da5a8cdbc58433315f00b816486c Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Tue, 27 Sep 2016 00:46:54 -0700 Subject: [PATCH] allow socket creation monkeypatchs --- netlib/tcp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netlib/tcp.py b/netlib/tcp.py index eea104252..b1a6db5a7 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -727,9 +727,13 @@ class TCPClient(_Connection): self.rfile.set_descriptor(self.connection) self.wfile.set_descriptor(self.connection) + def makesocket(self): + # some parties (cuckoo sandbox) need to hook this + return socket.socket(self.address.family, socket.SOCK_STREAM) + def connect(self): try: - connection = socket.socket(self.address.family, socket.SOCK_STREAM) + connection = self.makesocket() if self.spoof_source_address: try: