Code Monkey home page Code Monkey logo

Comments (10)

devttys0 avatar devttys0 commented on July 18, 2024

Sounds like your /usr/bin/binwalk script is v2.0, but the actual binwalk module is v1.x. What installation procedure did you use? If you did a git pull to update an older repository, try deleting the build directory and running setup.py again.

from binwalk.

bararchy avatar bararchy commented on July 18, 2024

What I did:

Step 1) git clone https://github.com/devttys0/binwalk.git
Step 2) ./configure
Step 3) make
Step 4) make install
Did I miss something ?

from binwalk.

bararchy avatar bararchy commented on July 18, 2024

Nm, got it to work using "python2 setup.py install", and then "ln -s /usr/local/lib/libinmagic.* /lib/" as it was searching the libs in the wrong place

from binwalk.

devttys0 avatar devttys0 commented on July 18, 2024

Glad you got it working, but the need to symlink to /lib is concerning; this shouldn't have been necessary as binwalk explicitly searches /usr/local/lib if any of the C libraries are not found in $PATH.

from binwalk.

bararchy avatar bararchy commented on July 18, 2024

body p { margin-bottom: 0cm; margin-top: 0pt; }
If you wish I can delete those at any time and
re-test when needed (on new version or patch).
On 04/30/2014 02:26 PM, devttys0 wrote:

  Glad you got it working, but the need to symlink to /lib is
    concerning; this shouldn't have been necessary as binwalk
    explicitly searches /usr/local/lib if any of the C libraries are
    not found in $PATH.
  —
    Reply to this email directly or view
      it on GitHub.

-- body p { margin-bottom: 0cm; margin-top: 0pt; } 


            Bar HofeshInformation



            Security Architect
          Cell: +972.5.25446813
          Support: (IL)1700700139, 927-9-8666110(ext 231)Haatzmaut



          40 St, first floor.
          Beer-Sheva 
          84150, Israel

from binwalk.

bararchy avatar bararchy commented on July 18, 2024

body p { margin-bottom: 0cm; margin-top: 0pt; }
If you wish I can delete those at any time and
re-test when needed (on new version or patch).
On 04/30/2014 02:26 PM, devttys0 wrote:

  Glad you got it working, but the need to symlink to /lib is
    concerning; this shouldn't have been necessary as binwalk
    explicitly searches /usr/local/lib if any of the C libraries are
    not found in $PATH.
  —
    Reply to this email directly or view
      it on GitHub.

-- body p { margin-bottom: 0cm; margin-top: 0pt; } 


            Bar HofeshInformation



            Security Architect

from binwalk.

devttys0 avatar devttys0 commented on July 18, 2024

Try running binwalk with python's -O option set:

 $ python -O $(which binwalk) /bin/ls

If you could run this with and without the symlinks in /lib, the debug output might give some insight into where the library load is failing.

from binwalk.

bararchy avatar bararchy commented on July 18, 2024

This is with them

python -O $(which binwalk) /bin/ls
DEBUG: Fuzzy Hash :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Heuristic Compression :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Binary Diffing :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Raw Compression :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Binary Visualization :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Signature Scan :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Found library: libcompress42.so
DEBUG: Found library: libtinfl.so
DEBUG: Entropy Analysis :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Fuzzy Hash :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Heuristic Compression :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Binary Diffing :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Raw Compression :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Binary Visualization :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Signature Scan :: ['/bin/ls', '--signature'] => {'enabled': True}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Found library: libcompress42.so
DEBUG: Found library: libtinfl.so
DEBUG: Found library: libinmagic.so.1
DEBUG: libmagic.magic_open(0x328000)
DEBUG: libmagic.magic_load(<class 'binwalk.core.magic.LP_magic_set'>, b'/tmp/tmp2s8iuz0v')
DEBUG: libmagic loaded OK!

DECIMAL       HEXADECIMAL     DESCRIPTION
------------------------------------------------------------------------------------------------------------------------------------------------------
0             0x0             ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV)
92704         0x16A20         Copyright string: " %s %d Free Software Foundation, Inc., Inc."
109016        0x1A9D8         LZMA compressed data, properties: 0x7E, dictionary size: 16777216 bytes, uncompressed size: 100663296 bytes
109208        0x1AA98         LZMA compressed data, properties: 0x8A, dictionary size: 16777216 bytes, uncompressed size: 100663296 bytes
109272        0x1AAD8         LZMA compressed data, properties: 0x90, dictionary size: 16777216 bytes, uncompressed size: 33554432 bytes
109592        0x1AC18         LZMA compressed data, properties: 0xC8, dictionary size: 16777216 bytes, uncompressed size: 50331648 bytes

DEBUG: Entropy Analysis :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}

This is without


python -O $(which binwalk) /bin/ls
DEBUG: Signature Scan :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Found library: libcompress42.so
DEBUG: Found library: libtinfl.so
DEBUG: Binary Diffing :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Heuristic Compression :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Fuzzy Hash :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Raw Compression :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Binary Visualization :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Entropy Analysis :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls'] => {'enabled': False}
DEBUG: General :: ['/bin/ls'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Signature Scan :: ['/bin/ls', '--signature'] => {'enabled': True}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Found library: libcompress42.so
DEBUG: Found library: libtinfl.so
DEBUG: Found library: libinmagic.so.1

Signature Exception: libinmagic.so.1: cannot open shared object file: No such file or directory
----------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/binwalk/core/module.py", line 475, in main
    self.init()
  File "/usr/lib/python3.4/site-packages/binwalk/modules/signature.py", line 85, in init
    self.magic = binwalk.core.magic.Magic(self.mfile)
  File "/usr/lib/python3.4/site-packages/binwalk/core/magic.py", line 41, in __init__
    self.libmagic = binwalk.core.C.Library("inmagic", self.LIBMAGIC_FUNCTIONS)
  File "/usr/lib/python3.4/site-packages/binwalk/core/C.py", line 99, in __init__
    self.library = ctypes.cdll.LoadLibrary(self.find_library(library))
  File "/usr/lib/python3.4/ctypes/__init__.py", line 429, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.4/ctypes/__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libinmagic.so.1: cannot open shared object file: No such file or directory
----------------------------------------------------------------------------------------------------

DEBUG: Binary Diffing :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Heuristic Compression :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Fuzzy Hash :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Raw Compression :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Binary Visualization :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Entropy Analysis :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}
DEBUG: Extraction :: ['/bin/ls', '--signature'] => {'enabled': False}
DEBUG: General :: ['/bin/ls', '--signature'] => {'files': ['/bin/ls'], 'enabled': False}

from binwalk.

devttys0 avatar devttys0 commented on July 18, 2024

Thanks! It appears that although ctypes.utils.find_library finds libinmagic.so in /usr/local/lib, the actual loading of the library (done by ctypes.cdll.LoadLibrary) isn't searchign the /usr/local/lib directory. Though I haven't encountered this myself, it seems there is a discrepancy between the search paths in these ctypes functions.

I just checked in a patch to master that explicitly checks standard install directories (e.g., /usr/local/lib) first, before querying ctypes.utils.find_library, which should fix this issue.

from binwalk.

bararchy avatar bararchy commented on July 18, 2024

Did a git pull, re configured and make , make install and can confirm issue solved !

Thanks !

from binwalk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.