From 01a55a25d25e3fbf203fbce93c954603c33e7016 Mon Sep 17 00:00:00 2001 From: Lunarantic <26676464+Lunarantic@users.noreply.github.com> Date: Tue, 25 Sep 2018 23:03:26 -0400 Subject: [PATCH 1/5] Update README.md --- timisoaractf/Back_in_Time/README.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/timisoaractf/Back_in_Time/README.md b/timisoaractf/Back_in_Time/README.md index 75de44e..ccab0fe 100644 --- a/timisoaractf/Back_in_Time/README.md +++ b/timisoaractf/Back_in_Time/README.md @@ -1,13 +1,26 @@ -I always hated history class. I thought history would never come in handy. +# Back in Time -It contained two files: -encrypt.py -ciphertext.txt +> I always hated history class. I thought history would never come in handy. +> [encrypt.py](encrypt.py) +> [ciphertext.txt](ciphertext.txt) + +------ On reading the python code we can easily know that; + Lowercase chars have been substituted by other Lowercase char. + All other are where they are suppose to be. +
+ We even know flag has timctf in start. -So by simple reverse subsitution we get the flag as: -timctf{Ps3udO_R4NdoM_1S_Not_RAnD0M} + +So, start by simple reverse subsitution; + +and making the words sensible in english; + +we get the flag + +------ +flag = timctf{Ps3udO_R4NdoM_1S_Not_RAnD0M} From de1dbc2b4d695b14b7c98caaf9b8ca63f1935dc0 Mon Sep 17 00:00:00 2001 From: Lunarantic <26676464+Lunarantic@users.noreply.github.com> Date: Tue, 25 Sep 2018 23:15:48 -0400 Subject: [PATCH 2/5] Update d_find.py --- timisoaractf/Those_Are_Rookie_Numbers/d_find.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/timisoaractf/Those_Are_Rookie_Numbers/d_find.py b/timisoaractf/Those_Are_Rookie_Numbers/d_find.py index dbcb535..ae3628c 100644 --- a/timisoaractf/Those_Are_Rookie_Numbers/d_find.py +++ b/timisoaractf/Those_Are_Rookie_Numbers/d_find.py @@ -1,3 +1,5 @@ +import sys + def egcd(a, b): if a == 0: return (b, 0, 1) @@ -12,7 +14,6 @@ def modinv(a, m): else: return x % m -a = 65537 -m = 58900433780152059829684181006276669632563849616305906563893514443102586211160 - -print(modinv(a,m)) +print(modinv(int(sys.argv[2]),int(sys.argv[1]))) +# print(modinv(65537, 58900433780152059829684181006276669632563849616305906563893514443102586211160) +# 58900433780152059829684181006276669632563849616305906563893514443102586211160 From 54b092a691b6318007592ffe9f4d7da0491ffef0 Mon Sep 17 00:00:00 2001 From: Lunarantic <26676464+Lunarantic@users.noreply.github.com> Date: Tue, 25 Sep 2018 23:17:35 -0400 Subject: [PATCH 3/5] Update c_decode.py --- timisoaractf/Those_Are_Rookie_Numbers/c_decode.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py b/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py index 0d117e7..cb39837 100644 --- a/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py +++ b/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py @@ -1,6 +1,11 @@ -c = 56191946659070299323432594589209132754159316947267240359739328886944131258862 -d = 13699426463079754153895905688064380048051799131808763503874587494945034432713 -n = 58900433780152059829684181006276669633073820320761216330291745734792546625247 +import sys + +# c = 56191946659070299323432594589209132754159316947267240359739328886944131258862 +c = sys.argv[1] +# d = 13699426463079754153895905688064380048051799131808763503874587494945034432713 +d = sys.arv[2] +# n = 58900433780152059829684181006276669633073820320761216330291745734792546625247 +n = sys.argv[3] p = pow(c,d,n) size = len("{:02x}".format(n)) // 2 From 3843ccdf58cb6accadeffb80b38ead2b0ecc7040 Mon Sep 17 00:00:00 2001 From: Lunarantic <26676464+Lunarantic@users.noreply.github.com> Date: Tue, 25 Sep 2018 23:18:51 -0400 Subject: [PATCH 4/5] Update c_decode.py --- timisoaractf/Those_Are_Rookie_Numbers/c_decode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py b/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py index cb39837..86ba0e5 100644 --- a/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py +++ b/timisoaractf/Those_Are_Rookie_Numbers/c_decode.py @@ -1,11 +1,11 @@ import sys # c = 56191946659070299323432594589209132754159316947267240359739328886944131258862 -c = sys.argv[1] +c = int(sys.argv[1]) # d = 13699426463079754153895905688064380048051799131808763503874587494945034432713 -d = sys.arv[2] +d = int(sys.arv[2]) # n = 58900433780152059829684181006276669633073820320761216330291745734792546625247 -n = sys.argv[3] +n = int(sys.argv[3]) p = pow(c,d,n) size = len("{:02x}".format(n)) // 2 From 0b278a60742a28badfc6081c754cf4ea6e38ba43 Mon Sep 17 00:00:00 2001 From: Lunarantic <26676464+Lunarantic@users.noreply.github.com> Date: Tue, 25 Sep 2018 23:20:12 -0400 Subject: [PATCH 5/5] Update README.py --- .../Those_Are_Rookie_Numbers/README.md | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/timisoaractf/Those_Are_Rookie_Numbers/README.md b/timisoaractf/Those_Are_Rookie_Numbers/README.md index 1fbb5d9..4f8535e 100644 --- a/timisoaractf/Those_Are_Rookie_Numbers/README.md +++ b/timisoaractf/Those_Are_Rookie_Numbers/README.md @@ -1,33 +1,50 @@ -You've overheard a discussion between two classmates arguing whether the size really matters. -What does this have to do with RSA? +# Not your average RSA -Within this challenge there is single file given with RSA parameters n, e, c. -We know, by RSA algorithm. +> You've overheard a discussion between two classmates arguing whether the size really matters. +> What does this have to do with RSA? + +> [params.txt](params.txt) +------ +Within this challenge there is single file given with RSA parameters n, e, c + +We know, by RSA algorithm +``` m = c^d mod(n) c = m^e mod(n) -We need to find m here. +``` +We need to find m here -So, we need to find d. -For d we need phi(n). +So, we need to find d + +For d we need *phi(n)* +``` phi(n) = (p-1)(q-1) where, - -p and q are prime numbers. +p and q are prime numbers And, n = pq - -So, we go check factorizedb if we can factors. -http://www.factordb.com/index.php?query=58900433780152059829684181006276669633073820320761216330291745734792546625247 -we get; -p = 176773485669509339371361332756951225661 -q = 333197218785800427026869958933009188427 - -So, now we get phi(n) = 58900433780152059829684181006276669632563849616305906563893514443102586211160 - +``` +So, we go check [factordb](http://www.factordb.com/index.php?query=58900433780152059829684181006276669633073820320761216330291745734792546625247) if factors are available + +we get +```python +>>> p = 176773485669509339371361332756951225661 +>>> q = 333197218785800427026869958933009188427 +>>> phi_n = p * q +>>> print(phi_n) +58900433780152059829684181006276669632563849616305906563893514443102586211160 +``` Now, we need to find d, which multiplicative inverse of e mod(phi(n)). -Thus, we go on using a python code saved as d_find.py -we get, d = 13699426463079754153895905688064380048051799131808763503874587494945034432713 -Now, for final c decode we use our c_decode.py +Thus, we go on using [d_find.py](d_find.py) +```Shell +$ python d_find.py 58900433780152059829684181006276669632563849616305906563893514443102586211160 65537 +13699426463079754153895905688064380048051799131808763503874587494945034432713 +``` +Now, finally for flag [c_decode.py](c_decode.py) +```Shell +$ python c_decode.py 56191946659070299323432594589209132754159316947267240359739328886944131258862 13699426463079754153895905688064380048051799131808763503874587494945034432713 58900433780152059829684181006276669633073820320761216330291745734792546625247 +timctf{th0sE_rOoKIe_numB3rz} +``` And, voila the flag is: timctf{th0sE_rOoKIe_numB3rz}