Skip to content

Instantly share code, notes, and snippets.

@cgimenes
Created February 15, 2019 19:38
Show Gist options
  • Save cgimenes/b5e9a0a752bbd4f89f1f10f7bad4ac5a to your computer and use it in GitHub Desktop.
Save cgimenes/b5e9a0a752bbd4f89f1f10f7bad4ac5a to your computer and use it in GitHub Desktop.
Grab SMB version
#!/bin/sh
if [ -z $1 ]; then echo "Usage: ./grabsmbversion.sh RHOST {RPORT}" && exit; else rhost=$1; fi
if [ ! -z $2 ]; then rport=$2; else rport=139; fi
if [ ! -z $3 ]; then intf=$3; else rport='eth0'; fi
ngrep -i -d $intf 's.?a.?m.?b.?a.*[[:digit:]]' port $rport &
echo "exit" | smbclient -L $rhost 1>/dev/null 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment