ucdavis-ecs189m

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

commit d566d297dfebd290f96b1a3ede24d8b9c629fea7
parent fa826e47f9b6cdc653614ebff44ded0cc0433c9d
Author: therealFIGBERT <figbertwelner@gmail.com>
Date:   Wed,  9 Oct 2019 15:57:35 -0700

Almost there

Diffstat:
Mdad_flag.py | 25++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/dad_flag.py b/dad_flag.py @@ -8,22 +8,21 @@ def str_to_dec(s): 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)) + for i in range(19,0,-1): + digit = int(num/(26**i)) + char = chr(digit+97) + st += char + num -= digit*(26**i) + char = chr(int(num)+97) + st += char return st - LO26 = "aaaaaaaaaaaaaaaaaaaa" -HI26 = "zzzzzzzzzzzzzzzzzzzz" +HI26 = "yyyyyyyyyyyyyyyyyyyy" 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 +print(dec_to_str(LO10)) +print(dec_to_str(HI10)) +print(dec_to_str(MID10)) +\ No newline at end of file