From 7d0e38e9cf843e7607bd1aa7b66655ddecd75d75 Mon Sep 17 00:00:00 2001 From: Lil-Ran Date: Wed, 5 Mar 2025 10:41:09 +0800 Subject: [PATCH] chore: interact & quality --- CMakeLists.txt | 10 +++++----- README.md | 2 +- helpers/runtime.py | 2 +- helpers/shot.py | 10 +++++++++- pyc_code.cpp | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c671b31..0399714 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,10 @@ endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_library(pycxx STATIC +add_executable(pyarmor-1shot + pyarmor-1shot.cpp + ASTree.cpp + ASTNode.cpp bytecode.cpp data.cpp pyc_code.cpp @@ -61,8 +64,5 @@ add_library(pycxx STATIC bytes/python_3_13.cpp ) -add_executable(pyarmor-1shot pyarmor-1shot.cpp ASTree.cpp ASTNode.cpp) -target_link_libraries(pyarmor-1shot pycxx) - install(TARGETS pyarmor-1shot - RUNTIME DESTINATION bin) + RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/helpers) diff --git a/README.md b/README.md index 460d984..e0fe4fe 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ mkdir build cd build cmake .. cmake --build . -mv pyarmor-1shot[.exe] ../helpers +cmake --install . ``` ## Usage diff --git a/helpers/runtime.py b/helpers/runtime.py index 9ded38d..3b6a1b5 100644 --- a/helpers/runtime.py +++ b/helpers/runtime.py @@ -44,7 +44,7 @@ class RuntimeInfo: break return f'''\ ======================== - PyArmor Runtime ({'Trial' if trial else self.serial_number}) Information: + Pyarmor Runtime ({'Trial' if trial else self.serial_number}) Information: Product: {product} AES key: {self.runtime_aes_key.hex()} Mix string AES nonce: {self.mix_str_aes_nonce().hex()} diff --git a/helpers/shot.py b/helpers/shot.py index 99dd537..275927b 100644 --- a/helpers/shot.py +++ b/helpers/shot.py @@ -126,6 +126,9 @@ def main(): | | |__/ | | |__|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|__| (____) (____) + + For technology exchange only. Use at your own risk. + GitHub: https://github.com/Lil-House/Pyarmor-Static-Unpack-1shot ''') if args.runtime: @@ -200,7 +203,12 @@ def main(): # TODO: is Nuitka package? # TODO: is pyc or single marshalled binary? - # print(runtimes, [(i[0], i[1][:16]) for i in sequences], args.output_dir or args.directory) + if not runtimes: + logger.error('No runtime found') + return + if not sequences: + logger.error('No armored data found') + return decrypt_process(runtimes, sequences, args) diff --git a/pyc_code.cpp b/pyc_code.cpp index d3c07ce..0179fea 100644 --- a/pyc_code.cpp +++ b/pyc_code.cpp @@ -178,7 +178,7 @@ void PycCode::pyarmorDecryptCoCode(unsigned long consts_index, PycModule *mod) return; } - PyarmorCoDescriptor *desc = (PyarmorCoDescriptor *)(descriptor_str.data() + 8); + const PyarmorCoDescriptor *desc = (const PyarmorCoDescriptor *)(descriptor_str.data() + 8); bool copy_prologue = desc->flags & 0x8; bool xor_aes_nonce = desc->flags & 0x4; bool short_code = desc->flags & 0x2;