shirosaidev / sharesniffer

Network share sniffer and auto-mounter for crawling remote file systems
Apache License 2.0
202 stars 42 forks source link

KeyError: "Can't find nmap nse scripts nfs-showmount, nfs-ls" #3

Closed michelep closed 6 years ago

michelep commented 6 years ago

2018-06-08 11:30:25,288 [WARNING][sniffshares] Not running as root, sniffing may be slower 2018-06-08 11:30:25,288 [INFO][sniffshares] Sniffing for any network shares... 2018-06-08 11:30:25,289 [INFO][sniffshares] Scanning all hosts we can find (ctrl-c to stop) 2018-06-08 11:30:25,301 [INFO][sniffshares] No hosts specified, finding your network info 2018-06-08 11:30:25,303 [INFO][sniffshares] Networks found: 172.16.56.0/21 2018-06-08 11:30:25,303 [INFO][sniffshares] Starting network sniff... 2018-06-08 11:30:25,303 [INFO][sniffshares] Looking for nfs and smb shares... Traceback (most recent call last): File "sharesniffer.py", line 494, in shares = sniff_network() File "sharesniffer.py", line 326, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "sharesniffer.py", line 97, in get_nfs_shares raise KeyError("Can't find nmap nse scripts nfs-showmount, nfs-ls") KeyError: "Can't find nmap nse scripts nfs-showmount, nfs-ls" michele@xxxx:~/sharesniffer$ ls LICENSE nfs-ls.nse nfs-showmount.nse README.md sharesniffer.py smb-enum-shares.nse

shirosaidev commented 6 years ago

this has been patched in v0.1-b.3

shirosaidev commented 6 years ago

@michelep working for you now?

michelep commented 6 years ago

Sorry, no:

     ____ _  _ ____ ____ ____          /
     ==== |--| |--| |--< |===         ["]  ,< ,,_      
     ____ __ _ _ ____ ____ ____ ____  [~]\/   |__|      
     ==== | \| | |--- |--- |=== |--<  OOO
     v0.1-b.3               

2018-06-11 09:56:28,542 [WARNING][sniffshares] Not running as root, sniffing may be slower 2018-06-11 09:56:28,543 [INFO][sniffshares] Sniffing for any network shares... 2018-06-11 09:56:28,543 [INFO][sniffshares] Scanning all hosts we can find (ctrl-c to stop) 2018-06-11 09:56:28,556 [INFO][sniffshares] No hosts specified, finding your network info 2018-06-11 09:56:28,558 [INFO][sniffshares] Networks found: 172.16.56.0/21 2018-06-11 09:56:28,558 [INFO][sniffshares] Starting network sniff... 2018-06-11 09:56:28,558 [INFO][sniffshares] Looking for nfs and smb shares... Traceback (most recent call last): File "./sharesniffer.py", line 500, in shares = sniff_network() File "./sharesniffer.py", line 332, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "./sharesniffer.py", line 101, in get_nfs_shares raise KeyError("Can't find nmap nse scripts nfs-showmount, nfs-ls") KeyError: "Can't find nmap nse scripts nfs-showmount, nfs-ls"

shirosaidev commented 6 years ago

in the sharesniffer directory is there a sub-directory named scripts with 3 .nse files in it? Does the user who is running sharesniffer.py have read access to that directory and files?

shirosaidev commented 6 years ago

what os and what version of Python and python-nmap? How did you install nmap? Which nmap version?

shirosaidev commented 6 years ago

https://nmap.org/book/man-nse.html I'm setting --datadir to point to the scripts folder. Do you have nmap scripts installed somewhere? They are usually in /usr/share/nmap/scripts or /usr/local/share/nmap/scripts. Maybe try setting one of the env vars in the url above to point to the nmap scripts and see if that error goes away or you could try updating nmap script db using nmap --script-updatedb.

shirosaidev commented 6 years ago

I added more debug info to b4. Can you please update and run with --debug and reply with output. Also please send the full command you are running and full path to where sharesniffer is installed.

michelep commented 6 years ago

I have nmap 7.40 and python 2.7.13. Still don't work:

python sharesniffer.py --debug

     ____ _  _ ____ ____ ____          /
     ==== |--| |--| |--< |===         ["]  ,< ,,_      
     ____ __ _ _ ____ ____ ____ ____  [~]\/   |__|      
     ==== | \| | |--- |--- |=== |--<  OOO
     v0.1-b.4               

2018-06-11 14:09:32,529 [DEBUG][sniffshares] Nmap datadir: /home/michele/sharesniffer/scripts 2018-06-11 14:09:32,530 [WARNING][sniffshares] Not running as root, sniffing may be slower 2018-06-11 14:09:32,530 [INFO][sniffshares] Sniffing for any network shares... 2018-06-11 14:09:32,530 [INFO][sniffshares] Scanning all hosts we can find (ctrl-c to stop) 2018-06-11 14:09:32,544 [INFO][sniffshares] No hosts specified, finding your network info 2018-06-11 14:09:32,545 [INFO][sniffshares] Networks found: 172.16.56.0/21 2018-06-11 14:09:32,545 [INFO][sniffshares] Starting network sniff... 2018-06-11 14:09:32,545 [DEBUG][sniffshares] nmap args: -n -T4 -Pn -PS111,445 --open --min-parallelism 100--max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256--host-timeout 2s 2018-06-11 14:09:32,546 [INFO][sniffshares] Looking for nfs and smb shares... Traceback (most recent call last): File "sharesniffer.py", line 503, in shares = sniff_network() File "sharesniffer.py", line 334, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "sharesniffer.py", line 101, in get_nfs_shares logger.debug('nm scan output: ' + output) TypeError: cannot concatenate 'str' and 'dict' objects

hajowieland commented 6 years ago

I'm getting a similar error when searching for NFS shares: KeyError: 'nfs-ls'

Traceback (most recent call last): File "./sharesniffer.py", line 503, in shares = sniff_network() File "./sharesniffer.py", line 334, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "./sharesniffer.py", line 103, in get_nfs_shares nfsls = output['scan'][host]['tcp'][111]['script']['nfs-ls'].strip().split('\n') KeyError: 'nfs-ls'

My system:

shirosaidev commented 6 years ago

I think I figured out what was wrong, I was using Nmap and nmap scripts from 6.40 and I updated to nmap 7.70 and I was getting similar errors that you guys are seeing. I've patched this now in b5. Please try and use that and let me know if it works okay now. I'm no longer including the scripts (which were nmap 6.4) in the repo scripts folder and just using the ones in nmap path.

michelep commented 6 years ago

Still failed:

python ./sharesniffer.py --debug

     ____ _  _ ____ ____ ____          /
     ==== |--| |--| |--< |===         ["]  ,< ,,_      
     ____ __ _ _ ____ ____ ____ ____  [~]\/   |__|      
     ==== | \| | |--- |--- |=== |--<  OOO
     v0.1-b.5               

2018-06-12 09:20:19,667 [DEBUG][sniffshares] Nmap datadir: /usr/share/nmap/scripts 2018-06-12 09:20:19,667 [WARNING][sniffshares] Not running as root, sniffing may be slower 2018-06-12 09:20:19,667 [INFO][sniffshares] Sniffing for any network shares... 2018-06-12 09:20:19,668 [INFO][sniffshares] Scanning all hosts we can find (ctrl-c to stop) 2018-06-12 09:20:19,681 [INFO][sniffshares] No hosts specified, finding your network info 2018-06-12 09:20:19,682 [INFO][sniffshares] Networks found: 172.16.56.0/21 2018-06-12 09:20:19,682 [INFO][sniffshares] Starting network sniff... 2018-06-12 09:20:19,683 [DEBUG][sniffshares] nmap args: -n -T4 -Pn -PS111,445 --open --min-parallelism 100--max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256--host-timeout 2s 2018-06-12 09:20:19,683 [INFO][sniffshares] Looking for nfs and smb shares... 2018-06-12 09:20:57,319 [DEBUG][sniffshares] nm scan output: {'nmap': {'scanstats': {'uphosts': '2', 'timestr': 'Tue Jun 12 09:20:57 2018', 'downhosts': '0', 'totalhosts': '2', 'elapsed': '0.83'}, 'scaninfo': {'tcp': {'services': '111', 'method': 'connect'}, 'error': [u'Failed to resolve "2s".\nStrange read error from 0.0.1.0 (22 - \'Invalid argument\')\n', u'Failed to resolve "2s".\nStrange read error from 0.0.1.0 (22 - \'Invalid argument\')\n']}, 'command_line': 'nmap -oX - -p 111 -n -T4 -Pn -PS111,445 --open --min-parallelism 100--max-parallelism --max-retries 1 --min-rate 100 --max-rate 256--host-timeout --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.60.88 256 2s'}, 'scan': {'172.16.60.88': {'status': {'state': 'up', 'reason': 'user-set'}, 'hostnames': [{'type': '', 'name': ''}], 'vendor': {}, 'addresses': {'ipv4': '172.16.60.88'}, 'tcp': {111: {'product': '', 'state': 'open', 'version': '', 'name': 'rpcbind', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}}}} Traceback (most recent call last): File "./sharesniffer.py", line 511, in shares = sniff_network() File "./sharesniffer.py", line 332, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "./sharesniffer.py", line 101, in get_nfs_shares raise KeyError("nmap nse script error") KeyError: 'nmap nse script error'

shirosaidev commented 6 years ago

I think i see what's going on from that debug nm scan output, not sure why that's not affecting my end with nmap 7.70 + python-nmap 0.6.1. Please try b6 which I just pushed, if that still doesn't work can you try updating nmap to 7.70 and see if you have that ver of python-nmap. Also could try excluding the host 0.0.1.0, I see that in the above debug output but that might be from the "2s" bug that I patched.

On Tue, Jun 12, 2018 at 4:22 PM michelep notifications@github.com wrote:

Still failed:

python ./sharesniffer.py --debug

 ____ _  _ ____ ____ ____          /
 ==== |--| |--| |--< |===         ["]  ,< ,,_
 ____ __ _ _ ____ ____ ____ ____  [~]\/   |__|
 ==== | \| | |--- |--- |=== |--<  OOO
 v0.1-b.5

2018-06-12 09:20:19,667 [DEBUG][sniffshares] Nmap datadir: /usr/share/nmap/scripts 2018-06-12 09:20:19,667 [WARNING][sniffshares] Not running as root, sniffing may be slower 2018-06-12 09:20:19,667 [INFO][sniffshares] Sniffing for any network shares... 2018-06-12 09:20:19,668 [INFO][sniffshares] Scanning all hosts we can find (ctrl-c to stop) 2018-06-12 09:20:19,681 [INFO][sniffshares] No hosts specified, finding your network info 2018-06-12 09:20:19,682 [INFO][sniffshares] Networks found: 172.16.56.0/21 2018-06-12 09:20:19,682 [INFO][sniffshares] Starting network sniff... 2018-06-12 09:20:19,683 [DEBUG][sniffshares] nmap args: -n -T4 -Pn -PS111,445 --open --min-parallelism 100--max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256--host-timeout 2s 2018-06-12 09:20:19,683 [INFO][sniffshares] Looking for nfs and smb shares... 2018-06-12 09:20:57,319 [DEBUG][sniffshares] nm scan output: {'nmap': {'scanstats': {'uphosts': '2', 'timestr': 'Tue Jun 12 09:20:57 2018', 'downhosts': '0', 'totalhosts': '2', 'elapsed': '0.83'}, 'scaninfo': {'tcp': {'services': '111', 'method': 'connect'}, 'error': [u'Failed to resolve "2s".\nStrange read error from 0.0.1.0 (22 - 'Invalid argument')\n', u'Failed to resolve "2s".\nStrange read error from 0.0.1.0 (22 - 'Invalid argument')\n']}, 'command_line': 'nmap -oX - -p 111 -n -T4 -Pn -PS111,445 --open --min-parallelism 100--max-parallelism --max-retries 1 --min-rate 100 --max-rate 256--host-timeout --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.60.88 256 2s'}, 'scan': {'172.16.60.88': {'status': {'state': 'up', 'reason': 'user-set'}, 'hostnames': [{'type': '', 'name': ''}], 'vendor': {}, 'addresses': {'ipv4': '172.16.60.88'}, 'tcp': {111: {'product': '', 'state': 'open', 'version': '', 'name': 'rpcbind', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}}}} Traceback (most recent call last): File "./sharesniffer.py", line 511, in shares = sniff_network() File "./sharesniffer.py", line 332, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "./sharesniffer.py", line 101, in get_nfs_shares raise KeyError("nmap nse script error") KeyError: 'nmap nse script error'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shirosaidev/sharesniffer/issues/3#issuecomment-396491514, or mute the thread https://github.com/notifications/unsubscribe-auth/AQomfwHHqPKrYZXmqVU24z4yYzVQ4szmks5t72wZgaJpZM4UfzWm .

michelep commented 6 years ago

I've tried, without success:

python ./sharesniffer.py --debug

     ____ _  _ ____ ____ ____          /
     ==== |--| |--| |--< |===         ["]  ,< ,,_      
     ____ __ _ _ ____ ____ ____ ____  [~]\/   |__|      
     ==== | \| | |--- |--- |=== |--<  OOO
     v0.1-b.6               

2018-06-13 09:37:17,580 [DEBUG][sniffshares] Nmap datadir: /usr/share/nmap/scripts 2018-06-13 09:37:17,581 [WARNING][sniffshares] Not running as root, sniffing may be slower 2018-06-13 09:37:17,581 [INFO][sniffshares] Sniffing for any network shares... 2018-06-13 09:37:17,581 [INFO][sniffshares] Scanning all hosts we can find (ctrl-c to stop) 2018-06-13 09:37:17,594 [INFO][sniffshares] No hosts specified, finding your network info 2018-06-13 09:37:17,595 [INFO][sniffshares] Networks found: 172.16.56.0/21 2018-06-13 09:37:17,596 [INFO][sniffshares] Starting network sniff... 2018-06-13 09:37:17,596 [DEBUG][sniffshares] nmap args: -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 2018-06-13 09:37:17,597 [INFO][sniffshares] Looking for nfs and smb shares... 2018-06-13 09:37:27,619 [DEBUG][sniffshares] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Wed Jun 13 09:37:27 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '0.82'}, 'scaninfo': {'tcp': {'services': '111', 'method': 'connect'}}, 'command_line': 'nmap -oX - -p 111 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.63.214'}, 'scan': {'172.16.63.214': {'status': {'state': 'up', 'reason': 'user-set'}, 'hostnames': [{'type': '', 'name': ''}], 'vendor': {}, 'addresses': {'ipv4': '172.16.63.214'}, 'tcp': {111: {'product': '', 'state': 'open', 'version': '', 'name': 'rpcbind', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}}}} Traceback (most recent call last): File "./sharesniffer.py", line 511, in shares = sniff_network() File "./sharesniffer.py", line 332, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "./sharesniffer.py", line 101, in get_nfs_shares raise KeyError("nmap nse script error") KeyError: 'nmap nse script error'

shirosaidev commented 6 years ago

Do you have these files /usr/share/nmap/scripts/nfs-showmount.nse and /usr/share/nmap/scripts/nfs-ls.nse ? Can the user running sharesniffer read them?

On Wed, Jun 13, 2018 at 4:39 PM michelep notifications@github.com wrote:

I've tried, without success:

python ./sharesniffer.py --debug

 ____ _  _ ____ ____ ____          /
 ==== |--| |--| |--< |===         ["]  ,< ,,_
 ____ __ _ _ ____ ____ ____ ____  [~]\/   |__|
 ==== | \| | |--- |--- |=== |--<  OOO
 v0.1-b.6

2018-06-13 09:37:17,580 [DEBUG][sniffshares] Nmap datadir: /usr/share/nmap/scripts 2018-06-13 09:37:17,581 [WARNING][sniffshares] Not running as root, sniffing may be slower 2018-06-13 09:37:17,581 [INFO][sniffshares] Sniffing for any network shares... 2018-06-13 09:37:17,581 [INFO][sniffshares] Scanning all hosts we can find (ctrl-c to stop) 2018-06-13 09:37:17,594 [INFO][sniffshares] No hosts specified, finding your network info 2018-06-13 09:37:17,595 [INFO][sniffshares] Networks found: 172.16.56.0/21 2018-06-13 09:37:17,596 [INFO][sniffshares] Starting network sniff... 2018-06-13 09:37:17,596 [DEBUG][sniffshares] nmap args: -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 2018-06-13 09:37:17,597 [INFO][sniffshares] Looking for nfs and smb shares... 2018-06-13 09:37:27,619 [DEBUG][sniffshares] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Wed Jun 13 09:37:27 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '0.82'}, 'scaninfo': {'tcp': {'services': '111', 'method': 'connect'}}, 'command_line': 'nmap -oX - -p 111 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.63.214'}, 'scan': {'172.16.63.214': {'status': {'state': 'up', 'reason': 'user-set'}, 'hostnames': [{'type': '', 'name': ''}], 'vendor': {}, 'addresses': {'ipv4': '172.16.63.214'}, 'tcp': {111: {'product': '', 'state': 'open', 'version': '', 'name': 'rpcbind', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}}}} Traceback (most recent call last): File "./sharesniffer.py", line 511, in shares = sniff_network() File "./sharesniffer.py", line 332, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "./sharesniffer.py", line 101, in get_nfs_shares raise KeyError("nmap nse script error") KeyError: 'nmap nse script error'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shirosaidev/sharesniffer/issues/3#issuecomment-396844003, or mute the thread https://github.com/notifications/unsubscribe-auth/AQomf0mxTS9UOKQ112M-dCa78vjQZuIpks5t8MGYgaJpZM4UfzWm .

michelep commented 6 years ago

Yes, of course. Just for testing, i've tried running sharesniffer as root but the same issue was raised:

2018-06-13 10:50:29,239 [DEBUG][sniffshares] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Wed Jun 13 10:50:29 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '1.34'}, 'scaninfo': {'tcp': {'services': '111', 'method': 'syn'}}, 'command_line': 'nmap -oX - -p 111 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.60.88'}, 'scan': {'172.16.60.88': {'status': {'state': 'up', 'reason': 'arp-response'}, 'hostnames': [{'type': '', 'name': ''}], 'vendor': {'00:17:A4:F7:F3:CE': 'Hewlett Packard'}, 'addresses': {'mac': '00:17:A4:F7:F3:CE', 'ipv4': '172.16.60.88'}, 'tcp': {111: {'product': '', 'state': 'open', 'version': '', 'name': 'rpcbind', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}}}} Traceback (most recent call last): File "./sharesniffer.py", line 511, in shares = sniff_network() File "./sharesniffer.py", line 332, in sniff_network shares['nfsshares'] = sniff.get_nfs_shares(hostlist_nfs) File "./sharesniffer.py", line 101, in get_nfs_shares raise KeyError("nmap nse script error") KeyError: 'nmap nse script error'

shirosaidev commented 6 years ago

I just pushed a change to see more details about the error, can you update and send output? Thanks

shirosaidev commented 6 years ago

what is the exit code of running this nmap -oX - -p 111 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.60.88 ; echo $?

shirosaidev commented 6 years ago

I'm testing this on my Ubuntu 16.04 nfs server running nfs vers 3. Is 172.16.60.88 using nfsv3?

https://svn.nmap.org/nmap/scripts/nfs-ls.nse

Looks like v4 support might not be included in the nse script.

michelep commented 6 years ago
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nmaprun>
<?xml-stylesheet href="file:///usr/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
<!-- Nmap 7.40 scan initiated Wed Jun 13 11:54:38 2018 as: nmap -oX - -p 111 -n -T4 -Pn -PS111,445 -&#45;open -&#45;min-parallelism 100 -&#45;max-parallelism 256 -&#45;max-retries 1 -&#45;min-rate 100 -&#45;max-rate 256 -&#45;host-timeout 2 -&#45;datadir /usr/share/nmap/scripts -&#45;script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.60.88 -->
<nmaprun scanner="nmap" args="nmap -oX - -p 111 -n -T4 -Pn -PS111,445 -&#45;open -&#45;min-parallelism 100 -&#45;max-parallelism 256 -&#45;max-retries 1 -&#45;min-rate 100 -&#45;max-rate 256 -&#45;host-timeout 2 -&#45;datadir /usr/share/nmap/scripts -&#45;script /usr/share/nmap/scripts/nfs-showmount.nse,/usr/share/nmap/scripts/nfs-ls.nse 172.16.60.88" start="1528883678" startstr="Wed Jun 13 11:54:38 2018" version="7.40" xmloutputversion="1.04">
<scaninfo type="connect" protocol="tcp" numservices="1" services="111"/>
<verbose level="0"/>
<debugging level="0"/>
<host starttime="1528883679" endtime="1528883679"><status state="up" reason="user-set" reason_ttl="0"/>
<address addr="172.16.60.88" addrtype="ipv4"/>
<hostnames>
</hostnames>
<ports><port protocol="tcp" portid="111"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="rpcbind" method="table" conf="3"/></port>
</ports>
<times srtt="698" rttvar="5000" to="100000"/>
</host>
<runstats><finished time="1528883679" timestr="Wed Jun 13 11:54:39 2018" elapsed="0.83" summary="Nmap done at Wed Jun 13 11:54:39 2018; 1 IP address (1 host up) scanned in 0.83 seconds" exit="success"/><hosts up="1" down="0" total="1"/>
</runstats>
</nmaprun>

0

shirosaidev commented 6 years ago

please try b7, if a host returns no nmap nse results, it is skipped now. Please reply with the output of your scan if it works, thanks.

michelep commented 6 years ago

Ok, now seems that all works as expected. Here's the log:

2018-06-14 14:42:04,149 [DEBUG][sharesniffer] Nmap datadir: /usr/share/nmap/scripts 2018-06-14 14:42:04,149 [WARNING][sharesniffer] Not running as root, sniffing may be slower 2018-06-14 14:42:04,150 [INFO][sharesniffer] Sniffing for any network shares... 2018-06-14 14:42:04,150 [INFO][sharesniffer] Scanning all hosts we can find (ctrl-c to stop) 2018-06-14 14:42:04,162 [INFO][sharesniffer] No hosts specified, finding your network info 2018-06-14 14:42:04,163 [INFO][sharesniffer] Networks found: 172.16.112.0/20 2018-06-14 14:42:04,164 [INFO][sharesniffer] Starting network sniff... 2018-06-14 14:42:04,164 [DEBUG][sharesniffer] nmap args: -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 2018-06-14 14:42:04,164 [INFO][sharesniffer] Looking for smb shares... 2018-06-14 14:42:17,085 [DEBUG][sharesniffer] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Thu Jun 14 14:42:17 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '2.93'}, 'scaninfo': {'tcp': {'services': '445', 'method': 'connect'}}, 'command_line': 'nmap -oX - -p 445 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/smb-enum-shares.nse 172.16.xx.xx'}, 'scan': {'172.16.xx.xx': {'status': {'state': 'up', 'reason': 'user-set'}, 'hostnames': [{'type': '', 'name': ''}], 'vendor': {}, 'addresses': {'ipv4': '172.16.xx.xx'}}}} 172.16.xx.xx PORT 445/tcp OPEN (microsoft-ds) but no results from nse script 2018-06-14 14:42:19,456 [DEBUG][sharesniffer] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Thu Jun 14 14:42:19 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '2.33'}, 'scaninfo': {'tcp': {'services': '445', 'method': 'connect'}}, 'command_line': 'nmap -oX - -p 445 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/smb-enum-shares.nse 172.16.xx.xx'}, 'scan': {'172.16.xx.xx': {'status': {'state': 'up', 'reason': 'user-set'}, 'vendor': {}, 'addresses': {'ipv4': '172.16.xx.xx'}, 'hostscript': [{'output': "\n note: ERROR: Enumerating shares failed, guessing at common ones (NT_STATUS_ACCESS_DENIED)\n account_used: \n ADMIN$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: \n C$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: \n IPC$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: READ", 'id': 'smb-enum-shares'}], 'tcp': {445: {'product': '', 'state': 'open', 'version': '', 'name': 'microsoft-ds', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}, 'hostnames': [{'type': '', 'name': ''}]}}} 2018-06-14 14:42:20,331 [DEBUG][sharesniffer] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Thu Jun 14 14:42:20 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '0.83'}, 'scaninfo': {'tcp': {'services': '445', 'method': 'connect'}}, 'command_line': 'nmap -oX - -p 445 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/smb-enum-shares.nse 172.16.xx.xx'}, 'scan': {'172.16.xx.xx': {'status': {'state': 'up', 'reason': 'user-set'}, 'hostnames': [{'type': '', 'name': ''}], 'vendor': {}, 'addresses': {'ipv4': '172.16.xx.xx'}, 'tcp': {445: {'product': '', 'state': 'open', 'version': '', 'name': 'microsoft-ds', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}}}} 172.16.113.25 PORT 445/tcp OPEN (microsoft-ds) but no results from nse script 2018-06-14 14:42:22,687 [DEBUG][sharesniffer] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Thu Jun 14 14:42:22 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '2.31'}, 'scaninfo': {'tcp': {'services': '445', 'method': 'connect'}}, 'command_line': 'nmap -oX - -p 445 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/smb-enum-shares.nse 172.16.xx.xx'}, 'scan': {'172.16.xx.xx': {'status': {'state': 'up', 'reason': 'user-set'}, 'vendor': {}, 'addresses': {'ipv4': '172.16.xx.xx'}, 'hostscript': [{'output': "\n note: ERROR: Enumerating shares failed, guessing at common ones (NT_STATUS_ACCESS_DENIED)\n account_used: \n ADMIN$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: \n C$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: \n D$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: \n IPC$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: READ", 'id': 'smb-enum-shares'}], 'tcp': {445: {'product': '', 'state': 'open', 'version': '', 'name': 'microsoft-ds', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}, 'hostnames': [{'type': '', 'name': ''}]}}} 2018-06-14 14:42:25,023 [DEBUG][sharesniffer] nm scan output: {'nmap': {'scanstats': {'uphosts': '1', 'timestr': 'Thu Jun 14 14:42:24 2018', 'downhosts': '0', 'totalhosts': '1', 'elapsed': '2.30'}, 'scaninfo': {'tcp': {'services': '445', 'method': 'connect'}}, 'command_line': 'nmap -oX - -p 445 -n -T4 -Pn -PS111,445 --open --min-parallelism 100 --max-parallelism 256 --max-retries 1 --min-rate 100 --max-rate 256 --host-timeout 2 --datadir /usr/share/nmap/scripts --script /usr/share/nmap/scripts/smb-enum-shares.nse 172.16.114.43'}, 'scan': {'172.16.xx.xx': {'status': {'state': 'up', 'reason': 'user-set'}, 'vendor': {}, 'addresses': {'ipv4': '172.16.xx.x'}, 'hostscript': [{'output': "\n note: ERROR: Enumerating shares failed, guessing at common ones (NT_STATUS_ACCESS_DENIED)\n account_used: \n ADMIN$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: \n C$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: \n IPC$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: READ\n PRINT$: \n warning: Couldn't get details for share: NT_STATUS_ACCESS_DENIED\n Anonymous access: ", 'id': 'smb-enum-shares'}], 'tcp': {445: {'product': '', 'state': 'open', 'version': '', 'name': 'microsoft-ds', 'conf': '3', 'extrainfo': '', 'reason': 'syn-ack', 'cpe': ''}}, 'hostnames': [{'type': '', 'name': ''}]}}}

*** SMB SHARES ****

smbuser used: guest host: 172.16.xx.xx open: [] closed: [] host: 172.16.xx.xx open: [] closed: [] host: 172.16.xx.xx open: [] closed: []


2018-06-14 14:42:25,024 [INFO][sharesniffer] Unmounting any existing mountpoints... 2018-06-14 14:42:25,024 [INFO][sharesniffer] Trying to mount shares... 2018-06-14 14:42:25,024 [WARNING][sharesniffer] No shares could be mounted, exiting