Skip to content

Instantly share code, notes, and snippets.

@SleepyLctl
Created November 14, 2019 11:20
Show Gist options
  • Save SleepyLctl/8bf675bad28c2bbfbba32871f0622d8f to your computer and use it in GitHub Desktop.
Save SleepyLctl/8bf675bad28c2bbfbba32871f0622d8f to your computer and use it in GitHub Desktop.
Script for getting SMB Version thru tcpdump - not my work
if [ -z $1 ]; then echo "Usage: ./smbver.sh RHOST {RPORT}" && exit; else rhost=$1; fi
if [ ! -z $2 ]; then rport=$2; else rport=139; fi
tcpdump -s0 -n -i tap0 src $rhost and port $rport -A -c 7 2>/dev/null | grep -i "samba\|s.a.m" | tr -d '.' | grep -oP 'UnixSamba.*[0-9a-z]' | tr -d '\n' & echo -n "$rhost: " &
echo "exit" | smbclient -L $rhost 1>/dev/null 2>/dev/null
sleep 0.5 && echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment