Ensure 'GET TARGET_OS' has access to TARGET_IP

This commit is contained in:
Sebastian Kinne 2017-10-27 08:57:22 +11:00
parent 763639b305
commit e866ad438b

View File

@ -18,6 +18,7 @@ function GET() {
export SWITCH_POSITION="invalid"
;;
"TARGET_OS")
TARGET_IP=$(cat /var/lib/dhcp/dhcpd.leases | grep ^lease | awk '{ print $2 }' | sort | uniq)
ScanForOS=$(nmap -Pn -O $TARGET_IP -p1)
[[ $ScanForOS == *"Too many fingerprints"* ]] && ScanForOS=$(nmap -Pn -O --osscan-guess $TARGET_IP)
[[ $ScanForOS == *"Windows"* ]] && export TARGET_OS='WINDOWS' && return