From fc96f770ee04db1db86270cb839367b9dbbcc182 Mon Sep 17 00:00:00 2001 From: Roman Hergenreder Date: Sun, 29 Dec 2019 19:15:21 +0100 Subject: [PATCH] Day 23 fix --- Day 23/decode.php | 62 -------------------------- Day 23/decode.py | 84 ----------------------------------- Day 23/flag.txt | Bin 37 -> 0 bytes Day 23/generatePasswords.php | 19 ++++++++ Day 23/hash | 2 +- Day 23/test.php | 18 -------- 6 files changed, 20 insertions(+), 165 deletions(-) delete mode 100644 Day 23/decode.php delete mode 100644 Day 23/decode.py delete mode 100644 Day 23/flag.txt create mode 100644 Day 23/generatePasswords.php delete mode 100644 Day 23/test.php diff --git a/Day 23/decode.php b/Day 23/decode.php deleted file mode 100644 index 6b3b628..0000000 --- a/Day 23/decode.php +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/php - "); -} - -$PROC_NUM = $argv[1]; - -if(!is_numeric($argv[2])) { - die("NaN: start"); -} - -if(!is_numeric($argv[3])) { - die("NaN: end"); -} - -$start = intval($argv[2]); -$end = intval($argv[3]); - -if($end < $start) { - die("Invalid interval: end < start"); -} - -$charset = 'abcdefghijkmpqrstuvwxyzABCDEFGHJKLMPQRSTUVWXYZ23456789'; -$zip = new ZipArchive(); -$zip_status = $zip->open("Santa-data.zip"); -if ($zip_status !== true) { - die("Could not open zip file"); -} - -for($t = $start; $t <= $end; $t++) { - - srand($t); - $rand_str = ""; - - // if(($t-$start) % 10000000 == 0) { - // $progress = (($t-$start) / ($end - $start)) * 100; - // print("[$PROC_NUM] Progress: $progress%\n"); - // } - - for($j = 0; $j < 12; $j++) { - $rand_key = rand(0, 54 - 1); - $rand_str .= $charset[$rand_key]; - } - - // stdout for john - // if(strcmp($rand_str, "Kwmq3Sqmc5sA") == 0) { - // die("Done: $t\n"); - // } - - // 4160000 - // print("$rand_str\n"); - // - if ($zip->setPassword($rand_str)) { - if ($zip->extractTo(__DIR__)) { - die("PASSWORD: $rand_str"); - } - } -} - -?> diff --git a/Day 23/decode.py b/Day 23/decode.py deleted file mode 100644 index 2e6d1d6..0000000 --- a/Day 23/decode.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/python - -import subprocess -import re -import datetime -import hashlib -import base64 -import requests -import random -import time - -# charset = [chr(ord("0")+x) for x in range(10)] + \ -# [chr(ord("A")+x) for x in range(26)] + \ -# [chr(ord("a")+x) for x in range(26)] - - -# import BeautifulSoup4 as bs4 - -# def encode(sec): -# md5 = hashlib.md5(sec.encode("UTF-8")).digest() -# b64 = base64.b64encode(md5).decode("UTF-8") -# return b64 -# -# password = "cswpWQfUu8fL" -# timestamp = "2019-12-23 11:43" -# -# d = datetime.datetime.strptime(timestamp, "%Y-%m-%d %H:%M" ) -# seconds = int(d.timestamp()) -# print() -# -# charset = "abcdefghijkmpqrstuvwxyzABCDEFGHJKLMPQRSTUVWXYZ23456789"; -# random.seed(0) -# print("".join([random.choice(charset) for i in range(12)])) # [charset[random.randint(0,len(charset) - 1)] for x in range(12)])) - -# for s in range(60): -# for j in range(1000): -# random.seed(seconds + s) -# rand_indices = [random.randint(0,len(charset) - 1) for i in range(12)] -# rand_str = "".join([charset[i] for i in rand_indices]) -# if rand_str == password or rand_str.lower() == password.lower(): -# print(rand_str, rand_indices) - -# for i in range(60): -# for j in range(100): -# b64 = encode("%d.%02d" % (seconds + i, j)) -# if password in b64: -# print(b64) - -# def getPassword(): -# pass - -# charset = [] -# pattern = re.compile("(.*)<\/strong>") -# # -# for i in range(100): -# res = requests.post("http://whale.hacking-lab.com:23023/archive.php", data={"req[]":"blindball", "username":"test"}) -# if res.status_code == 200: -# pw = pattern.search(res.text).group(1) -# print(time.time(), pw) -# for x in pw: -# if x not in charset: -# charset.append(x) -# -# print("".join(sorted(charset))) - -min = 0 -max = 2**32 - 1 -num_processes = 4 -steps = (max-min+1) // num_processes -start = min - -procs = [] - -for i in range(num_processes): - end = start + steps - args = ["php", "decode.php", str(i+1), str(start), str(end)] - print("Starting subprocess:", " ".join(args)) - procs.append(subprocess.Popen(args)) - start = end + 1 - break - # break - -for proc in procs: - proc.wait() diff --git a/Day 23/flag.txt b/Day 23/flag.txt deleted file mode 100644 index feeda82b5126cd100f260509b42d9146f17c7f37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 37 vcmV+=0NVd3(8Wf>uMhwn%)68H5hCvp4u1e;uHJNtYi09))u1>&tED`wNAwZH diff --git a/Day 23/generatePasswords.php b/Day 23/generatePasswords.php new file mode 100644 index 0000000..ad708ee --- /dev/null +++ b/Day 23/generatePasswords.php @@ -0,0 +1,19 @@ +#!/usr/bin/php + diff --git a/Day 23/hash b/Day 23/hash index 609a280..5643069 100644 --- a/Day 23/hash +++ b/Day 23/hash @@ -1,2 +1,2 @@ Santa-data.zip/flag.txt:$zip2$*0*1*0*d75ebd89add5cf76*75ca*25*8249d36387bf723d66085cb4334858bc69989550a643c4a614645d505889e91bdbd269787a*fe232081a44c398eeab9*$/zip2$:flag.txt:Santa-data.zip:Santa-data.zip -Santa-data.zip:$pkzip2$3*1*1*0*63*24*5e20*7c67*69e5d5637af3005ba4c1061964f8037c23d4d912fd8dd6bc59e65eadfc791a5c163461bc*1*0*63*24*8994*4eaf*99dc5ea6d837c104740f6d9e883d8b4c44028b2c0eed3f575925352e966cbe3c96c49176*2*0*39*25*b31e19ff*0*31*63*39*b31e*83ea*d75ebd89add5cf7675ca8249d36387bf723d66085cb4334858bc69989550a643c4a614645d505889e91bdbd269787afe232081a44c398eeab9*$/pkzip2$::Santa-data.zip:flag.txt, ball15.png, pearl.png:Santa-data.zip +Santa-data.zip/flag.txt:$pkzip2$1*1*2*0*39*25*b31e19ff*0*31*63*39*b31e*83ea*d75ebd89add5cf7675ca8249d36387bf723d66085cb4334858bc69989550a643c4a614645d505889e91bdbd269787afe232081a44c398eeab9*$/pkzip2$:flag.txt:Santa-data.zip::Santa-data.zip diff --git a/Day 23/test.php b/Day 23/test.php deleted file mode 100644 index 74d4765..0000000 --- a/Day 23/test.php +++ /dev/null @@ -1,18 +0,0 @@ -