ShawnDEvans / smbmap

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

scanning for anonymous smb shares #90

Closed sec13b closed 10 months ago

sec13b commented 10 months ago

[*] scanning for anonymous smb shares --> /smb_dump
Traceback (most recent call last):
File "/usr/bin/smbmap", line 33, in
sys.exit(load_entry_point('smbmap==1.9.2', 'console_scripts', 'smbmap')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/smbmap/smbmap.py", line 1435, in main
host = [ host for host in share_drives_list.keys() ][0]
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'bool' object has no attribute 'keys'

I get this error all time .

ShawnDEvans commented 10 months ago

Thanks for reporting! I'll look into it and get back to you.

On Mon, Oct 30, 2023, 10:34 AM Sec13B @.***> wrote:

[*] scanning for anonymous smb shares --> /smb_dump Traceback (most recent call last): File "/usr/bin/smbmap", line 33, in sys.exit(load_entry_point('smbmap==1.9.2', 'console_scripts', 'smbmap')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/smbmap/smbmap.py", line 1435, in main host = [ host for host in share_drives_list.keys() ][0] ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'bool' object has no attribute 'keys'

I get this error all time .

— Reply to this email directly, view it on GitHub https://github.com/ShawnDEvans/smbmap/issues/90, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6SKWAD4QQPNXXHNPSUR5DYB63GDAVCNFSM6AAAAAA6WEACO2VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE3DQNJSGI2TMNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ShawnDEvans commented 10 months ago

Cloudy you paste the command you were trying to execute at the time? I think you're hitting an exception in the get_shares() function, which returns False. Rather than returning False it should probably just return a zero length dict. I'm also at a bit of a loss where the output "scanning for anonymous smb shares" is coming from. Are you using the latest stable? Thanks again!

On Mon, Oct 30, 2023 at 10:50 AM Shawn Evans @.***> wrote:

Thanks for reporting! I'll look into it and get back to you.

On Mon, Oct 30, 2023, 10:34 AM Sec13B @.***> wrote:

[*] scanning for anonymous smb shares --> /smb_dump Traceback (most recent call last): File "/usr/bin/smbmap", line 33, in sys.exit(load_entry_point('smbmap==1.9.2', 'console_scripts', 'smbmap')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/smbmap/smbmap.py", line 1435, in main host = [ host for host in share_drives_list.keys() ][0] ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'bool' object has no attribute 'keys'

I get this error all time .

— Reply to this email directly, view it on GitHub https://github.com/ShawnDEvans/smbmap/issues/90, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6SKWAD4QQPNXXHNPSUR5DYB63GDAVCNFSM6AAAAAA6WEACO2VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE3DQNJSGI2TMNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ShawnDEvans commented 10 months ago

I pushed some changes that should address your issue. You reported this at the perfect time. I'm on an internal assessment this week and was able to reproduce your result and push a patch. I'm going to close this for now, but please let me know if your mileage varies and I'll reopen the ticket. Thanks!

sec13b commented 10 months ago

os.system(f'smbmap -u {user} -p {passw} -d {domain_name} -H {ip_toscan} | tee shares/smbshares{user}.txt')

os.system(f"smbmap -H {ip_to_scan} -u ' ' -p ' ' | grep -v Working | tee shares/anonymous_shares.txt")

os.system(f'smbclient //{ip_to_scan}/{share} -U "{domain_name}\{user}%{passw}" -c "{cmd}" > /dev/null')

os.system(f"smbclient -L {ip_to_scan} -N | tee shares/anonymous_shares.txt")

ShawnDEvans commented 10 months ago

I fixed the exception, but SMBMap, CrackMapExec and other tools based on Impacket have had some issues properly processing NULL authentication. Sometimes smbclient works, other times it doesn't. It's a bit of a crap shoot. I personally use enu4mlinux (stil) for NULL sessions (which is either smbclient or rpclient depending on how you look at it). In any case, reopen this issue if you run into any other problems. Thanks!

On Tue, Oct 31, 2023 at 4:20 AM Sec13B @.***> wrote:

os.system(f"smbmap -H {ip_to_scan} -u ' ' -p ' ' | grep -v Working | tee shares/anonymous_shares.txt")

os.system(f'smbclient //{ip_to_scan}/{share} -U "{domain_name}{user}%{passw}" -c "{cmd}" > /dev/null') os.system(f"smbclient -L {ip_to_scan} -N | tee shares/anonymous_shares.txt")

— Reply to this email directly, view it on GitHub https://github.com/ShawnDEvans/smbmap/issues/90#issuecomment-1786721461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6SKWFP7SWVMXED4XJNW53YCCYF5AVCNFSM6AAAAAA6WEACO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBWG4ZDCNBWGE . You are receiving this because you modified the open/close state.Message ID: @.***>

sec13b commented 10 months ago

OK @ShawnDEvans , thank you