Skip to content

Instantly share code, notes, and snippets.

@powerexploit
Created January 17, 2020 06:59
Show Gist options
  • Save powerexploit/8ab380ad0290028f9a1efe6333683a5a to your computer and use it in GitHub Desktop.
Save powerexploit/8ab380ad0290028f9a1efe6333683a5a to your computer and use it in GitHub Desktop.
Os Detection With TTL
#TTlOs.psm1
#<
# Ping scanner with os detection according with ttl value.
# Test-connection is a type of function in powershell uses as a ping command.
#>
#
function PsPing
{
param($ip)
Process
{
$os = (Test-Connection -Count 1 $ip).ResponseTimeToLive
if ($os -lt 65 )
{
write-host -f yellow "Target is running on Linux Machine according to TTL value ${os}"
}
elseif($os -gt 64 -and $os -lt 129)
{
write-host -f green "Target is running on Window Based Machine according to TTL value ${os}"
}
else
{
Write-host -f blue "Target running on cisco."
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment