x = 80 y = 30 s = '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101010000000000000000000001010000010000000000000000000100010001000000000000000000010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000100000001000000000000000000000101101101000000000000000000000100000001000000000000000000000101000101000000000000000000000101111101000000000000000000000100000001000000000000000000000111111111000000000000000000000000000000000000000000000000001001000111100000000000000000001001000100100000000000000000001001000100100000000000000000001001000100100000000000000000001111000100100000000000000000000000000000000000000000000000001110111011100000000000000000001000010010000000000000000000001000010011100000000000000000001110010010000000000000000000000000000000000000000000000000011000000000000000000000000000010000000000000000000000000000010000101000100000000000000000110010101010001000000000000000010010101010101000000000000000010000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000100000000000000000000000001000001000000000000000000000000010000000100000000000000000001010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000010000000000000000000001010100000000000000000000000000000001000100000000000000000001010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000001000000000000000000010000010000000000000000000000000101000001000000000000000001010101010101000000000000000000000000000000000000000000000001100000000000000000000000000000100000000000000000000000000000100000000000000000000000000000110000000000000000000000000000100000000000000000000000000000100000000000000000000000000001100000000000000000000000000000000000000000000000000000000011111111111111111100000000000000000000000000000000000000000011110111101111011100000000000010000100101001010110000000000010110100101001010010000000000010010100101001010110000000000011110111101111011100000000000000000000000000000000000000000010000100101111010010000000000010000100101000010100000000000010000100101000011000000000000010000100101000010100000000000011110111101111010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' # s = s[::-1] im = Image.new('RGB',(x,y)) n = 0 for i in range(x): for j in range(y): if s[n]=='0': im.putpixel([i,j],(255,255,255)) else: im.putpixel([i,j],(0,0,0)) n += 1 im.save("untmp.png")
nums = [] keys = open('usb1data.txt','r') posx = 0 posy = 0 res = open('res.txt','a') for line in keys: try: x = int(line[2:4],16) y = int(line[4:6],16) if x > 127 : x -= 256 if y > 127 : y -= 256 posx += x posy += y btn_flag = int(line[0:2],16) # 1 for left , 2 for right , 0 for nothing # print(line[4:6]) if btn_flag == 1 : print(posx,posy) res.write(str(posx)+' '+str(-posy)) res.write('\n') except: pass res.close()
# t = pairterSpiralMatrix1(3) # print(t) arr = pairterSpiralMatrix1(57, 1)#左上 # print arr arr1 = pairterSpiralMatrix1(57, 0)#右下 f = open('out.txt', encoding='utf-8') bg = f.readlines() # bg = bg[2].strip().split(' ') l = len(bg[2].strip().split(' ')) # print(bg) # print l ls = {}#左上 ls1 = {}#右下 # print arr[0][0] for i in range(l): for j in range(l): # print arr[i][j] if arr[i][j] != 0: ls[arr[i][j]] = bg[i].strip().split(' ')[j]
for i in range(l): for j in range(l): # print arr[i][j] if arr1[i][j] != 0: ls1[arr1[i][j]] = bg[i].strip().split(' ')[j] #print(ls1)
res = '' for i in range(1, len(ls) + 1): res += ls[i] + ' ' #print(res.split(' ')[57]) flag = '' for i in res.split(' '): flag += i + ' ' #print(flag.split(' '))
res1 = '' for i in range(1, len(ls) + 1): res1 += ls1[i] + ' ' #print(res1.split(' ')[57]) flag1 = '' for i in res1.split(' '): flag1 += i + ' ' #print(flag1) #print(set(flag) & set(flag1)) rrr = [] rrrr = [] for i in flag.split(' '): # rrr.append(i.replace('☰','000').replace('☱','001').replace('☲','010').replace('☳','110').replace('☴','100').replace('☵','101').replace('☶','110').replace('☷','111')) rrr.append(i.replace('☰','111').replace('☶','100').replace('☷','000').replace('☴','110').replace('☱','011').replace('☲','101').replace('☵','010').replace('☳','001')) for i in flag1.split(' '): # rrrr.append(i.replace('☰','000').replace('☱','001').replace('☲','010').replace('☳','110').replace('☴','100').replace('☵','101').replace('☶','110').replace('☷','111')) rrrr.append(i.replace('☰','111').replace('☶','100').replace('☷','000').replace('☴','110').replace('☱','011').replace('☲','101').replace('☵','010').replace('☳','001'))
list1 = {} pt = 'UNCTF2020_Enjoy_Crypto~' cipher = '01a4e429e76db218fa0eb18f03ec69c9200a2362d8b4d7ea46170ce698389bbd' for i in printable: for j in printable: for k in printable: key1 = '0000000000000' + i + j + k list1[i + j + k] = encrypt(pt, key1) # key2 = 'abc0000000000000' # cipher1 = AES.new(key=key1.encode(), mode=AES.MODE_ECB) # cipher2 = AES.new(key=key2.encode(), mode=AES.MODE_ECB) # val = len(pt) % 16 # if not val == 0: # pt += b'\x00' * (16 - val) # c1 = cipher1.encrypt(pt) # list1[i + j + k] = hexlify(cipher2.encrypt(c1))
# print(list1) list2 = {} for i in printable: for j in printable: for k in printable: key2 = i + j + k + '0000000000000' list2[i + j + k] = decrypt(cipher, key2) # print(list2)
L1 = [] L2 = [] for i in list1.values(): L1.append(i) for i in list2.values(): L2.append(i)
same = set(L1) & set(L2) same = list(same)[0] print('key1:0000000000000'+list(list1.keys())[list(list1.values()).index(same)]) print('key2:'+list(list2.keys())[list(list2.values()).index(same)]+'0000000000000')
import subprocess from string import ascii_letters as lt
s = 'HSWEH2vXHmRtGZRJvSmKviwtviv4Ga5rD25Mvl:u6ewBUKg9' print(len(s))
process = subprocess.Popen(['ICU.exe'],stdout = subprocess.PIPE, stdin = subprocess.PIPE)
# out = process.communicate('A'.encode()) # out = str(list(out)[0]) # out = out.split('\\n')[4].replace('\\r','') #res = 'unctf{we_remember_everything_YLBN' res = 'unctf{'
for i in range(2, len(s)//4):
for a in lt+'+_}!': for b in lt+'+_}!': f1 = False f = False for c in lt+'+_}!': f2 = False process = subprocess.Popen(['ICU.exe'], stdout=subprocess.PIPE,stdin=subprocess.PIPE) part = a + b + c out = process.communicate((res + part).encode()) print(res + part) out = str(list(out)[0]) out = out.split('\\n')[4].replace('\\r', '') print(out) print(s[0:4*(i+1)]) # print(out[i]) # print(s[i]) if out[4*i]!=s[4*i]: f1 = False break else: f1 = True if out[4 * i+1] != s[4 * i+1]: f2 = False break else: f2 = True if out==s[0:4*(i+1)]: res += part print(out) print(s[0:4 * (i + 1)]) print(part) f = True break if f2==False: break if f1==False: break if f == True: break if f == True: break if f == False: print('false:'+part) break