blob: 6baccff03ad5692b9796c13dfcddb6c998d34712 (
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(f"{sys.argv[0]} nécessite les droits root")
|