Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAIL: Test: Open firmware.zip, scan for signatures #630

Open
vt-alt opened this issue Feb 25, 2023 · 2 comments
Open

FAIL: Test: Open firmware.zip, scan for signatures #630

vt-alt opened this issue Feb 25, 2023 · 2 comments

Comments

@vt-alt
Copy link

vt-alt commented Feb 25, 2023

Tests failure on 2.3.4 release:

builder@x86_64:~/RPM/BUILD/binwalk-2.3.4$ export PYTHON=$(which python3)
builder@x86_64:~/RPM/BUILD/binwalk-2.3.4$ export PYTHONPATH=$PWD/src
builder@x86_64:~/RPM/BUILD/binwalk-2.3.4$ python3 setup.py test
running test
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module

WARNING: Symlink points outside of the extraction directory: /usr/src/RPM/BUILD/binwalk-2.3.4/testing/tests/input-vectors/_dirtraversal.tar.extracted/foo -> /usr/src/RPM/BUILD/binwalk-2.3.4/testing/tests; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /usr/src/RPM/BUILD/binwalk-2.3.4/testing/tests/input-vectors/_dirtraversal.tar.extracted/bar -> /etc/passwd; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /usr/src/RPM/BUILD/binwalk-2.3.4/testing/tests/input-vectors/_dirtraversal.tar.extracted/subdir/foo2 -> /usr/src/RPM/BUILD/binwalk-2.3.4/testing; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /usr/src/RPM/BUILD/binwalk-2.3.4/testing/tests/input-vectors/_dirtraversal.tar.extracted/subdir/bar2 -> /etc/shadow; changing link target to /dev/null for security purposes.
.....F.
======================================================================
FAIL: Test: Open firmware.zip, scan for signatures
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/src/RPM/BUILD/binwalk-2.3.4/testing/tests/test_firmware_zip.py", line 29, in test_firmware_zip
    eq_(len(scan_result[0].results), len(expected_results))
AssertionError: 4 != 2

----------------------------------------------------------------------
Ran 7 tests in 11.926s

FAILED (failures=1)

removing '/usr/src/RPM/BUILD/binwalk-2.3.4/testing/tests/input-vectors/_dirtraversal.tar.extracted' (and everything under it)
@vt-alt
Copy link
Author

vt-alt commented Feb 25, 2023

BTW, (not that I want to run it for tests, but) docker build . also fails with:

$ docker build .
Sending build context to Docker daemon  49.89MB
Step 1/13 : FROM python:3-buster AS build-and-install
 ---> fd893241a571
Step 2/13 : ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/src/app/bin     DEBIAN_FRONTEND=noninteractive
 ---> Using cache
 ---> 218f41f25583
Step 3/13 : COPY . /tmp
 ---> Using cache
 ---> ea4217569909
Step 4/13 : WORKDIR /tmp
 ---> Using cache
 ---> bfbbcb5718cb
Step 5/13 : RUN set -xue     && apt-get update -qy     && apt-get -t buster dist-upgrade -yq --no-install-recommends -o Dpkg::Options::="--force-confold"     && ./deps.sh --yes     && python3 setup.py install && binwalk -h > /dev/null     && apt-get -yq purge *-dev git build-essential gcc g++     && apt-get -y autoremove     && apt-get -y autoclean     && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen     && echo "LANG=en_US.UTF-8" >> /etc/default/locale     && echo "LANGUAGE=en_US:en" >> /etc/default/locale     && echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale     && locale-gen
 ---> Using cache
 ---> 677e12c0212d
Step 6/13 : FROM build-and-install AS unit-tests
 ---> 677e12c0212d
Step 7/13 : RUN pip install coverage nose     && python3 setup.py test     && dd if=/dev/urandom of=/tmp/random.bin bs=1M count=1 && binwalk -J -E /tmp/random.bin
 ---> Running in 395f3c50bc8a
Collecting coverage
  Downloading coverage-7.2.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (231 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 231.2/231.2 kB 2.3 MB/s eta 0:00:00
Collecting nose
  Downloading nose-1.3.7-py3-none-any.whl (154 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 154.7/154.7 kB 12.9 MB/s eta 0:00:00
Installing collected packages: nose, coverage
Successfully installed coverage-7.2.0 nose-1.3.7
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
running test
Traceback (most recent call last):
  File "/tmp/setup.py", line 330, in <module>
    setup(
  File "/usr/local/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/usr/local/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/tmp/setup.py", line 302, in run
    retval = nose.core.run(argv=['--exe','--with-coverage'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nose/core.py", line 301, in run
    return TestProgram(*arg, **kw).success
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nose/core.py", line 118, in __init__
    unittest.TestProgram.__init__(
  File "/usr/local/lib/python3.11/unittest/main.py", line 101, in __init__
    self.parseArgs(argv)
  File "/usr/local/lib/python3.11/site-packages/nose/core.py", line 179, in parseArgs
    self.createTests()
  File "/usr/local/lib/python3.11/site-packages/nose/core.py", line 193, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nose/loader.py", line 481, in loadTestsFromNames
    return unittest.TestLoader.loadTestsFromNames(self, names, module)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nose/loader.py", line 454, in loadTestsFromName
    return LazySuite(
           ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nose/suite.py", line 53, in __init__
    super(LazySuite, self).__init__()
  File "/usr/local/lib/python3.11/unittest/suite.py", line 22, in __init__
    self._tests = []
    ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nose/suite.py", line 106, in _set_tests
    if isinstance(tests, collections.Callable) and not is_suite:
                         ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'
The command '/bin/sh -c pip install coverage nose     && python3 setup.py test     && dd if=/dev/urandom of=/tmp/random.bin bs=1M count=1 && binwalk -J -E /tmp/random.bin' returned a non-zero code: 1

This fails on:

cddfede 2023-02-01 Merge pull request #617 from QKaiser/fix-pfs-path-traversal (devttys0) (HEAD -> master, tag: v2.3.4, origin/master)

@vt-alt
Copy link
Author

vt-alt commented Feb 25, 2023

I found this patch from Fedora that fixes Open firmware.zip, scan for signatures failure: https://src.fedoraproject.org/rpms/binwalk/raw/rawhide/f/binwalk-2.3.3-tests.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant