Created
April 2, 2016 23:34
-
-
Save CreateRemoteThread/1230d6298a140599ad612abe6863f6cc 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 | |
import sys | |
def gates_out(in_str): | |
if len(in_str) != 8: | |
print "fuck" | |
sys.exit(0) | |
in_bin = [False,False,False,False,False,False,False,False] | |
for i in range(0,len(in_str)): | |
in_bin[i] = in_str[i] == '1' | |
GATE_1_0 = not in_bin[2] | |
GATE_1_1 = not in_bin[3] | |
GATE_1_2 = not in_bin[4] | |
GATE_1_3 = not in_bin[1] | |
GATE_1_4 = not in_bin[5] | |
GATE_1_5 = not in_bin[7] | |
GATE_2_0 = GATE_1_0 and in_bin[0] | |
GATE_2_1 = GATE_1_0 and GATE_1_3 | |
GATE_2_2 = in_bin[0] and in_bin[1] | |
GATE_2_3 = in_bin[5] ^ in_bin[6] | |
GATE_2_4 = GATE_1_3 ^ GATE_1_5 | |
GATE_3_0 = GATE_2_0 and GATE_1_1 | |
GATE_3_1 = GATE_1_1 and GATE_2_1 | |
GATE_3_2 = GATE_2_2 and GATE_1_1 | |
GATE_3_3 = GATE_1_4 and in_bin[2] | |
GATE_3_4 = in_bin[2] and GATE_2_4 | |
GATE_4_0 = GATE_3_0 and GATE_1_2 | |
GATE_4_1 = GATE_1_2 and GATE_3_1 | |
GATE_4_2 = GATE_1_2 and GATE_3_2 | |
GATE_4_3 = GATE_3_3 and GATE_2_3 | |
GATE_5_0 = GATE_4_0 or GATE_4_1 | |
GATE_5_1 = GATE_4_2 or GATE_4_3 | |
GATE_6_0 = GATE_3_4 or GATE_5_1 | |
GATE_7_fin = GATE_5_0 or GATE_6_0 | |
if GATE_7_fin: | |
return "1" | |
else: | |
return "0" | |
data = "010001110101111001100011011011100100100100111001010111100100011101000111001110010100011100111001010001110011100101000111001110010101111001100011011011100100100101101110010010010011100100110101010111100110001100111001001101010110111001001001011011100100100101000111010111100011100100110101011011100100100101011110011000110100011101011110001110010011010101011110011000110101111001100011010111100110001101000111010111100101111001100011011011100100100101000111010111100011100100110101010001110101111001101110010010010101111001100011010111100110001101101110010010010101111001100011010111100110001100111001001101010100011101011110010111100110001101011110011000110101111001100011010001110101111001000111010111100101111001100011011011100100100101101110010010010101111001100011" | |
import binascii | |
d = [data[i:i+8] for i in range(0,len(data),8)] | |
out_string = "" | |
for byte in d: | |
out_string += gates_out(byte) | |
print "[+] out_string : %s" % out_string | |
n = int(out_string,2) | |
print binascii.unhexlify('%x' % n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment