diff options
| author | jerome <jerome@xlinfo.fr> | 2025-06-20 14:17:15 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-06-20 14:17:15 +0200 |
| commit | 34b5518fa596845b557639fea86a3b59cdff5d2d (patch) | |
| tree | 0e6e2dd994eb7c4995848d448009a3a1a1e9541b /scapy/ping.py | |
| parent | ae8ae69ce17974dc7a1d26ca02d7c0ba1f7f2515 (diff) | |
| download | python-34b5518fa596845b557639fea86a3b59cdff5d2d.tar.gz python-34b5518fa596845b557639fea86a3b59cdff5d2d.zip | |
scapy
Diffstat (limited to 'scapy/ping.py')
| -rw-r--r-- | scapy/ping.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/scapy/ping.py b/scapy/ping.py index 4d1aa66..6baccff 100644 --- a/scapy/ping.py +++ b/scapy/ping.py @@ -2,11 +2,19 @@ from scapy.all import * conf.verb = 0 -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") + +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") |
