Advertisement
0xACAB

Fixing "corrupted frame" in Sulley linux x86_64

Jan 27th, 2013
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.44 KB | None | 0 0
  1. I was having trouble getting the sulley framework to run properly on Linux x86_64, but managed to fix it, so thought it might be of use to someone else.
  2.  
  3. The problem was that the network_monitor.py script would error out, and my sessions script showing 0 bytes data was captured:
  4.  
  5. [06:14.06] initializing capture for test case #1
  6. Exception in thread Thread-1:
  7. Traceback (most recent call last):
  8. File “/usr/lib/python2.6/threading.py, line 525, in __bootstrap_inner
  9. self.run()
  10. File “network_monitor.py, line 87, in run
  11. self.pcap.dispatch(0, self.packet_handler)
  12. PcapError: corrupted frame on kernel ring mac offset 70 + caplen 0 > frame len 64
  13.  
  14. After a few dead-ends, figuring out whether all my libraries were up to date, I traced back whatever came first, and that led me to pre_send:
  15.  
  16.     def pre_send (self, test_number):
  17.         '''
  18.        This routine is called before the fuzzer transmits a test case and spin off a packet capture thread.
  19.        '''
  20.  
  21.         self.log("initializing capture for test case #%d" % test_number)
  22.  
  23.         # open the capture device and set the BPF filter.
  24.         self.pcap = pcapy.open_live(self.device, -1, 1, 1000)
  25.         self.pcap.setfilter(self.filter)
  26.  
  27.         ........
  28.  
  29. pcapy.open is crucial. I changed the line to:
  30.  
  31. self.pcap = pcapy.open_live(self.device, 65535, True, 1000)
  32.  
  33. And, problem solved. No more PcapErrors, bytes are being captured properly, and sulley works as it should.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement