Skip to content

Instantly share code, notes, and snippets.

@syakesaba
Created September 13, 2014 14:04
Show Gist options
  • Save syakesaba/5c5258b2a97a6e74151e to your computer and use it in GitHub Desktop.
Save syakesaba/5c5258b2a97a6e74151e to your computer and use it in GitHub Desktop.
scapy DNSQR can't be serialize
>>> PacketList(a).jsondump("1")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Python/2.7/site-packages/scapy/modules/serialize.py", line 24, in dump_packet_as_json
json.dump(s, file(filename,"wb"),ensure_ascii=False)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 189, in dump
for chunk in iterable:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 431, in _iterencode
for chunk in _iterencode_list(o, _current_indent_level):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
for chunk in chunks:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
for chunk in chunks:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
for chunk in chunks:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
for chunk in chunks:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 442, in _iterencode
o = _default(o)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <DNSQR qname='pbs.twimg.com.' qtype=A qclass=IN |> is not JSON serializable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment