From f4d21d36e5c86d120de636692e91f87e4e969752 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 19 Nov 2024 15:27:50 -0500 Subject: [PATCH 1/3] Add BlackHat Asia 2024 and update CircleCI link --- README.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 124b486f..b114d73d 100644 --- a/README.rst +++ b/README.rst @@ -282,6 +282,7 @@ to spend. See Also -------- +* https://rocky.github.io/blackhat-asia-2024-additional/all-notes-print.html : How to Read and Write a High-Level Bytecode Decompiler: ``uncompyle6`` ``decompyle3`` -- BlackHat 2024 Asia (`video `_). A big thanks to the Organizers and Reviewers for letting me speak. This kind of thing encourages me to work on projects like this. * https://github.com/rocky/python-decompile3 : Much smaller and more modern code, focusing on 3.7 and 3.8. Changes in that will get migrated back here. * https://code.google.com/archive/p/unpyc3/ : supports Python 3.2 only. The above projects use a different decompiling technique than what is used here. Currently unmaintained. * https://github.com/figment/unpyc3/ : fork of above, but supports Python 3.3 only. Includes some fixes like supporting function annotations. Currently unmaintained. @@ -306,8 +307,8 @@ See Also .. _uncompyle2: https://github.com/wibiti/uncompyle2 .. _unpyc37: https://github.com/andrew-tavera/unpyc37 .. _this: https://github.com/rocky/python-uncompyle6/wiki/Deparsing-technology-and-its-use-in-exact-location-reporting -.. |buildstatus| image:: https://travis-ci.org/rocky/python-uncompyle6.svg - :target: https://travis-ci.org/rocky/python-uncompyle6 +.. |buildstatus| image:: https://circleci.com/gh/rocky/python-uncompyle6.svg?style=svg + :target: https://app.circleci.com/pipelines/github/rocky/python-uncompyle6 .. |packagestatus| image:: https://repology.org/badge/vertical-allrepos/python:uncompyle6.svg :target: https://repology.org/project/python:uncompyle6/versions .. _PJOrion: http://www.koreanrandom.com/forum/topic/15280-pjorion-%D1%80%D0%B5%D0%B4%D0%B0%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%86%D0%B8%D1%8F-%D0%B4%D0%B5%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%86%D0%B8%D1%8F-%D0%BE%D0%B1%D1%84 From 4181bcbc79eaf05d56bb7d1d1f78220cee502559 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 26 Nov 2024 09:43:32 -0500 Subject: [PATCH 2/3] Correct getting code node on mkfunc --- uncompyle6/semantics/fragments.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/uncompyle6/semantics/fragments.py b/uncompyle6/semantics/fragments.py index 8bb7aad1..dead329f 100644 --- a/uncompyle6/semantics/fragments.py +++ b/uncompyle6/semantics/fragments.py @@ -79,14 +79,13 @@ from uncompyle6.semantics import pysource from uncompyle6.semantics.check_ast import checker from uncompyle6.semantics.consts import ( INDENT_PER_LEVEL, - MAP, NONE, PASS, PRECEDENCE, TABLE_DIRECT, - TABLE_R, escape, ) +from uncompyle6.semantics.helper import find_code_node from uncompyle6.semantics.pysource import ( DEFAULT_DEBUG_OPTS, TREE_DEFAULT_DEBUG, @@ -596,17 +595,7 @@ class FragmentsWalker(pysource.SourceWalker, object): def n_mkfunc(self, node): start = len(self.f.getvalue()) - if self.version >= (3, 3) or node[-2] == "kwargs": - # LOAD_CONST code object .. - # LOAD_CONST 'x0' if >= 3.3 - # MAKE_FUNCTION .. - code_node = node[-3] - elif node[-2] == "expr": - code_node = node[-2][0] - else: - # LOAD_CONST code object .. - # MAKE_FUNCTION .. - code_node = node[-2] + code_node = find_code_node(node, -2) func_name = code_node.attr.co_name self.write(func_name) self.set_pos_info(code_node, start, len(self.f.getvalue())) From addddf82f51f0ac6e04a58cfd02d5f6db5849edb Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 26 Nov 2024 09:44:49 -0500 Subject: [PATCH 3/3] Correct getting code node on mkfunc --- uncompyle6/semantics/fragments.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/uncompyle6/semantics/fragments.py b/uncompyle6/semantics/fragments.py index 537ca7f5..c27fed37 100644 --- a/uncompyle6/semantics/fragments.py +++ b/uncompyle6/semantics/fragments.py @@ -80,14 +80,13 @@ from uncompyle6.semantics import pysource from uncompyle6.semantics.check_ast import checker from uncompyle6.semantics.consts import ( INDENT_PER_LEVEL, - MAP, NONE, PASS, PRECEDENCE, TABLE_DIRECT, - TABLE_R, escape, ) +from uncompyle6.semantics.helper import find_code_node from uncompyle6.semantics.pysource import ( DEFAULT_DEBUG_OPTS, TREE_DEFAULT_DEBUG, @@ -597,17 +596,7 @@ class FragmentsWalker(pysource.SourceWalker, object): def n_mkfunc(self, node): start = len(self.f.getvalue()) - if self.version >= (3, 3) or node[-2] == "kwargs": - # LOAD_CONST code object .. - # LOAD_CONST 'x0' if >= 3.3 - # MAKE_FUNCTION .. - code_node = node[-3] - elif node[-2] == "expr": - code_node = node[-2][0] - else: - # LOAD_CONST code object .. - # MAKE_FUNCTION .. - code_node = node[-2] + code_node = find_code_node(node, -2) func_name = code_node.attr.co_name self.write(func_name) self.set_pos_info(code_node, start, len(self.f.getvalue()))