Skip to content

Instantly share code, notes, and snippets.

@lttn1204
Created May 23, 2021 17:12
Show Gist options
  • Save lttn1204/6ce2acaeb566d2b43795f381cf00e0b9 to your computer and use it in GitHub Desktop.
Save lttn1204/6ce2acaeb566d2b43795f381cf00e0b9 to your computer and use it in GitHub Desktop.
from string import *
def weird_function_1(s):
return sum([list(map(int,bin(ord(c))[2:].zfill(8))) for c in s], [])
def do_magic(OooO, B):
return sum(m * b for m, b in zip(weird_function_1(OooO), B))
B=[4267101277, 4946769145, 6306104881, 7476346548, 7399638140, 1732169972, 1236242271, 5109093704, 2163850849, 6552199249, 3724603395, 3738679916, 5211460878, 642273320, 3810791811, 761851628, 1552737836, 4091151711, 1601520107, 3117875577, 2485422314, 1983900485, 6150993150, 2045278518]
s=[34451302951,58407890177,49697577713,45443775595,38537028435,47069056666,49165602815,43338588490,32970122390]
flag=''
def brute(i):
for a in printable:
for b in printable:
for c in printable:
if do_magic(a+b+c,B)==i:
return a+b+c
def _brute(i):
for a in printable:
if do_magic(a,B)==i:
return a
for b in printable:
if do_magic(a+b,B)==i:
return a+b
for c in printable:
if do_magic(a+b+c,B)==i:
return a+b+c
for i in range(len(s)-1):
flag+=brute(s[i])
print(flag)
flag+=_brute(s[-1])
print(flag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment