-
-
Save BZHugs/d16568f5981ec0a037e52c1661be3a32 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python2.7 | |
from Crypto.Cipher import AES | |
import hashlib, os, getpass, requests | |
import glob | |
def xorbytes(a, b): | |
assert len(a) == len(b) | |
res = '' | |
for c, d in zip(a, b): | |
res += chr(ord(c) ^ ord(d)) | |
return res | |
TARGET = ['Scott Farquhar', 'Lei Jun', 'Reid Hoffman', 'Zhou Qunfei', 'Jeff Bezos', 'Shiv Nadar', 'Simon Xie', 'Ma Huateng', 'Ralph Dommermuth', 'Barry Lam', 'Nathan Blecharczyk', 'Judy Faulkner', 'William Ding', 'Scott Cook', 'Gordon Moore', 'Marc Benioff', 'Michael Dell', 'Yusaku Maezawa', 'Yuri Milner', 'Bobby Murphy', 'Larry Page', 'Henry Samueli', 'Jack Ma', 'Jen-Hsun Huang', 'Jay Y. Lee', 'Joseph Tsai', 'Dietmar Hopp', 'Henry Nicholas, III.', 'Dustin Moskovitz', 'Mike Cannon-Brookes', 'Robert Miller', 'Bill Gates', 'Garrett Camp', 'Lin Xiucheng', 'Gil Shwed', 'Sergey Brin', 'Rishi Shah', 'Denise Coates', 'Zhang Fan', 'Michael Moritz', 'Robin Li', 'Andreas von Bechtolsheim', 'Brian Acton', 'Sean Parker', 'John Doerr', 'David Cheriton', 'Brian Chesky', 'Wang Laisheng', 'Jan Koum', 'Jack Sheerack', 'Terry Gou', 'Adam Neumann', 'James Goodnight', 'Larry Ellison', 'Wang Laichun', 'Masayoshi Son', 'Min Kao', 'Hiroshi Mikitani', 'Lee Kun-Hee', 'David Sun', 'Mark Scheinberg', 'Yeung Kin-man', 'John Tu', 'Teddy Sagi', 'Frank Wang', 'Robert Pera', 'Eric Schmidt', 'Wang Xing', 'Evan Spiegel', 'Travis Kalanick', 'Steve Ballmer', 'Mark Zuckerberg', 'Jason Chang', 'Lam Wai Ying', 'Romesh T. Wadhwani', 'Liu Qiangdong', 'Jim Breyer', 'Zhang Zhidong', 'Pierre Omidyar', 'Elon Musk', 'David Filo', 'Joe Gebbia', 'Jiang Bin', 'Pan Zhengmin', 'Douglas Leone', 'Hasso Plattner', 'Paul Allen', 'Meg Whitman', 'Azim Premji', 'Fu Liquan', 'Jeff Rothschild', 'John Sall', 'Kim Jung-Ju', 'David Duffield', 'Gabe Newell', 'Scott Lin', 'Eduardo Saverin', 'Jeffrey Skoll', 'Thomas Siebel', 'Kwon Hyuk-Bin'] | |
print "[*] Search key" | |
file0 = open("vacation pictures/DCIM-0533.jpg.hacked").read() | |
last_bloc = file0[-16:] | |
IV = file0[-32:-16] | |
username = "" | |
for prob in TARGET: | |
hsh = hashlib.new('md5') | |
hsh.update(prob) | |
key = hsh.digest() | |
cip = AES.new(key, 1) | |
plain = xorbytes(cip.decrypt(last_bloc), IV) | |
if "\xff\xd9\x00" in plain or "\xd9\x00\x00" in plain: #EOF of a JPG file | |
username = prob | |
break | |
assert(username != "") | |
print "[*] Key found !!\nkey = '"+username+"'" | |
known_plain_text = "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x01" #Header of a JPEG file | |
n = 16 | |
for path in glob.glob('vacation pictures/*.jpg.hacked'): | |
enc = open(path).read() | |
blocks = [enc[i:i+n] for i in range(0, len(enc), n)] | |
N = len(blocks) | |
plain = [None]*N | |
for i in range(N): | |
block = blocks[N-i-1] | |
dec_xored = cip.decrypt(block) | |
if N-i-1 > 0: | |
iv = blocks[N-i-2] | |
dec = xorbytes(dec_xored, iv) | |
else: | |
dec = dec_xored | |
plain[N-i-1] = dec | |
plain[0] = known_plain_text | |
plain_raw = "".join(plain) | |
f = open(path.replace('.hacked', ''), 'wb').write(plain_raw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment