Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

rev/py-rev-2 #24

Merged
merged 3 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions py-rev-2/chall.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Python Rev II
categories:
- rev
value: 125
flag: camp{YOu_foUnD_A_rIGhT_P4tH!}
description: |-
- After too many wrong password attempts, the system has locked me out. Can you get me back in?
hints:
- Do you understand how dictionaries work in python?
files:
- src: main.py
authors:
- Jack Crowley
visible: true
15 changes: 15 additions & 0 deletions py-rev-2/gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import random

flag = "camp{YOu_foUnD_A_rIGhT_P4tH!}"

choices = [i for i in range(len(flag))]

out = {}

for i in range(len(flag)):
choice = random.choice(choices)
choices.remove(choice)

out[flag[choice]] = choice

print(out)
20 changes: 20 additions & 0 deletions py-rev-2/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def passwordChecker(guess):
flag = {'D': 13, 'a': 1, 'O': 6, 'u': 7, 'r': 17, 'Y': 5, 'U': 11, '!': 27, 'c': 0, 'A': 15, 'n': 12, 'P': 23, 't': 25, '}': 28, 'h': 20, 'm': 2, 'G': 19, 'f': 9, 'p': 3, '{': 4, 'I': 18, 'T': 21, 'H': 26, '4': 24, 'o': 10}

for i in range(len(guess)):
letter = guess[i]
if flag.get(letter) != None:
if flag[letter] == i:
continue
if letter == "_": continue
return False

return True


guess = input("Enter the password: ")

if passwordChecker(guess):
print("That's the right password!")
else:
print("That's the incorrect password!")
Loading