Last active
March 10, 2017 22:16
-
-
Save Demonslay335/69cc1ad9bada6576cc7dfad9fcaf26c3 to your computer and use it in GitHub Desktop.
Checks for files encrypted by Spora
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Spora Encryption Checker | |
Author: @demonslay335 | |
""" | |
import sys | |
import zlib | |
import struct | |
import os | |
def bytestohex(bytes): | |
return struct.unpack("<L", bytes)[0] | |
def check_spora(filename): | |
fencrypted = open(filename,'rb') | |
content_encrypted = fencrypted.read() | |
aes_buffer = content_encrypted[-132:] | |
aes_buffer = aes_buffer[:128] | |
crc32_buffer = content_encrypted[-4:] | |
return zlib.crc32(aes_buffer) == bytestohex(crc32_buffer) | |
if len(sys.argv) == 2: | |
print("*Spora Encryption Checker*\n") | |
for subdir, dirs, files in os.walk(str(sys.argv[1])): | |
for file in files: | |
full_path = os.path.join(subdir, file) | |
if(check_spora(full_path)): | |
print ("[!] File encrypted: %s" % full_path.encode('utf-8')) | |
else: | |
print("Error: please provide a path\nSyntax: python %s <path>" % sys.argv[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment