diff --git a/.gitignore b/.gitignore index de61d3d..b3c8f2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ /binwalk-0.4.5.tar.gz +/binwalk-1.2.tar.gz +/binwalk-2.0.0.tar.gz +/binwalk-2.1.1.tar.gz +/binwalk-2.2.0.tar.gz +/binwalk-2.3.1.tar.gz +/binwalk-2.3.2.tar.gz +/binwalk-2.3.3.tar.gz +/binwalk-2.3.4.tar.gz diff --git a/0001-Migrate-from-ast.Num-to-ast.Constant.patch b/0001-Migrate-from-ast.Num-to-ast.Constant.patch new file mode 100644 index 0000000..e1cfada --- /dev/null +++ b/0001-Migrate-from-ast.Num-to-ast.Constant.patch @@ -0,0 +1,28 @@ +From 27518c9b5817c1c54f782083db9957260666575d Mon Sep 17 00:00:00 2001 +From: LuK1337 +Date: Wed, 3 Sep 2025 20:41:03 +0200 +Subject: [PATCH] Migrate from ast.Num to ast.Constant + +ast.Num has been removed from Python 3.14. +--- + src/binwalk/core/common.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/binwalk/core/common.py b/src/binwalk/core/common.py +index bff7481..5f34f61 100644 +--- a/src/binwalk/core/common.py ++++ b/src/binwalk/core/common.py +@@ -238,8 +238,8 @@ class MathExpression(object): + return self._eval(ast.parse(expr).body[0].value) + + def _eval(self, node): +- if isinstance(node, ast.Num): # +- return node.n ++ if isinstance(node, ast.Constant): # ++ return node.value + elif isinstance(node, ast.operator): # + return self.OPERATORS[type(node.op)] + elif isinstance(node, ast.UnaryOp): +-- +2.51.0 + diff --git a/6e7736869d998edb6384728c03a348cd9ab1f9ca.patch b/6e7736869d998edb6384728c03a348cd9ab1f9ca.patch new file mode 100644 index 0000000..d57a904 --- /dev/null +++ b/6e7736869d998edb6384728c03a348cd9ab1f9ca.patch @@ -0,0 +1,34 @@ +From 6e7736869d998edb6384728c03a348cd9ab1f9ca Mon Sep 17 00:00:00 2001 +From: Scott Talbert +Date: Sun, 12 Sep 2021 13:34:38 -0400 +Subject: [PATCH] Fix SyntaxWarnings + +Fixes: +/usr/lib/python3.10/site-packages/binwalk/modules/extractor.py:969: SyntaxWarning: "is" with a literal. Did you mean "=="? +/usr/lib/python3.10/site-packages/binwalk/modules/extractor.py:984: SyntaxWarning: "is" with a literal. Did you mean "=="? +--- + src/binwalk/modules/extractor.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/binwalk/modules/extractor.py b/src/binwalk/modules/extractor.py +index 4e4660af..3cc38ab1 100644 +--- a/src/binwalk/modules/extractor.py ++++ b/src/binwalk/modules/extractor.py +@@ -966,7 +966,7 @@ def shell_call(self, command): + + # Fork a child process + child_pid = os.fork() +- if child_pid is 0: ++ if child_pid == 0: + # Switch to the run-as user privileges, if one has been set + if self.runas_uid is not None and self.runas_gid is not None: + os.setgid(self.runas_uid) +@@ -981,7 +981,7 @@ def shell_call(self, command): + rval = subprocess.call(shlex.split(command), stdout=tmp, stderr=tmp) + + # A true child process should exit with the subprocess exit value +- if child_pid is 0: ++ if child_pid == 0: + sys.exit(rval) + # If no os.fork() happened, just return the subprocess exit value + elif child_pid is None: diff --git a/_nose_shim.py b/_nose_shim.py new file mode 100644 index 0000000..074dd44 --- /dev/null +++ b/_nose_shim.py @@ -0,0 +1,10 @@ +def eq_(a, b): + assert a == b + +def ok_(s): + assert s + +def assert_not_equal(a, b): + assert a != b + +assert_equal = eq_ diff --git a/binwalk-2.3.3-tests.patch b/binwalk-2.3.3-tests.patch new file mode 100644 index 0000000..dd4f876 --- /dev/null +++ b/binwalk-2.3.3-tests.patch @@ -0,0 +1,12 @@ +reverted: +--- b/testing/tests/test_firmware_zip.py ++++ a/testing/tests/test_firmware_zip.py +@@ -10,6 +10,8 @@ + ''' + expected_results = [ + [0, 'Zip archive data, at least v1.0 to extract, name: dir655_revB_FW_203NA/'], ++ [51, 'Zip archive data, at least v2.0 to extract, compressed size: 6395868, uncompressed size: 6422554, name: dir655_revB_FW_203NA/DIR655B1_FW203NAB02.bin'], ++ [6395993, 'Zip archive data, at least v2.0 to extract, compressed size: 14243, uncompressed size: 61440, name: dir655_revB_FW_203NA/dir655_revB_release_notes_203NA.doc'], + [6410581, 'End of Zip archive, footer length: 22'], + + ] diff --git a/binwalk.spec b/binwalk.spec index d10043e..6fc3a22 100644 --- a/binwalk.spec +++ b/binwalk.spec @@ -1,45 +1,231 @@ Name: binwalk -Version: 0.4.5 -Release: 1%{?dist} +Version: 2.3.4 +Release: 15%{?dist} Summary: Firmware analysis tool - -License: MIT -URL: http://code.google.com/p/binwalk/ -Source0: http://%{name}.googlecode.com/files/%{name}-%{version}.tar.gz - -BuildRequires: file-devel -BuildRequires: libcurl-devel -BuildRequires: zlib-devel +License: MIT +URL: https://github.com/ReFirmLabs/binwalk +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +Source1: _nose_shim.py +Patch0: binwalk-2.3.3-tests.patch +Patch1: %{url}/pull/559/commits/6e7736869d998edb6384728c03a348cd9ab1f9ca.patch +Patch2: version-oops.patch +# https://github.com/ReFirmLabs/binwalk/issues/507 +Patch3: requires-zombie-imp.patch +Patch4: 0001-Migrate-from-ast.Num-to-ast.Constant.patch +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: python3-setuptools +# https://github.com/ReFirmLabs/binwalk/issues/507 +BuildRequires: (python3-zombie-imp if python3-devel >= 3.12) +# For tests +BuildRequires: python3-pytest +# Optional, for graphs and visualizations +Suggests: python3-pyqtgraph +# Optional, for --disasm functionality +Suggests: capstone +# Optional, for automatic extraction/decompression of files and data +Recommends: mtd-utils gzip bzip2 tar arj p7zip p7zip-plugins cabextract squashfs-tools lzop srecord +Suggests: sleuthkit %description Binwalk is a tool for searching a given binary image for embedded files and executable code. Specifically, it is designed for identifying files and code -embedded inside of firmware images. Binwalk uses the libmagic library, so it is -compatible with magic signatures created for the Unix file utility. +embedded inside of firmware images. Binwalk uses the python-magic library, so +it is compatible with magic signatures created for the Unix file utility. %prep -%setup -q +%autosetup -p1 +# replace nose with minimal compatibility shim +# upsteram has moved away from Python in version 3+ +cp -a %{SOURCE1} testing/tests/_nose_shim.py +sed -i 's/from nose.tools import/from _nose_shim import/' testing/tests/*.py %build -pushd src -# binwalk wants to install its file magic to /etc, but it's really more like -# static data than like a config file. -%configure --sysconfdir=%{_datadir} -make %{?_smp_mflags} -popd +%py3_build %install -rm -rf $RPM_BUILD_ROOT -pushd src -%make_install -popd +%py3_install + +%check +cd testing/tests +%pytest %files -%doc docs/* +%doc API.md INSTALL.md README.md +%license LICENSE %{_bindir}/%{name} -%{_datadir}/%{name}/ +%{python3_sitelib}/%{name}/ +%{python3_sitelib}/%{name}-%{version}*.egg-info %changelog +* Fri Sep 19 2025 Python Maint - 2.3.4-15 +- Rebuilt for Python 3.14.0rc3 bytecode + +* Wed Sep 03 2025 LuK1337 - 2.3.4-14 +- Add support for Python 3.14 + +* Wed Jul 23 2025 Fedora Release Engineering - 2.3.4-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Tue Jun 03 2025 Python Maint - 2.3.4-12 +- Rebuilt for Python 3.14 + +* Thu Jan 16 2025 Fedora Release Engineering - 2.3.4-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Sat Dec 14 2024 Miro Hrončok - 2.3.4-10 +- Replace deprecated nose with pytest +- https://fedoraproject.org/wiki/Changes/DeprecateNose + +* Wed Jul 31 2024 Scott Talbert - 2.3.4-9 +- Confirm License tag is already SPDX + +* Wed Jul 17 2024 Fedora Release Engineering - 2.3.4-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Python Maint - 2.3.4-7 +- Rebuilt for Python 3.13 + +* Tue Jan 23 2024 Fedora Release Engineering - 2.3.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 2.3.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jul 19 2023 Fedora Release Engineering - 2.3.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jun 28 2023 Scott Talbert - 2.3.4-3 +- BR python3-zombie-imp to fix FTBFS with Python 3.12 + +* Tue Jun 13 2023 Python Maint - 2.3.4-2 +- Rebuilt for Python 3.12 + +* Fri Feb 03 2023 Scott Talbert - 2.3.4-1 +- Update to new upstream release 2.3.4 (#2166724) + +* Fri Jan 27 2023 Scott Talbert - 2.3.3-3 +- Fix path traversal in PFS extractor script (#2165006) + +* Wed Jan 18 2023 Fedora Release Engineering - 2.3.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Tue Dec 27 2022 Scott Talbert - 2.3.3-1 +- Update to new upstream release 2.3.3 (#2003337 #2156566) + +* Wed Jul 20 2022 Fedora Release Engineering - 2.3.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 2.3.2-3 +- Rebuilt for Python 3.11 + +* Wed Jan 19 2022 Fedora Release Engineering - 2.3.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Aug 18 2021 Scott Talbert - 2.3.2-1 +- Update to new upstream release 2.3.2 (#1994176) + +* Wed Jul 21 2021 Fedora Release Engineering - 2.3.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 2.3.1-2 +- Rebuilt for Python 3.10 + +* Fri Mar 26 2021 Scott Talbert - 2.3.1-1 +- Update to new upstream release 2.3.1 (#1941447) + +* Tue Jan 26 2021 Fedora Release Engineering - 2.2.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 2.2.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 2.2.0-3 +- Rebuilt for Python 3.9 + +* Tue Jan 28 2020 Fedora Release Engineering - 2.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Oct 15 2019 Scott Talbert - 2.2.0-1 +- Update to new upstream release 2.2.0 (#1761636) + +* Thu Oct 03 2019 Miro Hrončok - 2.1.1-14 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 2.1.1-13 +- Rebuilt for Python 3.8 + +* Wed Jul 24 2019 Fedora Release Engineering - 2.1.1-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jan 31 2019 Fedora Release Engineering - 2.1.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jul 12 2018 Fedora Release Engineering - 2.1.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 2.1.1-9 +- Rebuilt for Python 3.7 + +* Wed Feb 07 2018 Fedora Release Engineering - 2.1.1-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Nov 13 2017 Scott Talbert - 2.1.1-7 +- Add p7zip-plugins as a dependency and change from Suggests to Recommends (#1511958) + +* Wed Jul 26 2017 Fedora Release Engineering - 2.1.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 2.1.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 2.1.1-4 +- Rebuild for Python 3.6 + +* Tue Jul 19 2016 Fedora Release Engineering - 2.1.1-3 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Wed Feb 03 2016 Fedora Release Engineering - 2.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sun Jan 03 2016 Scott Talbert - 2.1.1-1 +- New upstream release 2.1.1 +- Remove patches (all upstream/obsolete), switch to noarch, add suggests + +* Tue Nov 10 2015 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Mon Aug 24 2015 Scott Talbert - 2.0.0-6 +- Needed to specify python3 to configure + +* Mon Aug 24 2015 Scott Talbert - 2.0.0-5 +- Cherry-pick patch from upstream for python3 fix +- Add weak dependency on python3-pyqtgraph (#1248735) + +* Thu Jul 30 2015 Scott Talbert - 2.0.0-4 +- Switch to python3 + +* Wed Jun 17 2015 Fedora Release Engineering - 2.0.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Nov 1 2014 Ville Skyttä - 2.0.0-2 +- Fix *.so permissions for -debuginfo + +* Mon Sep 29 2014 Scott Talbert - 2.0.0-1 +- New upstream release 2.0.0 (#1085059, #1111576) + +* Sat Jun 07 2014 Fedora Release Engineering - 1.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sat Aug 03 2013 Fedora Release Engineering - 1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Mon Apr 8 2013 Tom Callaway 1.2-1 +- update to 1.2 + +* Wed Feb 13 2013 Fedora Release Engineering - 0.4.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + * Fri Oct 26 2012 Adam Jackson 0.4.5-1 - Initial packaging. diff --git a/requires-zombie-imp.patch b/requires-zombie-imp.patch new file mode 100644 index 0000000..1fe30a4 --- /dev/null +++ b/requires-zombie-imp.patch @@ -0,0 +1,11 @@ +diff -up binwalk-2.3.4/setup.py.imp binwalk-2.3.4/setup.py +--- binwalk-2.3.4/setup.py.imp 2023-02-02 20:28:44.655410043 -0500 ++++ binwalk-2.3.4/setup.py 2023-06-28 22:26:04.279845937 -0400 +@@ -336,6 +336,7 @@ setup( + author="Craig Heffner", + url="https://github.com/ReFirmLabs/%s" % MODULE_NAME, + requires=[], ++ install_requires=["zombie-imp;python_version>='3.12'"], + python_requires=">=3", + package_dir={"": "src"}, + packages=[MODULE_NAME], diff --git a/sources b/sources index 51a7c07..2a33f3a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -61aede5a7ab9bd54ebd93b7086f57bc0 binwalk-0.4.5.tar.gz +SHA512 (binwalk-2.3.4.tar.gz) = 5a5e16035dfc05b94ae4ee3969a337336c550606b71e20fcb1f150c4b38ef2084b6a823ce2a8050f4b41616b7d7c31cfb04bf43e7f2c977ab1a634aba9d67fec diff --git a/version-oops.patch b/version-oops.patch new file mode 100644 index 0000000..033f4fa --- /dev/null +++ b/version-oops.patch @@ -0,0 +1,12 @@ +diff -up binwalk-2.3.4/setup.py.oops binwalk-2.3.4/setup.py +--- binwalk-2.3.4/setup.py.oops 2023-02-01 11:15:53.000000000 -0500 ++++ binwalk-2.3.4/setup.py 2023-02-02 20:28:44.655410043 -0500 +@@ -12,7 +12,7 @@ except ImportError: + from distutils.dir_util import remove_tree + + MODULE_NAME = "binwalk" +-MODULE_VERSION = "2.3.3" ++MODULE_VERSION = "2.3.4" + SCRIPT_NAME = MODULE_NAME + MODULE_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) +