summaryrefslogtreecommitdiff
path: root/scapy/ping.py
blob: dfb34ec77a2043214951efb09a774e16a2c8989b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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("Ce script nécessite les droits root")