From 7150e4f4a84adf405c85e4154a46a4b9a2450f71 Mon Sep 17 00:00:00 2001 From: Jack-Crowley Date: Wed, 23 Aug 2023 14:20:08 -0400 Subject: [PATCH 1/3] code --- py-rev-2/gen.py | 15 +++++++++++++++ py-rev-2/main.py | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 py-rev-2/gen.py create mode 100644 py-rev-2/main.py diff --git a/py-rev-2/gen.py b/py-rev-2/gen.py new file mode 100644 index 0000000..e3f6cb2 --- /dev/null +++ b/py-rev-2/gen.py @@ -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) \ No newline at end of file diff --git a/py-rev-2/main.py b/py-rev-2/main.py new file mode 100644 index 0000000..5e536d6 --- /dev/null +++ b/py-rev-2/main.py @@ -0,0 +1,19 @@ +#camp{THis_wA5_SUPpO5E_to_Be_5Ecur3_b34018d8b0f1e} +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!") \ No newline at end of file From b74127f8c5011091c0ef3b96092c69208e8e648c Mon Sep 17 00:00:00 2001 From: Jack-Crowley Date: Thu, 24 Aug 2023 13:49:38 -0400 Subject: [PATCH 2/3] chall --- py-rev-2/chall.yaml | 14 ++++++++++++++ py-rev-2/main.py | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 py-rev-2/chall.yaml diff --git a/py-rev-2/chall.yaml b/py-rev-2/chall.yaml new file mode 100644 index 0000000..712a883 --- /dev/null +++ b/py-rev-2/chall.yaml @@ -0,0 +1,14 @@ +name: Python Rev 2 +categories: + - rev +value: 125 +flag: camp{YOu_foUnD_A_rIGhT_P4tH!} +description: |- + - After too many wrong password attempts, the system locked my out. Can you get me back in? +hints: + - How do dictionarys work in python? +files: + - src: main.py +authors: + - Jack Crowley +visible: true \ No newline at end of file diff --git a/py-rev-2/main.py b/py-rev-2/main.py index 5e536d6..e173094 100644 --- a/py-rev-2/main.py +++ b/py-rev-2/main.py @@ -1,4 +1,3 @@ -#camp{THis_wA5_SUPpO5E_to_Be_5Ecur3_b34018d8b0f1e} 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} From 06584a463854b206bac2739481465ca9af3edc0a Mon Sep 17 00:00:00 2001 From: mud-ali <96320211+mud-ali@users.noreply.github.com> Date: Sat, 26 Aug 2023 17:38:01 -0400 Subject: [PATCH 3/3] some fixes / tweaks --- py-rev-2/chall.yaml | 6 +++--- py-rev-2/main.py | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/py-rev-2/chall.yaml b/py-rev-2/chall.yaml index 712a883..b3f92d2 100644 --- a/py-rev-2/chall.yaml +++ b/py-rev-2/chall.yaml @@ -1,12 +1,12 @@ -name: Python Rev 2 +name: Python Rev II categories: - rev value: 125 flag: camp{YOu_foUnD_A_rIGhT_P4tH!} description: |- - - After too many wrong password attempts, the system locked my out. Can you get me back in? + - After too many wrong password attempts, the system has locked me out. Can you get me back in? hints: - - How do dictionarys work in python? + - Do you understand how dictionaries work in python? files: - src: main.py authors: diff --git a/py-rev-2/main.py b/py-rev-2/main.py index e173094..2c63a08 100644 --- a/py-rev-2/main.py +++ b/py-rev-2/main.py @@ -14,5 +14,7 @@ def passwordChecker(guess): guess = input("Enter the password: ") -if passwordChecker(guess): print("That's the right password!") -else: print("That's the incorrect password!") \ No newline at end of file +if passwordChecker(guess): + print("That's the right password!") +else: + print("That's the incorrect password!") \ No newline at end of file