From de9d89358df57a2a58ed476ae66b1f0f14f93310 Mon Sep 17 00:00:00 2001 From: gjhami Date: Thu, 31 Oct 2024 12:54:18 -0400 Subject: [PATCH] Update socksserver.py Fixes https://github.com/fortra/impacket/issues/1575 by parsing the target hostname correctly from commands run through ntlmrelayx's socks5 proxy. --- impacket/examples/ntlmrelayx/servers/socksserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impacket/examples/ntlmrelayx/servers/socksserver.py b/impacket/examples/ntlmrelayx/servers/socksserver.py index 22a59204c5..5f7e82f45f 100644 --- a/impacket/examples/ntlmrelayx/servers/socksserver.py +++ b/impacket/examples/ntlmrelayx/servers/socksserver.py @@ -325,7 +325,7 @@ def handle(self): self.targetHost = socket.inet_ntoa(request['PAYLOAD'][:4]) self.targetPort = unpack('>H',request['PAYLOAD'][4:])[0] elif request['ATYP'] == ATYP.DOMAINNAME.value: - hostLength = unpack('!B',request['PAYLOAD'][0])[0] + hostLength = unpack('!B',request['PAYLOAD'][:1])[0] self.targetHost = request['PAYLOAD'][1:hostLength+1] self.targetPort = unpack('>H',request['PAYLOAD'][hostLength+1:])[0] else: