diff --git a/listen-closely/description.md b/listen-closely/description.md new file mode 100644 index 0000000..4363f1a --- /dev/null +++ b/listen-closely/description.md @@ -0,0 +1 @@ +We intercepted a secret message, but we can't tell what it's saying. Maybe you can help? [super secret message](${listenclosely_wav})? \ No newline at end of file diff --git a/listen-closely/grader.py b/listen-closely/grader.py new file mode 100644 index 0000000..5e8f43e --- /dev/null +++ b/listen-closely/grader.py @@ -0,0 +1,4 @@ +def grade(autogen, key): + if key.find("CAN_YOU_EVEN_HEAR_ME_YET") != -1: + return True, "Correct!" + return False, "Nope!" diff --git a/listen-closely/listenclosely.wav b/listen-closely/listenclosely.wav new file mode 100644 index 0000000..4708576 Binary files /dev/null and b/listen-closely/listenclosely.wav differ diff --git a/listen-closely/problem.yml b/listen-closely/problem.yml new file mode 100644 index 0000000..d25404f --- /dev/null +++ b/listen-closely/problem.yml @@ -0,0 +1,9 @@ +author: GenericNickname +title: Listen Closely +hint: 1, 16, 8000 +category: Crytpography +autogen: false +programming: false +value: 50 +files: + - listenclosely.wav diff --git a/rsa2/description.md b/rsa2/description.md new file mode 100644 index 0000000..d5802d9 --- /dev/null +++ b/rsa2/description.md @@ -0,0 +1 @@ +Some more RSA! This time, there's no P and Q... [this](${ciphertext_txt}). \ No newline at end of file diff --git a/rsa2/grader.py b/rsa2/grader.py new file mode 100644 index 0000000..bca12b2 --- /dev/null +++ b/rsa2/grader.py @@ -0,0 +1,48 @@ +from cStringIO import StringIO + +flag = "l0w_n" + +def modx(base,exp,mod): + r = 1; + while (exp > 0): + if (exp % 2 == 1): + r = (r * base) % mod + base = (base * base) % mod + exp = exp/2 + return r + +def probprime(s): + if s%2==0: + s += 1 + smolprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] + while len(set([modx(i,s-1,s) for i in smolprimes])) != 1 or modx(2,s-1,s) != 1: + s+=2 + return(s) + +def get_problem(random): + # add Probable Prime function later + p = probprime(random.randint(10**20,9*10**20)) + q = probprime(random.randint(10**20,9*10**20)) + e = 3 + salt = "".join([random.choice("0123456789abcdef") for i in range(4)]) + return (p, q, e, salt) + +def generate_ciphertext(random): + p, q, e, salt = get_problem(random) + encoded = int(("flag{%s_%s}" % (flag, salt)).encode('hex'),16) + ciphertext = 'n: '+str(p*q)+'\n' + ciphertext += 'e: '+str(e)+'\n' + ciphertext += 'c: '+str(pow(encoded, e, p*q))+'\n' + + return StringIO(ciphertext) + +def generate(random): + return dict(files={ + "ciphertext_rsa2.txt": generate_ciphertext + }) + +def grade(random, key): + n, salt = get_problem(random) + if key.find("%s_%s" % (flag, salt)) >= 0: + return True, "Correct!" + return False, "Nope." diff --git a/rsa2/problem.yml b/rsa2/problem.yml new file mode 100644 index 0000000..210bc96 --- /dev/null +++ b/rsa2/problem.yml @@ -0,0 +1,4 @@ +title: RSA 2 +value: 35 +author: neptunia +autogen: true \ No newline at end of file