def get_ssdeep(file_name): try: from ssdeep import ssdeep ss = ssdeep() return ss.hash_file(file_name) except ImportError: try: import ssdeep return ssdeep.hash_from_file(file_name) except ImportError: print 'error: no library `ssdeep` available for import! this feature will not be available.' return None
def get_ssdeep(self): # try to return the ssdeep hash of file try: from ssdeep import ssdeep ss = ssdeep() return ss.hash_file(self.file_name) except ImportError: try: import ssdeep return ssdeep.hash_from_file(self.file_name) except ImportError: print('[error] no library `ssdeep` available for import! this feature will not be available.')
def get_ssdeep(filename): """There are two Python bindings for ssdeep, each with a different interface. So we try Jose's pyssdeep first and if it fails, try the one from pypi. Just install one or the other: http://code.google.com/p/pyssdeep/ http://pypi.python.org/packages/source/s/ssdeep/ssdeep-2.5.tar.gz#md5=fd9e5271c01ca389cc621ae306327ab6 """ try: from ssdeep import ssdeep s = ssdeep() return s.hash_file(filename) except: try: import ssdeep return ssdeep.hash_from_file(filename) except: pass
def get_ssdeep(filename): """There are two Python bindings for ssdeep, each with a different interface. So we try Jose's pyssdeep first and if it fails, try the one from pypi. Just install one or the other: http://code.google.com/p/pyssdeep/ http://pypi.python.org/packages/source/s/ssdeep/ssdeep-2.5.tar.gz#md5=fd9e5271c01ca389cc621ae306327ab6 """ try: from ssdeep import ssdeep s = ssdeep() return s.hash_file(filename) except: try: import ssdeep return ssdeep.hash_from_file(filename) except: pass return ''