def OS_Detection():
targetip=str(raw_input( Fore.CYAN +"\nEnter Target IP: " +Fore.RESET))
print ''
if targetip == '' or targetip is None:
print Fore.RED+"Enter correct input...!!!"+Fore.RESET
if targetip==self_ip:
print Fore.GREEN+EX+"%s belongs to Linux family..." % targetip + Fore.RESET
return
ans,unans=arping(targetip,timeout=2,verbose=False)
ip=IP()
ip.dst=targetip
icmp=ICMP()
icmp.type=8
icmp.code=0
z=sr1(ip/icmp,timeout=10,verbose=False)
if z is None and len(ans)==1:
print Fore.YELLOW+"Host is up...but seems to be filtered..." + Fore.RESET
elif z is None and len(ans)==0:
print Fore.RED+"Host is unreachable..."+Fore.RESET
else:
if z.ttl==128:
print Fore.GREEN+"%s belongs to Windows family..." % targetip + Fore.RESET
elif z.ttl==64:
print Fore.GREEN+"%s belongs to Linux family..." % targetip + Fore.RESET
elif z.ttl==56:
print Fore.GREEN+"%s belongs to Mac family..."% targetip + Fore.RESET
else:
print Fore.GREEN+"Unknown OS..." + Fore.RESET
评论列表
文章目录