1

I try reverse python bytecode (Content in a .pyc file). I do not want to decompile the code, just understand the Python bytecode :)

The LOAD_NAME statement, pushes the value associated with co_names (tuple of names of local variables...) [namei] onto the stack. (How can I check these values contained in co_names?)

n

jukebox
  • 193
  • 1
  • 7

1 Answers1

4

You can use the marshal module to load the code object.

Now, suppose you want to find out what does LOAD_NAME 1 loads on the evaluation stack.

import marshal

co = marshal.load(...)
print co.co_names[1]

# Or if you want to print the entire co_names
print co.co_names

Refer to the dis module for further reference.

0xec
  • 6,090
  • 3
  • 23
  • 33