-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhack-9.py
More file actions
29 lines (24 loc) · 787 Bytes
/
hack-9.py
File metadata and controls
29 lines (24 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
myvarnames = ("a", "b")
mycode = ("\x7C" # LOAD_FAST
"\x00" # 0x0000
"\x00" #
"\x7C" # LOAD_FAST
"\x01" # 0x0001
"\x00" #
"\x17" # BINARY_ADD
"\x53") # RETURN_VALUE
import new
co = new.code(2, # co_argcount,
2, # co_nlocals,
2, # co_stacksize,
0, # co_flags,
mycode, # co_code,
(), # co_consts,
(), # co_names
myvarnames,# co_varnames
"test.py", # co_filename,
"myfunc", # co_name,
0, # co_firstlineno,
"") # co_lnotab
myfunc = new.function(co, {})
print myfunc("abc", "def")