Created
September 5, 2016 10:48
-
-
Save CreateRemoteThread/ee2b4488f3dd254d470e66c73ba5e4f9 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/python | |
# shopping: | |
# laundry detergent | |
import string | |
import sys | |
key = [0] * 27 | |
data = "805eed80cbbccb94c36413275780ec94a857dfec8da8ca94a8c313a8ccf9" | |
data_split = [int(data[x:x+2],16) for x in range(0,len(data),2)] | |
print data_split | |
true_a = 0 | |
true_b = 0 | |
print " [!] brute forcing key..." | |
for a in range(0,255): | |
for b in range(0,255): | |
c1 = (a * ord('T') + b) % 251 | |
c2 = (a * ord('W') + b) % 251 | |
c3 = (a * ord('C') + b) % 251 | |
if c1 == 0x80 and c2 == 0x5e and c3 == 0xed: | |
print "a = %d, b = %d" % (a,b) | |
true_a = a | |
true_b = b | |
break | |
if true_a != 0 and true_b != 0: | |
break | |
print (true_a * ord('T') + true_b) % 251 | |
# sys.exit(0) | |
out = "" | |
print " [!] decoding ciphertext with keys %d, %d" % (true_a,true_b) | |
for x in range(0,len(data_split)): | |
for guess in string.printable: | |
if (true_a * ord(guess) + true_b) % 251 == data_split[x]: | |
# print " [+] OK: %c" % guess | |
out += guess | |
print out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment