Python gets the ssdeep value of the file _python

Source: Internet
Author: User

This article describes the Python access to file Ssdeep value of the method, shared for everyone to reference. The specific methods are as follows:

First of all, get the Ssdeep value, you need to import first Ssdeep
Installing Pyssdeep on Ubuntu has been a mistake. Later found Apt-cache search "Ssdeep" when a few full apt-get install, but the problem remains.
Later downloaded to Pyssdeep source files, tar zxvf pyssdeep.tar.zip then apt-get install Python-dev then python setup.py install installed.
Overall, it should be the reason for not pretending Python-dev.

The specific code is as follows:

  def _get_ssdeep (self, File_path): "" " 
    generates the Ssdeep fuzzy hash of the file. 
    @return: Ssdeep Fuzzy Hash of of the file 
    "" " 
    If not is_ssdeep: Return to 
      None 
 
    try: Return 
      ssdeep.ssdeep () . Hash_file (File_path) 
    except: Return 
      None 

I hope this article will help you with your Python programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.