Python获取文件ssdeep值 Python获取文件ssdeep值的方法

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Python获取文件ssdeep值 Python获取文件ssdeep值的方法

  2021-03-19 我要评论
想了解Python获取文件ssdeep值的方法的相关内容吗,在本文为您仔细讲解Python获取文件ssdeep值的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Python,获取,文件,ssdeep值,下面大家一起来学习吧。

本文实例讲述了Python获取文件ssdeep值的方法,分享给大家供大家参考。具体方法如下:

首先,得到ssdeep值,需要先import ssdeep
在ubuntu上安装pyssdeep时 一直出错  后来发现apt-cache search "ssdeep"时把几个全apt-get install 上,但问题依旧。
后来下载到pyssdeep的源文件 ,tar zxvf pyssdeep.tar.zip 然后 apt-get install python-dev 然后 python setup.py install  就安装上了。
总体来看应该是没装python-dev的原因。

具体代码如下:

  def _get_ssdeep(self, file_path): 
    """ 
    Generates the ssdeep fuzzy hash of the file. 
    @return: ssdeep fuzzy hash of the file 
    """ 
    if not IS_SSDEEP: 
      return None 
 
    try: 
      return ssdeep.ssdeep().hash_file(file_path) 
    except: 
      return None 

希望本文所述对大家的Python程序设计有所帮助。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们