>From the second listing, I think line 7 can be something like: e = Ether(packet.arr.tostring())
(which is much more efficient and straightforward) -- Murphy On Oct 13, 2011, at 3:48 PM, Javier Liendo wrote: > hi experts... > > i know it is of really bad etiquette answering over you own email, but > as soon i sent this mail i did the following test which seems to be > working...just wanted to share it and see if anybody sees anything > wrong with this approach... > > i defined an hex-string to an hex-binary-blob function inside > packet_utils.py (conversion method taken from Brian@stackoverflow) > > 1 def octstr_to_hexbinary(octstr): > 2 hexdigits = [int(x,16) for x in octstr] > 3 blob = ''.join(struct.pack('B',(high<<4) + low) for high,low in > zip(hexdigits[::2], hexdigits[1::2])) > 4 return blob > > then on my controller program i did the following > > 1 from scapy.all import * > 2 ... > 3 def arping_me(self, dpid, inport, packet, buf, bufid): > 4 """If arping one of my own IPs respond""" > 5 log.debug("+++ inside arping_me") > 6 print array_to_octstr(packet.arr) > 7 e=Ether(octstr_to_hexbinary(array_to_octstr(packet.arr))) > 8 e.show() > > in (6) i'm printing the hex string representation of the packet... > > in (7) i'm calling octstr_to_hexbinary to get a binary "blob" that i > could use with scapy... > > in (8) i get a variable 'e' which can be scapy-manipulated... > > does this sounds right? > > regards, > > javier > > > On Thu, Oct 13, 2011 at 4:40 PM, Javier Liendo <jav...@liendo.net> wrote: >> hi experts, >> >> a) is there a way to decode/parse a receiving packet inside nox using scapy? >> >> b) is it possible to craft a packet using scapy and then use it (i.e. >> send_openflow) inside nox? >> >> regards, >> >> javier >> > _______________________________________________ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev _______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev