Instant Os detection method
parent
9c9a1a0ef4
commit
8440b7416a
|
@ -18,21 +18,23 @@ function GET() {
|
|||
export SWITCH_POSITION="invalid"
|
||||
;;
|
||||
"TARGET_OS")
|
||||
GET TARGET_IP
|
||||
ScanForOS=$(nmap -Pn -O $TARGET_IP -p1 -v2)
|
||||
[[ $ScanForOS == *"Too many fingerprints"* ]] && ScanForOS=$(nmap -Pn -O $TARGET_IP --osscan-guess -v2)
|
||||
[[ "${ScanForOS,,}" == *"windows"* ]] && export TARGET_OS='WINDOWS' && return
|
||||
[[ "${ScanForOS,,}" == *"apple"* ]] && export TARGET_OS='MACOS' && return
|
||||
[[ "${ScanForOS,,}" == *"linux"* ]] && export TARGET_OS='LINUX' && return
|
||||
export TARGET_OS='UNKNOWN'
|
||||
;;
|
||||
"TARGET_OS_QUICK")
|
||||
GET TARGET_IP
|
||||
ScanForOS=$(ping -c1 $TARGET_IP)
|
||||
[[ "${ScanForOS,,}" == *"ttl=128"* ]] && export TARGET_OS='WINDOWS' && return
|
||||
[[ "${ScanForOS,,}" == *"ttl=64"* ]] && export TARGET_OS='LINUX' && return
|
||||
[[ "${ScanForOS,,}" == *"ttl=63"* ]] && export TARGET_OS='CHROMEOS' && return
|
||||
export TARGET_OS='UNKNOWN'
|
||||
DATABASE=/root/udisk/payloads/extensions/OSdatabase
|
||||
FINGERPRINT=$(cat /var/log/syslog | grep FINGERPRINT | awk '{ print $9 " " $7 }' | sort -u | awk '{ print $2 }' | awk 'END{print}')
|
||||
[[ -f $DATABASE ]] || touch $DATABASE
|
||||
sed -i $FINGERPRINT > /var/log/syslog
|
||||
if [ -f $DATABASE ] ; then
|
||||
TARGET_OS=$(cat $DATABASE | grep $FINGERPRINT | awk '{ print $2 }')
|
||||
GET TARGET_IP
|
||||
if [ -z $TARGET_OS ]; then
|
||||
ScanForOS=$(nmap -Pn -O $TARGET_IP -p1 -v2)
|
||||
[[ $ScanForOS == *"Too many fingerprints"* ]] && ScanForOS=$(nmap -Pn -O $TARGET_IP --osscan-guess -v2)
|
||||
[[ "${ScanForOS,,}" == *"linux"* ]] && export TARGET_OS='LINUX'
|
||||
[[ "${ScanForOS,,}" == *"apple"* ]] && export TARGET_OS='MACOS'
|
||||
[[ "${ScanForOS,,}" == *"windows"* ]] && export TARGET_OS='WINDOWS'
|
||||
[[ -z $TARGET_OS ]] && export TARGET_OS='UNKNOWN'
|
||||
echo $FINGERPRINT $TARGET_OS >> $DATABASE
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue