Ticket #142 (closed defect: fixed)

Opened 2 months ago

Last modified 3 weeks ago

sndrcv() fails in hashret() with "unsupported operand type(s)" error

Reported by: mark Assigned to: pbi
Priority: major Milestone: mainstream
Component: Scapy Version: 2.0.0.x
Keywords: Cc:

Description

This is using Scapy 2.0.0.10 on Ubuntu 8.0.4 I'm using a simple script to send/receive a bunch of TCP messages over Ethernet, and get this error after a few iterations (dozens to a few hundred iterations):

Traceback (most recent call last):

File "./test.rb", line 28, in <module>

main()

File "./test.rb", line 25, in main

run_test(options.src, options.dst, int(options.sport)+i, int(options.dport))

File "./test.rb", line 7, in run_test

synack=sr1(syn,verbose=0)

File "/usr/lib/python2.5/site-packages/scapy/sendrecv.py", line 316, in sr1

a,b,c=sndrcv(s,x,*args,**kargs)

File "/usr/lib/python2.5/site-packages/scapy/sendrecv.py", line 136, in sndrcv

h = r.hashret()

File "/usr/lib/python2.5/site-packages/scapy/layers/inet6.py", line 404, in hashret

return struct.pack("B",nh)+self.payload.hashret()

File "/usr/lib/python2.5/site-packages/scapy/layers/inet.py", line 345, in hashret

return self.payload.hashret()

File "/usr/lib/python2.5/site-packages/scapy/layers/llmnr.py", line 35, in hashret

return struct.pack("!H", id)

File "/usr/lib/python2.5/struct.py", line 63, in pack

return o.pack(*args)

TypeError?: unsupported operand type(s) for &: 'builtin_function_or_method' and 'long'

The script is very simple - it just does a TCP 3-way handshake against a range of target ports.

Attachments

Change History

(follow-up: ↓ 4 ) 10/02/08 23:08:07 changed by pbi

Fixed in [fd3a7be9f830]

(follow-up: ↓ 3 ) 10/03/08 01:41:57 changed by Dirk Loss

Considering the file name 'test.rb', you seem to be calling Scapy from a Ruby script. Are you using Ruby/Python or something like that? (I didn't know about that library before, but your post got me interested. :-)

(in reply to: ↑ 2 ) 10/08/08 02:14:36 changed by anonymous

Ignore the .rb - that was a brain fart on my part. This is a plain python script.

Replying to Dirk Loss:

Considering the file name 'test.rb', you seem to be calling Scapy from a Ruby script. Are you using Ruby/Python or something like that? (I didn't know about that library before, but your post got me interested. :-)

(in reply to: ↑ 1 ) 10/08/08 02:37:21 changed by anonymous

This seems to be a bug in llmnr.py inside class LLMNRQuery. To work around the problem I changed hashret in this class to return an empty string.

This repro script should show the issue: LLMNRQuery().hashret()

Replying to pbi:

Sorry, on this case, I need a minimal code to reproduce it.

10/27/08 23:37:20 changed by pbi

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [fd3a7be9f830]


Add/Change #142 (sndrcv() fails in hashret() with "unsupported operand type(s)" error)




Change Properties
Action