ShawnDEvans / smbmap

SMBMap is a handy SMB enumeration tool
GNU General Public License v3.0
1.76k stars 343 forks source link

Fixed compatibility issue with different versions of impacket. #19

Closed bsinglet closed 6 years ago

bsinglet commented 6 years ago

I ran into trouble with smbmap on the latest version of Kali Linux (2018.1), specifically with the -X argument, although it also occurred with other arguments that ultimately utilize the CMDEXEC function. The exact error: [!] SMBTransport instance has no attribute 'setRemoteHost' (<type 'exceptions.AttributeError'>, 'smbmap.py', 894)

The problem seems to be that setRemoteHost doesn't exist in newer versions of SMBTransport, as found in impacket. I wrote up a quick fix that checks for the presence of this function and utilizes it if it exists or manually sets __dstip otherwise.

asolino commented 6 years ago

Hey @bsinglet

The problem seems to be that setRemoteHost doesn't exist in newer versions of SMBTransport, as found in impacket.

Just in case, setRemoteHost exists in the master (latest) version of Impact. Here's the link.

ShawnDEvans commented 6 years ago

Thanks for the suggestions!! I recently experienced the same problem. It was during an engagement, so I just rolled with my functional OS X version. Hopefully I'll find some time this weekend to dive into your fix, and with some luck integrate WMI code exec. Who wants to always send command output to a file.