Git Product home page Git Product logo

python-ssdeep's Introduction

ssdeep Python Wrapper

This is a straightforward Python wrapper for ssdeep by Jesse Kornblum, which is a library for computing context triggered piecewise hashes (CTPH). Also called fuzzy hashes, CTPH can match inputs that have homologies. Such inputs have sequences of identical bytes in the same order, although bytes in between these sequences may be different in both content and length.

Latest Version

License

Python Versions

Latest Docs

CodeQL tests

CI test status on Linux

CI test status on Debian

CI test status on Debian

How to use it

To compute a fuzzy hash, use hash function:

>>> import ssdeep
>>> hash1 = ssdeep.hash('Also called fuzzy hashes, Ctph can match inputs that have homologies.')
>>> hash1
'3:AXGBicFlgVNhBGcL6wCrFQEv:AXGHsNhxLsr2C'
>>> hash2 = ssdeep.hash('Also called fuzzy hashes, CTPH can match inputs that have homologies.')
>>> hash2
'3:AXGBicFlIHBGcL6wCrFQEv:AXGH6xLsr2C'

The compare function returns the match between 2 hashes, an integer value from 0 (no match) to 100.

>>> ssdeep.compare(hash1, hash2)
22

More examples are available in the python-ssdeep documentation.

Install

If all requirements are met it is possible to install the wrapper by using pip or easy_install.

$ pip install ssdeep

The build will fail if the ssdeep library isn't installed. To use the included version of the ssdeep library use the following command.

$ BUILD_LIB=1 pip install ssdeep

For more information have a look at the python-ssdeep documentation.

Tested on ...

  • CentOS 7
  • Debian 8, 9
  • Ubuntu 14.04, 16.04, 18.04

Documentation

Feel free to use the prebuild python-ssdeep documentation or use the steps below to build the documentation.

$ cd docs
$ pip install -r requirements.txt
$ make html

Licensing

The code is licensed under the terms of the LGPLv3+.

This wrapper includes the unchanged source distribution of ssdeep version 2.14.1. It is licensed under the GPLv2.

python-ssdeep's People

Contributors

alvin-huang avatar chazomaticus avatar denik avatar hnyuuu avatar pchaigno avatar phibos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-ssdeep's Issues

Missing docs at pypi

The file at pypi does not include the LICENSE, docs/ and tests/files/ files. However, building the sdist file of the package locally, does include those files.

Is there a reason for these differences?

SSDeep.compare not working

Hi there

Like the FAQ, I can't use ssdeep.compare() although ssdeep.hash_from_file() does work.

ssdeep.compare always returns -1.

Any ideas what could be wrong? I've installed cython, gcc, build essentials, and am running on python 2.7. I used pip to install ssdeep.

EDIT: I'm comparing hashes of files of approx 400 kB in size, so I don't think its because i'm comparing something too small.

pip install unsuccessfully

os win10
cmd: pip install ssdeep
result:
...... Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I tried in centos and got the same error. why? how to fix it?

Windows not use, why?

ISSUE TYPE
  • Bug Report
  • Feature Idea
  • Documentation Report
Python ssdeep VERSION

OS / ENVIRONMENT

OS:

  • Ubuntu 14.04
  • Ubuntu 16.04
  • Debian 8.0

Python version:

  • Python 2.7
  • Python 3.2
  • Python 3.3
  • Python 3.4
  • Python 3.5
  • Python 3.6

ssdeep lib:

  • builtin
  • provided by system
SUMMARY
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Error when trying to install on Windows

I'm trying to install python-ssdeep on Windows 7 32bit with MinGW.
I have Python 2.7 and MinGW 4.8 installed on a new VM.

When I run python setup.py build -c mingw32 I get the following error:

Traceback (most recent call last):
  File "setup.py", line 128, in <module>
    ext_package="ssdeep",
  File "c:\Python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "c:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "c:\Python27\lib\distutils\dist.py", line 971, in run_command
    cmd_obj.ensure_finalized()
  File "c:\Python27\lib\distutils\cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "setup.py", line 19, in finalize_options
    self.distribution.ext_modules = get_ext_modules()
  File "setup.py", line 67, in get_ext_modules
    binding.verify()
  File "c:\python-ssdeep\ssdeep\binding.py", line 125, in verify
    libraries=self._libraries,
  File "c:\Python27\lib\site-packages\cffi\api.py", line 340, in verify
    lib = self.verifier.load_library()
  File "c:\Python27\lib\site-packages\cffi\verifier.py", line 75, in load_library
    return self._load_library()
  File "c:\Python27\lib\site-packages\cffi\verifier.py", line 151, in _load_library
    return self._vengine.load_library()
  File "c:\Python27\lib\site-packages\cffi\vengine_cpy.py", line 149, in load_library
    raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing 'c:\\python-ssdeep\\ssdeep\\__pycache__\\_ssdeep_cffi_b2f2ace7x627c7d55.pyd': DLL load failed: The specified module could not be found.

I made sure the installation of ssdeep worked well manually (./configure, make and make install). It generated thee files: libfuzzy.a, libfuzzy.dll.a and libfuzzy.la.

Any idea on what the problem may be?

pytest-runner

pytest-runner is deprecated, please withdraw it from the requires. It is not necessary for testsuite run.

Release version 3.4.1 to pypi

ISSUE TYPE
  • Bug Report
Python ssdeep VERSION
3.4.1
OS / ENVIRONMENT
SUMMARY

Release Version 3.4.1 to pypi

EXPECTED RESULTS

It would be nice if ssdeep release version 3.4.1 would be available on pypi as well.

Expose name and block_size attributes in Hash class

ISSUE TYPE
  • Feature Idea
Python ssdeep VERSION
$ pip freeze | grep ssdeep
ssdeep==3.3
OS / ENVIRONMENT

OS:

  • OSX

Python version:

  • Python 2.7

ssdeep lib:

  • provided by system
$ brew info ssdeep | grep ssdeep
ssdeep: stable 2.14.1 (bottled)
https://ssdeep-project.github.io/ssdeep/
/usr/local/Cellar/ssdeep/2.14.1 (15 files, 144.9KB) *
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ssdeep.rb
SUMMARY

Would be nice if ssdeep Hash class exposed the meaningful attributes of the hashlib interface:

>>> dir(md5)
['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'block_size', 'copy', 'digest', 'digest_size', 'digestsize'
, 'hexdigest', 'name', 'update']

I think name and block_size would make sense?

STEPS TO REPRODUCE
>>> import ssdeep
>>> c = ssdeep.Hash()
>>> c.name
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    c.name
AttributeError: 'Hash' object has no attribute 'name'
>>> c.block_size
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    c.block_size
AttributeError: 'Hash' object has no attribute 'block_size'
EXPECTED RESULTS
>>> c = ssdeep.Hash()
>>> c.name
'ssdeep'
>>> c.block_size
8

安装报错

image
我尝试用pip3安装,但是报错,我也安装了dev setuptools等等,但是依然不行,我查找了好多方法,但是都不管用,希望您能帮忙解决,因为我很着急,谢谢。
我的windows和Ubuntu16 都不行

Hash class vs hash function

It's more a question than an issue:
After looking at the documentation and the code of Hash, PseudoHash and hash function, I wanted to know if there is a difference between using Hash class and the hash function given I have ssdeep version 2.10 or above.
PseudoHash has a warning about big files, and it uses the hash function as its implementation, so I wonder if this warning applies to the hash function as well.

ssdeep failing to find homologues in BYTE data

ISSUE TYPE
  • Bug Report
Python ssdeep VERSION
ssdeep                       3.4
OS / ENVIRONMENT

OS:

  • Ubuntu 16.04

Python version:

  • Python 3.6

ssdeep lib:

SUMMARY

Attempting to compare two small BYTE strings which differ by a single BYTE. ssdeep.compare reports a comparison of 0.

STEPS TO REPRODUCE

b1 = b"'\xbd\xff\xd8\xaf\xbf\x00$\xaf\xb0\x00 <\x02D\x93"
b2 = b"'\xbd\xff\xd8\xaf\xbf\x00$\xaf\xb0\x00 <\x02Dk"
_h = ssdeep.Hash()
_h.update(b1)
_r1 = _h.digest()
_h.update(b2)
_r2 = _h.digest()
ssdeep.compare(_r1,_r2)
0

EXPECTED RESULTS

Seeing as how the inputs differ by only a single BYTE, Expected return value from ssdeep.compare() should be non-zero

ACTUAL RESULTS

-->

ssdeep.compare(_r1,_r2)
0

Automated workflow to release pre-compiled binary wheels?

I noticed that currently the ssdeep package only provides a source package on PyPI, which makes it harder to depend on the ssdeep package (can't just list ssdeep in pyproject dependencies, need to have user manually install libfuzzy or set an environment variable to build from source -- which is also requires having a suitable compiler installed).

Would there be interest in a PR that uses cibuildwheel to automate building ssdeep binary wheels across a variety of architectures? This would be similar to the work done for https://github.com/ssciwr/clang-format-wheel, https://github.com/nightlark/swig-pypi/, and https://github.com/scikit-build/cmake-python-distributions/, which provide pre-compiled binary wheels for all major platforms on PyPI (https://pypi.org/project/swig/, https://pypi.org/project/cmake/, https://pypi.org/project/clang-format).

@phibos I also noticed it has been a while since any code updates were made (though ssdeep itself also appears to be mostly frozen), and the last comment by a python-ssdeep maintainer on a GitHub issue appears to be around 2022 -- if you need help with maintenance, I'm open to helping with some of the open GitHub issues and getting an update released on PyPI.

please tag a release

Please tag a release to help six removal from distributions.

Greetings

OS:

  • Debian Trixie

Failed to install python-ssdeep on Ubuntu 18 (Python 3.6)

ISSUE TYPE
  • Bug Report
Python ssdeep VERSION
3.3
OS / ENVIRONMENT

OS:

  • Ubuntu 18.04

Python version:

  • Python 3.6

ssdeep lib:

  • provided by system 2.14-1
SUMMARY
sudo BUILD_LIB=1 pip3 install ssdeep

failed to complete successfully


STEPS TO REPRODUCE

Run

sudo BUILD_LIB=1 pip3 install ssdeep
EXPECTED RESULTS

The command should complete successfully, the library should be installed

ACTUAL RESULTS

Error output

Collecting ssdeep
  Using cached https://files.pythonhosted.org/packages/96/54/15b2e0b6e5042b67eb648e3d0e5d10105e6797353fe0a63579b74bf5eeee/ssdeep-3.3.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/ssdeep.egg-info
    writing pip-egg-info/ssdeep.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/ssdeep.egg-info/dependency_links.txt
    writing requirements to pip-egg-info/ssdeep.egg-info/requires.txt
    writing top-level names to pip-egg-info/ssdeep.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/ssdeep.egg-info/SOURCES.txt'
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether gcc understands -c and -o together... yes
    checking for style of include used by make... GNU
    checking dependency style of gcc... gcc3
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking dependency style of g++... gcc3
    checking how to print strings... printf
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for fgrep... /bin/grep -F
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /usr/bin/ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... dlltool
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /bin/dd
    checking how to truncate binary pipes... /bin/dd bs=4096 count=1
    checking for mt... mt
    checking if mt is a manifest tool... no
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking how to run the C++ preprocessor... g++ -E
    checking for ld used by g++... /usr/bin/ld -m elf_x86_64
    checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking for g++ option to produce PIC... -fPIC -DPIC
    checking if g++ PIC flag -fPIC -DPIC works... yes
    checking if g++ static flag -static works... yes
    checking if g++ supports -c -o file.o... yes
    checking if g++ supports -c -o file.o... (cached) yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking dynamic linker characteristics... (cached) GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking for /usr/local/include... yes
    checking for /usr/local/lib... yes
    checking for /opt/local/include... no
    checking for /opt/local/lib... no
    checking for /sw/include... no
    checking for /sw/lib... no
    checking whether byte ordering is bigendian... no
    checking for special C compiler options needed for large files... no
    checking for _FILE_OFFSET_BITS value needed for large files... no
    checking libgen.h usability... yes
    checking libgen.h presence... yes
    checking for libgen.h... yes
    checking dirent.h usability... yes
    checking dirent.h presence... yes
    checking for dirent.h... yes
    checking for inttypes.h... (cached) yes
    checking fcntl.h usability... yes
    checking fcntl.h presence... yes
    checking for fcntl.h... yes
    checking for sys/types.h... (cached) yes
    checking sys/ioctl.h usability... yes
    checking sys/ioctl.h presence... yes
    checking for sys/ioctl.h... yes
    checking sys/param.h usability... yes
    checking sys/param.h presence... yes
    checking for sys/param.h... yes
    checking wchar.h usability... yes
    checking wchar.h presence... yes
    checking for wchar.h... yes
    checking for unistd.h... (cached) yes
    checking for sys/stat.h... (cached) yes
    checking sys/disk.h usability... no
    checking sys/disk.h presence... no
    checking for sys/disk.h... no
    checking for inttypes.h... (cached) yes
    checking for sys/mount.h... yes
    checking for _LARGEFILE_SOURCE value needed for large files... no
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    config.status: executing libtool commands
    CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib/missing aclocal-1.15 -I m4
     cd . && /bin/bash /tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib/missing automake-1.15 --gnu
    CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib/missing autoconf
    /bin/bash ./config.status --recheck
    running CONFIG_SHELL=/bin/bash /bin/bash configure --no-create --no-recursion
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether gcc understands -c and -o together... yes
    checking for style of include used by make... GNU
    checking dependency style of gcc... gcc3
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking dependency style of g++... gcc3
    checking how to print strings... printf
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for fgrep... /bin/grep -F
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /usr/bin/ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... dlltool
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /bin/dd
    checking how to truncate binary pipes... /bin/dd bs=4096 count=1
    checking for mt... mt
    checking if mt is a manifest tool... no
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking how to run the C++ preprocessor... g++ -E
    checking for ld used by g++... /usr/bin/ld -m elf_x86_64
    checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking for g++ option to produce PIC... -fPIC -DPIC
    checking if g++ PIC flag -fPIC -DPIC works... yes
    checking if g++ static flag -static works... yes
    checking if g++ supports -c -o file.o... yes
    checking if g++ supports -c -o file.o... (cached) yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking dynamic linker characteristics... (cached) GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking for /usr/local/include... yes
    checking for /usr/local/lib... yes
    checking for /opt/local/include... no
    checking for /opt/local/lib... no
    checking for /sw/include... no
    checking for /sw/lib... no
    checking whether byte ordering is bigendian... no
    checking for special C compiler options needed for large files... no
    checking for _FILE_OFFSET_BITS value needed for large files... no
    checking libgen.h usability... yes
    checking libgen.h presence... yes
    checking for libgen.h... yes
    checking dirent.h usability... yes
    checking dirent.h presence... yes
    checking for dirent.h... yes
    checking for inttypes.h... (cached) yes
    checking fcntl.h usability... yes
    checking fcntl.h presence... yes
    checking for fcntl.h... yes
    checking for sys/types.h... (cached) yes
    checking sys/ioctl.h usability... yes
    checking sys/ioctl.h presence... yes
    checking for sys/ioctl.h... yes
    checking sys/param.h usability... yes
    checking sys/param.h presence... yes
    checking for sys/param.h... yes
    checking wchar.h usability... yes
    checking wchar.h presence... yes
    checking for wchar.h... yes
    checking for unistd.h... (cached) yes
    checking for sys/stat.h... (cached) yes
    checking sys/disk.h usability... no
    checking sys/disk.h presence... no
    checking for sys/disk.h... no
    checking for inttypes.h... (cached) yes
    checking for sys/mount.h... yes
    checking for _LARGEFILE_SOURCE value needed for large files... no
    checking that generated files are newer than configure... done
    configure: creating ./config.status
     /bin/bash ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    config.status: executing libtool commands
    (CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib/missing autoheader)
    rm -f stamp-h1
    touch config.h.in
    cd . && /bin/bash ./config.status config.h
    config.status: creating config.h
    config.status: config.h is unchanged
    make  all-am
    make[1]: Entering directory '/tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib'
    /bin/bash ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.   -I/usr/local/include   -g -O2 -MT fuzzy.lo -MD -MP -MF .deps/fuzzy.Tpo -c -o fuzzy.lo fuzzy.c
    libtool: Version mismatch error.  This is libtool 2.4.6.40-6ca5-dirty, but the
    libtool: definition of this LT_INIT comes from libtool 2.4.6.
    libtool: You should recreate aclocal.m4 with macros from libtool 2.4.6.40-6ca5-dirty
    libtool: and run autoconf again.
    Makefile:576: recipe for target 'fuzzy.lo' failed
    make[1]: *** [fuzzy.lo] Error 63
    make[1]: Leaving directory '/tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib'
    Makefile:399: recipe for target 'all' failed
    make: *** [all] Error 2
    libtoolize:   error: './ltmain.sh' is newer: use '--force' to overwrite
    libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
    libtoolize: linking file 'm4/libtool.m4'
    libtoolize: linking file 'm4/ltoptions.m4'
    libtoolize: linking file 'm4/ltsugar.m4'
    libtoolize: linking file 'm4/ltversion.m4'
    libtoolize: linking file 'm4/lt~obsolete.m4'
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether gcc understands -c and -o together... yes
    checking for style of include used by make... GNU
    checking dependency style of gcc... gcc3
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking dependency style of g++... gcc3
    checking how to print strings... printf
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for fgrep... /bin/grep -F
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /usr/bin/ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... dlltool
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /bin/dd
    checking how to truncate binary pipes... /bin/dd bs=4096 count=1
    checking for mt... mt
    checking if mt is a manifest tool... no
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking how to run the C++ preprocessor... g++ -E
    checking for ld used by g++... /usr/bin/ld -m elf_x86_64
    checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking for g++ option to produce PIC... -fPIC -DPIC
    checking if g++ PIC flag -fPIC -DPIC works... yes
    checking if g++ static flag -static works... yes
    checking if g++ supports -c -o file.o... yes
    checking if g++ supports -c -o file.o... (cached) yes
    checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking dynamic linker characteristics... (cached) GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking for /usr/local/include... yes
    checking for /usr/local/lib... yes
    checking for /opt/local/include... no
    checking for /opt/local/lib... no
    checking for /sw/include... no
    checking for /sw/lib... no
    checking whether byte ordering is bigendian... no
    checking for special C compiler options needed for large files... no
    checking for _FILE_OFFSET_BITS value needed for large files... no
    checking libgen.h usability... yes
    checking libgen.h presence... yes
    checking for libgen.h... yes
    checking dirent.h usability... yes
    checking dirent.h presence... yes
    checking for dirent.h... yes
    checking for inttypes.h... (cached) yes
    checking fcntl.h usability... yes
    checking fcntl.h presence... yes
    checking for fcntl.h... yes
    checking for sys/types.h... (cached) yes
    checking sys/ioctl.h usability... yes
    checking sys/ioctl.h presence... yes
    checking for sys/ioctl.h... yes
    checking sys/param.h usability... yes
    checking sys/param.h presence... yes
    checking for sys/param.h... yes
    checking wchar.h usability... yes
    checking wchar.h presence... yes
    checking for wchar.h... yes
    checking for unistd.h... (cached) yes
    checking for sys/stat.h... (cached) yes
    checking sys/disk.h usability... no
    checking sys/disk.h presence... no
    checking for sys/disk.h... no
    checking for inttypes.h... (cached) yes
    checking for sys/mount.h... yes
    checking for _LARGEFILE_SOURCE value needed for large files... no
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    config.status: executing libtool commands
    make  all-am
    make[1]: Entering directory '/tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib'
    /bin/bash ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.   -I/usr/local/include   -g -O2 -MT fuzzy.lo -MD -MP -MF .deps/fuzzy.Tpo -c -o fuzzy.lo fuzzy.c
    libtool: Version mismatch error.  This is libtool 2.4.6.40-6ca5-dirty, but the
    libtool: definition of this LT_INIT comes from libtool 2.4.6.
    libtool: You should recreate aclocal.m4 with macros from libtool 2.4.6.40-6ca5-dirty
    libtool: and run autoconf again.
    Makefile:579: recipe for target 'fuzzy.lo' failed
    make[1]: *** [fuzzy.lo] Error 63
    make[1]: Leaving directory '/tmp/pip-build-k9gefy3k/ssdeep/src/ssdeep-lib'
    Makefile:402: recipe for target 'all' failed
    make: *** [all] Error 2
    Failed while building ssdeep lib.
    Failed while building ssdeep lib with configure and make.
    Retry with autoreconf ...

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-k9gefy3k/ssdeep/

Error running python setup.py test

Running the command python setup.py test shows an error message that it is unable to find the test files. We should use the pytest-runner to execute the tests.

unable to use python-ssdeep with redhat 6.1

Hello,

after command : $ python setup.py install

$ cat test.py
#!/usr/bin/python
import ssdeep
ssdeep.hash('test')

$ python test.py
Traceback (most recent call last):
File "tet.py", line 4, in
ssdeep.hash('test')
File "ssdeep.pyx", line 59, in ssdeep.hash (ssdeep.c:938)
if sys.version_info.major == 3:
AttributeError: 'tuple' object has no attribute 'major'

Multithread error

ISSUE TYPE
  • Bug Report
Python ssdeep VERSION
ssdeep 3.4
OS / ENVIRONMENT

OS:

  • Ubuntu 20.04 LTS

Python version:

  • Python 3.8.5

ssdeep lib:

  • I did not understand what the requested information was, I installed ssdeep using pip3 install
SUMMARY

When using ssdeep with threading, I get an error UserWarning: reimporting '_ssdeep_cffi_a28e5628x27adcb8d' might overwrite older definitions

STEPS TO REPRODUCE
  • Example 1
import ssdeep, threading

hash1 = '123:123123123:123123123'
hash2 = '123:456456456:456456456'

def my_thread_1():
    for i in range(1000):
        ssdeep.compare(hash1, hash2)

t1 = threading.Thread(target=my_thread_1)
t2 = threading.Thread(target=my_thread_1)

t1.start()
t2.start()

t1.join()
t2.join()

print('done example 1')
  • Example 2
import ssdeep, threading

text = 'blabla'
 
def my_thread_2():
    for i in range(1000):
        ssdeep.hash(text)

t1 = threading.Thread(target=my_thread_2)
t2 = threading.Thread(target=my_thread_2)

t1.start()
t2.start()

t1.join()
t2.join()

print('done example 2')
EXPECTED RESULTS

Code should run without errors

ACTUAL RESULTS
Warning (from warnings module):
  File "/home/user/.local/lib/python3.8/site-packages/cffi/vengine_cpy.py", line 191
    warnings.warn("reimporting %r might overwrite older definitions"
UserWarning: reimporting '_ssdeep_cffi_a28e5628x27adcb8d' might overwrite older definitions

Same issue with python 2.7.18:

/usr/local/lib/python2.7/dist-packages/cffi/vengine_cpy.py:192: 
UserWarning: reimporting '_ssdeep_cffi_a28e5628x27adcb8d' might overwrite older definitions  % (self.verifier.get_module_name()))

Small error in setup.py

Hi there, I'm trying to build this (both from pip and from github), and I keep getting a traceback with an AttributeError. This is because the sys.version_info is a tuple (on 2.x), and has no .major attribute.

If you change it to sys.version_info[0], you get the same check on both 2.x and 3.x, without having it fail on 2.x.

I'll submit a pull request if you want, but for a commit this small, I don't know if that's necessary!

Thanks,
Fitblip

pip install ssdeep returns error

ISSUE TYPE

Bug Report

Python ssdeep VERSION

latest version

OS / ENVIRONMENT

OS:
Windows 10

Python version:
Python 3.10.11

SUMMARY

Cannot install the ssdeep library with or without the Virtual env.

STEPS TO REPRODUCE

pip install ssdeep

EXPECTED RESULTS

Successful installation and no error on using "import ssdeep"

ACTUAL RESULTS
Collecting ssdeep
  Using cached ssdeep-3.4.tar.gz (110 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  python setup.py egg_info did not run successfully.
  exit code: 1
.
.
.
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

**note: This is an issue with the package mentioned above, not pip.**

setuptools/wheel.py: FileExistsError: [Errno 17] File exists: '/private/var/folders/.../.eggs/cffi.egg'

ISSUE TYPE
  • Bug Report
OS / ENVIRONMENT

OS:

  • macOS Monterey 12.3.1

Python version:

  • Python 3.8

ssdeep lib:

% brew install ssdeep
SUMMARY
% pip install ssdeep

Collecting ssdeep
  Using cached ssdeep-3.4.tar.gz (110 kB)
  Preparing metadata (setup.py) ... done
Collecting cffi>=0.8.6
  Using cached cffi-1.15.1-cp38-cp38-macosx_10_9_x86_64.whl (178 kB)
Collecting six>=1.4.1
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: ssdeep
  Building wheel for ssdeep (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/lx/hlw2jxk93gn8vkjr3rkczpl80000gn/T/pip-install-gym6_b8v/ssdeep_7f62328501924feca4821cf3893fbfe3/setup.py", line 108, in <module>
          setup(
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 164, in setup
          _install_setup_requires(attrs)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 159, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/dist.py", line 699, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 779, in resolve
          dist = best[req.key] = env.best_match(
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1064, in best_match
          return self.obtain(req, installer)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1076, in obtain
          return installer(requirement)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/dist.py", line 758, in fetch_build_egg
          return fetch_build_egg(self, req)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/installer.py", line 133, in fetch_build_egg
          wheel.install_as_egg(dist_location)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/wheel.py", line 99, in install_as_egg
          self._install_as_egg(destination_eggdir, zf)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/wheel.py", line 107, in _install_as_egg
          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/wheel.py", line 128, in _convert_metadata
          os.mkdir(destination_eggdir)
      FileExistsError: [Errno 17] File exists: '/private/var/folders/lx/hlw2jxk93gn8vkjr3rkczpl80000gn/T/pip-install-gym6_b8v/ssdeep_7f62328501924feca4821cf3893fbfe3/.eggs/cffi-1.15.1-py3.8-macosx-10.14-x86_64.egg'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ssdeep

Add type stubs

It would be nice to have type stubs shipped with the ssdeep Python package to enable static type checking with mypy.

Is this something you are interested in? If so I would be willing to prepare a PR for this.

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.