ShawnDEvans / smbmap

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

Fixing -P option being ignored #105

Open r3nt0n opened 2 months ago

r3nt0n commented 2 months ago

Seems that smbmap ignores the custom port passed via -P, still tries to connect to 445/tcp. This PR should fix it. I didn't test all functionalities, just basic use cases: connect and enumerate all shares content recursively.

Bear in mind that this is more a quick dirty patch than a long-term solution. There is probably a better way to do it than using a global variable, but I didn't have time to mess with the map calls.

Also, there are two reasons to explain the changes in line 1233:

Anyway, still feels hacky and probably need some improvements, but at least it works :)