Skip to content

Instantly share code, notes, and snippets.

@sunghun7511
Last active November 3, 2018 14:00
Show Gist options
  • Save sunghun7511/ac1f36dc2ea746501a889fb6b6dc9fb5 to your computer and use it in GitHub Desktop.
Save sunghun7511/ac1f36dc2ea746501a889fb6b6dc9fb5 to your computer and use it in GitHub Desktop.
raspberry solve
#!/usr/bin/python
import hashlib
import sys
def printFlag():
print("Flag is XXX")
def rshift(val, n):
m = 1 << 128
if ((val & m) == 0):
return val >> n
else:
for i in range(0, n):
val = (val >> 1) | m
return val
def check_passcode(passcode, val):
m = hashlib.md5()
m.update(passcode)
passcode = rshift(int(m.hexdigest(), 16), 112) << 112
a = rshift((1 << 128), 16)
# print('[*] a :', a)
# print('[*] val :', 0xefb6157e75017dc7134a16ff507fcf34)
# print('[*] a & val :', hex(a & val))
# print('[*] passcode :', hex(passcode))
if(passcode == (a & val)):
printFlag()
else:
print("Wrong!")
exit(0)
# passcode = raw_input("Enter passcode >> ")
passcode = sys.argv[1]
if(passcode.isdigit()):
check_passcode(passcode, 0xefb6157e75017dc7134a16ff507fcf34)
else:
print("You can only enter numbers!")
exit(0)
import subprocess
# 18994
i = 0
while True:
output = subprocess.check_output(["C:\\Python27\\python.exe", "./raspberry.py", str(i)])
if "Wrong!" not in output:
print(i)
exit()
i += 1
'''
Enter passcode >>
18994
Flag is It_Is_alw@Ys_tIm3_t0_d0_go0d
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment