-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathexample.py
More file actions
24 lines (18 loc) · 765 Bytes
/
example.py
File metadata and controls
24 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from ssftw import SSFTW
# Pass the ssdeep executable path to the class constructor.
ssdeep = SSFTW("C:\\ssdeep-2.13\\ssdeep.exe")
print "[+] Computing hashes from 2 files."
# Computing hash from files
hash1 = ssdeep.hash_from_file("C:\\Users\\user\\Desktop\\file1.exe")
hash2 = ssdeep.hash_from_file("C:\\Users\\user\\Desktop\\file2.exe")
print "Hash 1:%s\nHash 2:%s" % (hash1, hash2)
# Comparing two hashes
print "Ratio: %d" % ssdeep.compare(hash1, hash2)
print "--" * 30
print "[+] Computing hashes from 2 strings."
# Computing hash from files
hash1 = ssdeep.hash("Some long string, man.")
hash2 = ssdeep.hash("Similar long string, man!")
print "Hash 1:%s\nHash 2:%s" % (hash1, hash2)
# Comparing two hashes
print "Ratio: %d" % ssdeep.compare(hash1, hash2)