#!/usr/bin/python from scapy.all import * conf.verb = 0 def scanping(): for ip in range(100, 255): #packet = IP(dst="192.168.2." + str(ip), ttl=20)/ICMP() #on peut aussi en profiter pour envoyer un flag (ctf) MESSAGE = "code=01234" packet = IP(dst="192.168.2." + str(ip), ttl=20)/ICMP()/MESSAGE reply = sr1(packet, timeout=1) if not (reply is None): print(reply.src, "is online") if __name__ == "__main__": try: scanping() except PermissionError: print(f"{sys.argv[0]} nécessite les droits root")