Skip to content

Instantly share code, notes, and snippets.

@yue82
Created July 23, 2016 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yue82/bf563bb46e8684a59aea79b525b693fb to your computer and use it in GitHub Desktop.
Save yue82/bf563bb46e8684a59aea79b525b693fb to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from _md5 import MD5Type as z
def is_flag(s):
# A = int(s[pow(ord(s[0]), 2) - ord(ZeroDivisionError.__name__[0b101]) * 0o105 + 19:])
A = int(s[ pow(ord(s[0]), 2)-7226 :]) # 85**2=7225, s[0] = chr(85) = 'U', A = int(s[-1])
# B = list(filter(lambda q: q % (int(z.__name__[::-3]) - 0b10) == 0, [A, A * 2, A * 3, A * 4, A * 5]))
B = list(filter(lambda q: q % 3 == 0, [A, A*2, A*3, A*4, A*5]))
if len(B) != 5: # Aは3の倍数
return False
# C = s[0b01:-0b10]
C = s[1:-2]
# if (len([n for n in list(C) if lambda y: i in B])) != 0o10:
if (len([n for n in list(C) if lambda y: i in B])) != 8: # lambda式に意味なし? len(C)==8
return False
# D = [(ord(x) - 0x30) for x in list(s)] # 01100110 01101001 01101100 01101100 00100000 01101001 01101110 00100000 01110100 01101000 01100101 00100000 01100010 01101100 01100001 01101110 01101011 01110011
D = [(ord(x) - 48) for x in list(s)] # fill in the blanks 数字を数字に直してるだけ
# if s.count(chr(0b101 * 0x11)) != 3:
if s.count('U') != 3: # 'U'が3つある
return False
# if C.index("​_") != C[::-1].index("_​"):
if C.index('_') != C[::-1].index('_'): # '_'がCの真ん中にある
return False
# if (s[D[int(chr(ord(True.__str__()[0b10]) - 0o102))]]) != chr(pow(0b101 ** 0x02, 0o02) - 0b1000011100):
if (s[D[3]]) != 'U': # sのD[3]はU
return False
return True
if __name__ == '__main__':
s = 'UtU2__teUs3'
print(is_flag(s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment