Leider ist die Dokumentation im im Gegensatz zum Programm noch weitgehend unbrauchbar und deshalb will ich versuchen hier immer mal wieder nützliche Scapy Skripte/Einzeiler vorzustellen.
Wilde DHCP Server finden
Problem: irgendwo im Netz schwirrt ein nicht genemigter DHCP Server herum und vergibt IP Adressen. Die umständliche Methode wäre das eigene Interface umzukonfigurieren und einen DHCP Request zu machen. Scapy schafft das ohne diesen lästigen Mehraufwand.
>>> dhcp_request(iface="eth1")
WARNING: conf.checkIPaddr is not 0, I may not be able to match the answer
Begin emission:
Finished to send 1 packets.
.......................................
Received 39 packets, got 0 answers, remaining 1 packets
Ein gleichzeitiger tcpdump offenbart ide MAC-Adresse des Übeltäters:
# tcpdump -e -i eth1 port 67 or port 68
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
21:43:17.938745 00:11:11:11:11:11 (oui Unknown) > Broadcast, ethertype IPv4 (0x0800), length 286: 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:11:11:11:11:11 (oui Unknown), length 244
21:43:17.952684 00:22:22:22:22:22 (oui Unknown) > Broadcast, ethertype IPv4 (0x0800), length 342: ..bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length 300
Mit einem managbaren Switch lässt sich die Adresse 00:22:22:22:22:22 nun schnell einem Port zuordnen. Unter IOS z.B. mit show mac-address-table oder unter CatOS mit show cam dynamic. Dann muss man nur noch das Kabel verfolgen und dem User auf die Finger klopfen ;).


Kommentare