Guest User

Untitled

a guest
Oct 3rd, 2022
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. import base64
  2. import random
  3.  
  4. flag="TSCTF-J{fake_flag}"
  5.  
  6. def GBK2312():
  7.     head = random.randint(0xb0, 0xf7)
  8.     body = random.randint(0xa1, 0xfe)
  9.     val = f'{head:x} {body:x}'
  10.     str = bytes.fromhex(val).decode('gb2312')
  11.     return str
  12.  
  13. def b64encode(a):
  14.     encode = base64.b64encode(a.encode('utf-8'))
  15.     return encode
  16.  
  17. if __name__ == '__main__':
  18.     for i in range(777):
  19.         choice=random.random()
  20.         if choice <= 0.3:
  21.             chinese=GBK2312()
  22.         else :
  23.             chinese=str(random.choice(dic_word))
  24.         chinese_base64=b64encode(chinese)
  25.         print(f'Input base64(???) = {chinese_base64} plz!')
  26.         s = input()
  27.         if s == chinese:
  28.             print(f'{i+1}:succeed')
  29.         else :
  30.             print(f'{i+1}:failed')
  31.             quit()
  32.     print(flag)
Add Comment
Please, Sign In to add comment