logo

overlay

My (experimental) gentoo overlay
commit: 9fe812f0cc7fc21684e03d85001176df01d349d2
parent: f53d032102f2ce8be78043f21862eb60bddc755f
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 30 Mar 2019 02:15:40 +0100

app-misc/binwalk: New package (based on ::pentoo)

Diffstat:

Aapp-misc/binwalk/Manifest1+
Aapp-misc/binwalk/binwalk-2.1.1-r2.ebuild45+++++++++++++++++++++++++++++++++++++++++++++
Aapp-misc/binwalk/files/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aapp-misc/binwalk/metadata.xml23+++++++++++++++++++++++
4 files changed, 136 insertions(+), 0 deletions(-)

diff --git a/app-misc/binwalk/Manifest b/app-misc/binwalk/Manifest @@ -0,0 +1 @@ +DIST binwalk-2.1.1.tar.gz 263977 SHA256 1b70a5b03489d29f60fef18008a2164974234874faab48a4f47ec53d461d284a SHA512 373e276a4d6ec845952f1091f85f953d3b0d52d561d9b74a54000ebdef85d13cafc997a4f8f76f25842db8b76fdcd1e602d4d81792a3ea01c9dea6c6ed5c2168 WHIRLPOOL 3cb8faedd02c6a4859467c285efe00e73ea3e52c48ce2b55e0344853e8a5b7884f9d15eb502ab16bba7262e38dfdb0cbcfadc7d3af4015e4357d9d2d248e6113 diff --git a/app-misc/binwalk/binwalk-2.1.1-r2.ebuild b/app-misc/binwalk/binwalk-2.1.1-r2.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} ) + +inherit distutils-r1 + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="https://github.com/devttys0/binwalk.git" + inherit git-r3 +else + SRC_URI="https://github.com/devttys0/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="amd64 x86" +fi + +DESCRIPTION="A tool for identifying files embedded inside firmware images" +HOMEPAGE="https://github.com/devttys0/binwalk" + +LICENSE="MIT" +SLOT="0" +IUSE="graph squashfs jffs2" + +RDEPEND=" + $(python_gen_cond_dep 'dev-python/backports-lzma[${PYTHON_USEDEP}]' python2_7) + graph? ( dev-python/pyqtgraph[opengl,${PYTHON_USEDEP}] ) + squashfs? ( + sys-fs/squashfs-tools:0 + sys-fs/sasquatch + ) + jffs2? ( app-arch/jefferson ) + dev-python/capstone-python + sys-fs/mtd-utils + app-arch/arj + app-arch/p7zip + app-arch/cabextract + sys-fs/cramfs +" + +PATCHES=( "${FILESDIR}"/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch ) + +python_install_all() { + local DOCS=( API.md README.md ) + distutils-r1_python_install_all +} diff --git a/app-misc/binwalk/files/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch b/app-misc/binwalk/files/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch @@ -0,0 +1,67 @@ +From 95bce4edcc6e92c9517b80ccb1fb956f591e0738 Mon Sep 17 00:00:00 2001 +From: Craig Heffner <heffnercj@gmail.com> +Date: Tue, 5 Jan 2016 13:28:24 -0500 +Subject: [PATCH] Added check for backports.lzma when importing lzma module + +--- + src/binwalk/modules/compression.py | 5 ++++- + src/binwalk/plugins/lzmaextract.py | 6 +++++- + src/binwalk/plugins/lzmavalid.py | 5 ++++- + 3 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/binwalk/modules/compression.py b/src/binwalk/modules/compression.py +index 97ca68d..e919f7e 100644 +--- a/src/binwalk/modules/compression.py ++++ b/src/binwalk/modules/compression.py +@@ -2,11 +2,14 @@ + + import os + import zlib +-import lzma + import struct + import binwalk.core.compat + import binwalk.core.common + from binwalk.core.module import Option, Kwarg, Module ++try: ++ import lzma ++except ImportError: ++ from backports import lzma + + class LZMAHeader(object): + def __init__(self, **kwargs): +diff --git a/src/binwalk/plugins/lzmaextract.py b/src/binwalk/plugins/lzmaextract.py +index 137b4cc..93f6240 100755 +--- a/src/binwalk/plugins/lzmaextract.py ++++ b/src/binwalk/plugins/lzmaextract.py +@@ -12,7 +12,11 @@ class LZMAExtractPlugin(binwalk.core.plugin.Plugin): + # lzma package in Python 2.0 decompress() does not handle multiple + # compressed streams, only first stream is extracted. + # backports.lzma package could be used to keep consistent behaviour. +- import lzma ++ try: ++ import lzma ++ except ImportError: ++ from backports import lzma ++ + self.decompressor = lzma.decompress + + # If the extractor is enabled for the module we're currently loaded +diff --git a/src/binwalk/plugins/lzmavalid.py b/src/binwalk/plugins/lzmavalid.py +index a343656..62e15b9 100644 +--- a/src/binwalk/plugins/lzmavalid.py ++++ b/src/binwalk/plugins/lzmavalid.py +@@ -17,7 +17,10 @@ class LZMAPlugin(binwalk.core.plugin.Plugin): + + def init(self): + try: +- import lzma ++ try: ++ import lzma ++ except ImportError: ++ from backports import lzma + self.decompressor = lzma.decompress + except ImportError as e: + self.decompressor = None +-- +2.12.2 + diff --git a/app-misc/binwalk/metadata.xml b/app-misc/binwalk/metadata.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>contact@hacktivis.me</email> + <name>Haelwenn (lanodan) Monnier</name> + </maintainer> + <longdescription lang="en">Binwalk is a tool for searching a given binary image for embedded files. + Specifically, it is designed for identifying files embedded inside of firmware + images. Binwalk uses the libmagic library, so it is compatible with magic + signatures created for the Unix file utility. + Binwalk also includes a custom magic signature file which contains improved + signatures for files that are commonly found in firmware images such as + compressed/archived files, firmware headers, Linux kernels, bootloaders, + filesystems, etc. +</longdescription> + <upstream> + <remote-id type="github">devttys0/binwalk</remote-id> + </upstream> + <use> + <flag name="graph">Enable support for generating entropy graphs</flag> + </use> +</pkgmetadata>