Added challenge 245
This commit is contained in:
parent
41b51f435c
commit
1144db567f
BIN
245/level1.flag.txt.enc
Normal file
BIN
245/level1.flag.txt.enc
Normal file
Binary file not shown.
28
245/level1.py
Normal file
28
245/level1.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
### THIS FUNCTION WILL NOT HELP YOU FIND THE FLAG --LT ########################
|
||||||
|
def str_xor(secret, key):
|
||||||
|
#extend key to secret length
|
||||||
|
new_key = key
|
||||||
|
i = 0
|
||||||
|
while len(new_key) < len(secret):
|
||||||
|
new_key = new_key + key[i]
|
||||||
|
i = (i + 1) % len(key)
|
||||||
|
return "".join([chr(ord(secret_c) ^ ord(new_key_c)) for (secret_c,new_key_c) in zip(secret,new_key)])
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
flag_enc = open('level1.flag.txt.enc', 'rb').read()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def level_1_pw_check():
|
||||||
|
user_pw = input("Please enter correct password for flag: ")
|
||||||
|
if( user_pw == "8713"):
|
||||||
|
print("Welcome back... your flag, user:")
|
||||||
|
decryption = str_xor(flag_enc.decode(), user_pw)
|
||||||
|
print(decryption)
|
||||||
|
return
|
||||||
|
print("That password is incorrect")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
level_1_pw_check()
|
Loading…
Reference in New Issue
Block a user