diff --git a/dev-python/egghatch/egghatch-0.2.3-r2.ebuild b/dev-python/egghatch/egghatch-0.2.3-r3.ebuild similarity index 54% rename from dev-python/egghatch/egghatch-0.2.3-r2.ebuild rename to dev-python/egghatch/egghatch-0.2.3-r3.ebuild index 1696a1359..26273fba8 100644 --- a/dev-python/egghatch/egghatch-0.2.3-r2.ebuild +++ b/dev-python/egghatch/egghatch-0.2.3-r3.ebuild @@ -1,10 +1,10 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 -PYTHON_COMPAT=( python2_7 ) -#python3_{5,6} ) +PYTHON_COMPAT=( python3_{6,7} ) + inherit distutils-r1 DESCRIPTION="Cuckoo Sandbox Shellcode Identification & Formatting" @@ -14,9 +14,10 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" LICENSE="GPL-3" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="test" -RDEPEND="dev-libs/capstone[python,${PYTHON_USEDEP}] - !!dev-libs/capstone-bindings" -DEPEND="${RDEPEND} - dev-python/setuptools[${PYTHON_USEDEP}]" +RDEPEND="${PYTHON_DEPS} + dev-libs/capstone[python,${PYTHON_USEDEP}] + dev-python/future[${PYTHON_USEDEP}]" +DEPEND="${RDEPEND}" + +PATCHES=( "${FILESDIR}/${P}_add_Python3.6_support.patch" ) diff --git a/dev-python/egghatch/files/egghatch-0.2.3_add_Python3.6_support.patch b/dev-python/egghatch/files/egghatch-0.2.3_add_Python3.6_support.patch new file mode 100644 index 000000000..961c6e3ff --- /dev/null +++ b/dev-python/egghatch/files/egghatch-0.2.3_add_Python3.6_support.patch @@ -0,0 +1,113 @@ +diff -ur a/egghatch/main.py b/egghatch/main.py +--- a/egghatch/main.py 2018-03-29 20:44:29.000000000 +0300 ++++ b/egghatch/main.py 2020-03-02 08:32:22.766426957 +0300 +@@ -9,10 +9,10 @@ + + def main(): + if len(sys.argv) != 2: +- print "Usage: python %s " % sys.argv[0] ++ print("Usage: python %s " % sys.argv[0]) + exit(1) + +- print Shellcode(open(sys.argv[1], "rb").read()).to_json() ++ print(Shellcode(open(sys.argv[1], "rb").read()).to_json()) + + def parse(payload): + return Shellcode(payload).to_dict() +diff -ur a/egghatch/misc.py b/egghatch/misc.py +--- a/egghatch/misc.py 2018-03-29 20:44:29.000000000 +0300 ++++ b/egghatch/misc.py 2020-03-02 08:32:54.685192618 +0300 +@@ -2,6 +2,9 @@ + # This file is part of Cuckoo Sandbox - https://cuckoosandbox.org/. + # See the file 'docs/LICENSE' for copying permission. + ++from builtins import int ++from past.builtins import basestring ++ + def str_as_db(s): + r1 = [] + for ch in s: +@@ -14,7 +17,8 @@ + + r2, idx = [], 0 + while idx < len(r1): +- if isinstance(r1[idx], (int, long)): ++ print(type(r1[idx]),isinstance(r1[idx], str)) ++ if isinstance(r1[idx], int): + r2.append("%s" % r1[idx]) + idx += 1 + continue +diff -ur a/egghatch/shellcode.py b/egghatch/shellcode.py +--- a/egghatch/shellcode.py 2018-04-01 16:05:45.000000000 +0300 ++++ b/egghatch/shellcode.py 2020-03-02 08:34:49.022168624 +0300 +@@ -5,6 +5,8 @@ + import json + + from egghatch.block import Block ++from builtins import range ++import base64 + + class Shellcode(object): + def __init__(self, payload): +@@ -36,7 +38,15 @@ + ret["bbl"] = sorted(self.bbl.items()) + ret["text"] = sorted(self.insns) + for idx, data in sorted(self.data.items()): +- ret["data"].append((idx, data.decode("latin1"))) ++ if isinstance(data, str): ++ # Python2 ++ ret["data"].append((idx, "".join(data.decode("utf-8")))) ++ elif isinstance(data, bytes): ++ # Python3 ++ ret["data"].append((idx, "".join([chr(x) for x in data]))) ++ else: ++ print("Warning, wrong type received in data : %s" % type(data)) ++ ret = "" + return ret + + def to_json(self): +@@ -135,7 +145,7 @@ + continue + + op = insn2.operands +- for _ in xrange(64): ++ for _ in range(64): + if insn2.addr + insn2.size not in insns: + break + +@@ -156,7 +166,7 @@ + parsed[len(self.payload)] = len(self.payload) + + chunks = sorted(parsed.items()) +- for idx in xrange(1, len(chunks)): ++ for idx in range(1, len(chunks)): + _, start = chunks[idx-1] + end, _ = chunks[idx] + if start != end and start < end: +diff -ur a/setup.py b/setup.py +--- a/setup.py 2018-06-21 21:46:46.000000000 +0300 ++++ b/setup.py 2020-03-02 08:35:44.661253884 +0300 +@@ -22,13 +22,13 @@ + "Natural Language :: English", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: POSIX :: Linux", +- "Programming Language :: Python :: 2.7", ++ "Programming Language :: Python :: 2.7, 3.6", + "Topic :: Security", + ], + url="https://cuckoosandbox.org/", + license="GPLv3", + description="Cuckoo Sandbox Shellcode Identification & Formatting", +- long_description=open("README.rst", "rb").read(), ++ long_description=open("README.rst", "r").read(), + include_package_data=True, + entry_points={ + "console_scripts": [ +@@ -36,6 +36,7 @@ + ], + }, + install_requires=[ ++ "future", + ], + extras_require={ + ":sys_platform == 'win32'": [ diff --git a/dev-python/egghatch/metadata.xml b/dev-python/egghatch/metadata.xml new file mode 100644 index 000000000..4fa8ff351 --- /dev/null +++ b/dev-python/egghatch/metadata.xml @@ -0,0 +1,8 @@ + + + + + proxy-maint@gentoo.org + Proxy Maintainers + +