impacket
impacket copied to clipboard
ntlmrelayx: support upn format + oem encoding
As described in #1315, ntlmrelayx.py in SOCKS-mode currently does not work together with usernames in UPN format.
This pull request converts usernames in UPN formats (user1@domain) to a format compatible with Impacket (domain/user1), before they are added to the active SOCKS connections.
While implementing this, I noticed that if NTLM is negotiated using OEM encoding instead of Unicode (NTLMSSP_NEGOTIATE_OEM), the username is currently encoded wrongfully using ASCII-encoding. This fails when certain characters are used in usernames (umlauts like ä,ü,ö for example). I changed the encoding to use the most used Windows codepage in this case.
Fixes #1315