PDA

View Full Version : Issue with Scapy and Python sending IPv6 packets



Lux
2013-08-28, 16:29
I am doing some academic work investigating IPv6 and was using Debian to craft packets with Scapy and send them, I had gotten as far as sending basic packets when the partition failed and I decided to move to Kali now rather than after my thesis.

Whether I run a Python script with the code or directly input it while using Scapy I get the same errors to which I can't find a documented solution anywhere and I've been searching for two days.

The code which won't execute is basic and as follows:



import logging
import sys
from scapy.all import *

conf.iface='eth0'
conf.route6.add(dst="fe80::60c:ceff:fee2:d4fe", gw="fe80::21f:c6ff:fe5d:8a38")
print conf.route6
i=IPv6()
i.dst="fe80::60c:ceff:fee2:d4fe"
i.src="fe80::21f:c6ff:fe5d:8a38"
i.display()
q=ICMPv6EchoRequest(data = "lol")
q.display()
p=(i/q)
reply=sr1(p)
reply.show()


The output and errors I'm receiving are as follows:



WARNING: No route found for IPv6 destination :: (no default route?)
Destination Next Hop iface src candidates
fe80::/64 :: eth0 fe80::21f:c6ff:fe5d:8a38
::1/128 :: lo ::1
fe80::21f:c6ff:fe5d:8a38/128 :: lo ::1
fe80::60c:ceff:fee2:d4fe/128 fe80::21f:c6ff:fe5d:8a38 lo :, :, 1
###[ IPv6 ]###
version = 6
tc = 0
fl = 0
plen = None
nh = No Next Header
hlim = 64
src = fe80::21f:c6ff:fe5d:8a38
dst = fe80::60c:ceff:fee2:d4fe
###[ ICMPv6 Echo Request ]###
type = Echo Request
code = 0
cksum = None
id = 0x0
seq = 0x0
data = 'lol'
Begin emission:
ERROR: --- Error in child 10355
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 89, in sndrcv
pks.send(p)
File "/usr/local/lib/python2.7/dist-packages/scapy/arch/linux.py", line 375, in send
iff,a,gw = x.route()
File "/usr/local/lib/python2.7/dist-packages/scapy/layers/inet6.py", line 356, in route
return conf.route6.route(dst)
File "/usr/local/lib/python2.7/dist-packages/scapy/route6.py", line 232, in route
srcaddr = get_source_addr_from_candidate_set(dst, p[1][1])
File "/usr/local/lib/python2.7/dist-packages/scapy/utils6.py", line 144, in get_source_addr_from_candidate_set
candidate_set.sort(cmp=rfc3484_cmp, reverse=True)
AttributeError: 'str' object has no attribute 'sort'


I am running rather late on the thesis the Scapy code implementation will be for (I have a week to implement, document, evaluate and conclude) so if ANYONE has suggestions as to how to remedy this I will be eternally grateful.

If anymore information is needed I'll be happy to provide.

Thanks,

Lux