Reverse engineer a.pyo python file

I have 2.pyo python files that I can convert to .py source files, but they don't compile fine, as I hinted to decompile.

Therefore, looking at the source code, I can say that config.pyo just had the variables in the array:

ADMIN_USERIDS = [116901, 141, 349244, 39, 1159488]

I would like to take the original .pyo and disassembly or something else that I need to do to change one of these identifiers.

Or....

in model.pyo the source points

if (productsDeveloperId! = self.getUserId ()):

All I would like to do is hex edit the! = To be == ..... Simple with windows exe, but I cannot find a good python disassembler anywhere.

Any suggestions are welcome ... I am new to reading bytecode and new in python.

+3
5

.pyo .py, .py python .py. Python .pyo. pyo

- python, , == 1 = .pyo

- .py . , , != To ==, .

0

, .

, , , hex edit... ... , ... , . ( ) hex (), .

, !=

, IDA Pro python, , python .

0

IDA 6.0 .pyc.

0

, , Python -.

, -, . , BytecodeAssembler , .

0

, . - , .

, . , , xdis, , -, pycdas, ++, pycdc. .

, , , . , , uncompyle6, . , github-.

Ok. , , . , Python, pyc. - ; http://github.com/rocky/python-xasm.

, .

, , , .

Python:

  ___file__ == '__main'

pydisasm:

...
# Constants:
#    0: '__main'
#    1: None
# Names:
#    0: ___file__
  1:           0 LOAD_NAME                 0 (___file__)
               3 LOAD_CONST                0 ('__main')
               6 COMPARE_OP                2 (==)
               9 POP_TOP
              10 LOAD_CONST                1 (None)
              13 RETURN_VALUE

Ok. , == a COMPARE_OP , 2.

https://docs.python.org/3.6/library/dis.html#opcode-COMPARE_OP ( Python 3.6, Python) :

The operation name can be found in cmp_op[opname].

Python opcode.py, , , -, : https://github.com/python/cpython/blob/master/Lib/opcode.py#L24

 cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is', ...

, , == 2, != 3.

[116901, 141, 349244, 39, 1159488], Constants, , .

0

Source: https://habr.com/ru/post/1744903/


All Articles