ucdavis-ecs189m

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

commit fa826e47f9b6cdc653614ebff44ded0cc0433c9d
parent d99af9ce20b071ab1b963f82fc607697fe5ddee3
Author: therealFIGBERT <figbertwelner@gmail.com>
Date:   Mon,  7 Oct 2019 00:39:24 -0700

Initial implementation of b26 system for third flag

Diffstat:
Adad_flag.py | 30++++++++++++++++++++++++++++++
Mfunc_dump.py | 9---------
2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/dad_flag.py b/dad_flag.py @@ -0,0 +1,29 @@ +from pwn import * + +def str_to_dec(s): + num_vals = [(ord(char)-97) for char in s][-1::-1] + lst = [] + for pos, val in enumerate(num_vals): + lst.append(val*(26**pos)) + return sum(lst) + +def dec_to_str(num): + num_vals = [int(a) for a in str(num)][-1::-1] + lst = [] + st = "" + for pos, val in enumerate(num_vals): + lst.append(val/(26**pos)) + lst = lst[-1::-1] + while len(st) < 20: + for i in lst: + st += chr(int(i+97)) + return st + + +LO26 = "aaaaaaaaaaaaaaaaaaaa" +HI26 = "zzzzzzzzzzzzzzzzzzzz" +LO10 = str_to_dec(LO26) +HI10 = str_to_dec(HI26) +print(dec_to_str(HI10)) +MID10 = (LO10 + HI10)/2 +print("Base26:\nLow: {}\nHigh: {}\n\nBase10:\nLow: {}\nHigh: {}\nMid: {}".format(LO26, HI26, LO10, HI10, MID10)) +\ No newline at end of file diff --git a/func_dump.py b/func_dump.py @@ -1,12 +1,3 @@ -from pwn import * - -def string_to_decimal(s): - lst = [(ord(char)-96) for char in s] - for i in lst: - lst[i-1] = lst[i-1]*(26**(i-1)) - added = sum(lst) - return added - def increment(password): new_pass = "" lst = []