From 935da1c9cd5cfec71713b4533f8b5cad5cb11180 Mon Sep 17 00:00:00 2001 From: aaron Date: Fri, 3 Dec 2021 17:51:41 +0100 Subject: [PATCH] add xmasspirit readme and cleanup stuff --- README.md | 2 ++ crypto/XMASSpirit/README.md | 12 +++++++ crypto/XMASSpirit/decrypt.py | 63 --------------------------------- crypto/XMASSpirit/decrypt.sh | 10 ------ crypto/XMASSpirit/encrypted.txt | 2 -- crypto/XMASSpirit/output | 11 ------ forensics/honeypot/README.md | 1 - 7 files changed, 14 insertions(+), 87 deletions(-) create mode 100644 crypto/XMASSpirit/README.md delete mode 100755 crypto/XMASSpirit/decrypt.py delete mode 100644 crypto/XMASSpirit/decrypt.sh delete mode 100644 crypto/XMASSpirit/encrypted.txt delete mode 100644 crypto/XMASSpirit/output diff --git a/README.md b/README.md index f2e57d8..a5e0b02 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Cyber Santa is Coming to Town +[link](https://ctf.hackthebox.com/ctf/249) + ## Challenges - Web diff --git a/crypto/XMASSpirit/README.md b/crypto/XMASSpirit/README.md new file mode 100644 index 0000000..b7fa7c2 --- /dev/null +++ b/crypto/XMASSpirit/README.md @@ -0,0 +1,12 @@ +# XMASSpirit + +Now that elves have taken over Santa has lost so many letters from kids all +over the world. However, there is one kid who managed to locate Santa and sent +him a letter. It seems like the XMAS spirit is so strong within this kid. He +was so smart that thought of encrypting the letter in case elves captured it. +Unfortunately, Santa has no idea about cryptography. Can you help him read the +letter? + +## Flag + +## Progress diff --git a/crypto/XMASSpirit/decrypt.py b/crypto/XMASSpirit/decrypt.py deleted file mode 100755 index 41d7230..0000000 --- a/crypto/XMASSpirit/decrypt.py +++ /dev/null @@ -1,63 +0,0 @@ -import argparse -import sys - -from math import gcd - -sys.setrecursionlimit(1500) - -parser = argparse.ArgumentParser(description='RSA Common modulus attack') -required_named = parser.add_argument_group('required named arguments') -required_named.add_argument('-n', '--modulus', help='Common modulus', required=True) -required_named.add_argument('-e1', '--e1', help='First exponent', required=True) -required_named.add_argument('-e2', '--e2', help='Second exponent', required=True) -required_named.add_argument('-ct1', '--ct1', help='First ciphertext', required=True) -required_named.add_argument('-ct2', '--ct2', help='Second ciphertext', required=True) - -def egcd(a, b): - if a == 0: - return (b, 0, 1) - else: - g, y, x = egcd(b % a, a) - return (g, x - (b // a) * y, y) - -def modinv(a, m): - g, x, y = egcd(a, m) - if g != 1: - raise ValueError('Modular inverse does not exist.') - else: - return x % m - -def attack(c1, c2, e1, e2, N): - if gcd(e1, e2) != 1: - raise ValueError("Exponents e1 and e2 must be coprime") - s1 = modinv(e1,e2) - s2 = int((gcd(e1,e2) - e1 * s1) / e2) - temp = modinv(c2, N) - m1 = pow(c1,s1,N) - m2 = pow(temp,-s2,N) - return (m1 * m2) % N - -def main(): - args = parser.parse_args() - n = int(args.modulus, 16) - ct1 = int(args.ct1, 16) - ct2 = int(args.ct2, 16) - e1 = int(args.e1, 16) - e2 = int(args.e2, 16) - print(n) - print(ct1) - print(ct2) - print(e1) - print(e2) - print('[+] Started attack...') - try: - message = attack(ct1, ct2, e1, e2, n) - print('[+] Attack finished!') - print(type(message)) - print('\nPlaintext message:\n%s' % format(message, 'x')) - except Exception as e: - print('[+] Attack failed!') - print(e.message) - -main() - diff --git a/crypto/XMASSpirit/decrypt.sh b/crypto/XMASSpirit/decrypt.sh deleted file mode 100644 index 0ad7915..0000000 --- a/crypto/XMASSpirit/decrypt.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# yeah I use bash to run python beacause fuck you - -python decrypt.py \ --n 0xa96e6f96f6aedd5f9f6a169229f11b6fab589bf6361c5268f8217b7fad96708cfbee7857573ac606d7569b44b02afcfcfdd93c21838af933366de22a6116a2a3dee1c0015457c4935991d97014804d3d3e0d2be03ad42f675f20f41ea2afbb70c0e2a79b49789131c2f28fe8214b4506db353a9a8093dc7779ec847c2bea690e653d388e2faff459e24738cd3659d9ede795e0d1f8821fd5b49224cb47ae66f9ae3c58fa66db5ea9f73d7b741939048a242e91224f98daf0641e8a8ff19b58fb8c49b1a5abb059f44249dfd611515115a144cc7c2ca29357af46a9dc1800ae9330778ff1b7a8e45321147453cf17ef3a2111ad33bfeba2b62a047fa6a7af0eef \ --e1 0x10001 \ --e2 0x23 \ --ct1 0x55cfe232610aa54dffcfb346117f0a38c77a33a2c67addf7a0368c93ec5c3e1baec9d3fe35a123960edc2cbdc238f332507b044d5dee1110f49311efc55a2efd3cf041bfb27130c2266e8dc61e5b99f275665823f584bc6139be4c153cdcf153bf4247fb3f57283a53e8733f982d790a74e99a5b10429012bc865296f0d4f408f65ee02cf41879543460ffc79e84615cc2515ce9ba20fe5992b427e0bbec6681911a9e6c6bbc3ca36c9eb8923ef333fb7e02e82c7bfb65b80710d78372a55432a1442d75cad5b562209bed4f85245f0157a09ce10718bbcef2b294dffb3f00a5a804ed7ba4fb680eea86e366e4f0b0a6d804e61a3b9d57afb92ecb147a769874 \ --ct2 0x79834ce329453d3c4af06789e9dd654e43c16a85d8ba0dfa443aefe1ab4912a12a43b44f58f0b617662a459915e0c92a2429868a6b1d7aaaba500254c7eceba0a2df7144863f1889fab44122c9f355b74e3f357d17f0e693f261c0b9cefd07ca3d1b36563a8a8c985e211f9954ce07d4f75db40ce96feb6c91211a9ff9c0a21cad6c5090acf48bfd88042ad3c243850ad3afd6c33dd343c793c0fa2f98b4eabea399409c1966013a884368fc92310ebcb3be81d3702b936e7e883eeb94c2ebb0f9e5e6d3978c1f1f9c5a10e23a9d3252daac87f9bb748c961d3d361cc7dacb9da38ab8f2a1595d7a2eba5dce5abee659ad91a15b553d6e32d8118d1123859208 \ diff --git a/crypto/XMASSpirit/encrypted.txt b/crypto/XMASSpirit/encrypted.txt deleted file mode 100644 index f800dc1..0000000 --- a/crypto/XMASSpirit/encrypted.txt +++ /dev/null @@ -1,2 +0,0 @@ -{'n': '0xa96e6f96f6aedd5f9f6a169229f11b6fab589bf6361c5268f8217b7fad96708cfbee7857573ac606d7569b44b02afcfcfdd93c21838af933366de22a6116a2a3dee1c0015457c4935991d97014804d3d3e0d2be03ad42f675f20f41ea2afbb70c0e2a79b49789131c2f28fe8214b4506db353a9a8093dc7779ec847c2bea690e653d388e2faff459e24738cd3659d9ede795e0d1f8821fd5b49224cb47ae66f9ae3c58fa66db5ea9f73d7b741939048a242e91224f98daf0641e8a8ff19b58fb8c49b1a5abb059f44249dfd611515115a144cc7c2ca29357af46a9dc1800ae9330778ff1b7a8e45321147453cf17ef3a2111ad33bfeba2b62a047fa6a7af0eef', 'e': '0x10001', 'ct': '0x55cfe232610aa54dffcfb346117f0a38c77a33a2c67addf7a0368c93ec5c3e1baec9d3fe35a123960edc2cbdc238f332507b044d5dee1110f49311efc55a2efd3cf041bfb27130c2266e8dc61e5b99f275665823f584bc6139be4c153cdcf153bf4247fb3f57283a53e8733f982d790a74e99a5b10429012bc865296f0d4f408f65ee02cf41879543460ffc79e84615cc2515ce9ba20fe5992b427e0bbec6681911a9e6c6bbc3ca36c9eb8923ef333fb7e02e82c7bfb65b80710d78372a55432a1442d75cad5b562209bed4f85245f0157a09ce10718bbcef2b294dffb3f00a5a804ed7ba4fb680eea86e366e4f0b0a6d804e61a3b9d57afb92ecb147a769874'} -{'n': '0xa96e6f96f6aedd5f9f6a169229f11b6fab589bf6361c5268f8217b7fad96708cfbee7857573ac606d7569b44b02afcfcfdd93c21838af933366de22a6116a2a3dee1c0015457c4935991d97014804d3d3e0d2be03ad42f675f20f41ea2afbb70c0e2a79b49789131c2f28fe8214b4506db353a9a8093dc7779ec847c2bea690e653d388e2faff459e24738cd3659d9ede795e0d1f8821fd5b49224cb47ae66f9ae3c58fa66db5ea9f73d7b741939048a242e91224f98daf0641e8a8ff19b58fb8c49b1a5abb059f44249dfd611515115a144cc7c2ca29357af46a9dc1800ae9330778ff1b7a8e45321147453cf17ef3a2111ad33bfeba2b62a047fa6a7af0eef', 'e': '0x23', 'ct': '0x79834ce329453d3c4af06789e9dd654e43c16a85d8ba0dfa443aefe1ab4912a12a43b44f58f0b617662a459915e0c92a2429868a6b1d7aaaba500254c7eceba0a2df7144863f1889fab44122c9f355b74e3f357d17f0e693f261c0b9cefd07ca3d1b36563a8a8c985e211f9954ce07d4f75db40ce96feb6c91211a9ff9c0a21cad6c5090acf48bfd88042ad3c243850ad3afd6c33dd343c793c0fa2f98b4eabea399409c1966013a884368fc92310ebcb3be81d3702b936e7e883eeb94c2ebb0f9e5e6d3978c1f1f9c5a10e23a9d3252daac87f9bb748c961d3d361cc7dacb9da38ab8f2a1595d7a2eba5dce5abee659ad91a15b553d6e32d8118d1123859208'} \ No newline at end of file diff --git a/crypto/XMASSpirit/output b/crypto/XMASSpirit/output deleted file mode 100644 index 1c538ab..0000000 --- a/crypto/XMASSpirit/output +++ /dev/null @@ -1,11 +0,0 @@ -└─$ python test.py -n 0xa96e6f96f6aedd5f9f6a169229f11b6fab589bf6361c5268f8217b7fad96708cfbee7857573ac606d7569b44b02afcfcfdd93c21838af933366de22a6116a2a3dee1c0015457c4935991d97014804d3d3e0d2be03ad42f675f20f41ea2afbb70c0e2a79b49789131c2f28fe8214b4506db353a9a8093dc7779ec847c2bea690e653d388e2faff459e24738cd3659d9ede795e0d1f8821fd5b49224cb47ae66f9ae3c58fa66db5ea9f73d7b741939048a242e91224f98daf0641e8a8ff19b58fb8c49b1a5abb059f44249dfd611515115a144cc7c2ca29357af46a9dc1800ae9330778ff1b7a8e45321147453cf17ef3a2111ad33bfeba2b62a047fa6a7af0eef -e1 0x10001 -e2 0x23 -ct1 0x55cfe232610aa54dffcfb346117f0a38c77a33a2c67addf7a0368c93ec5c3e1baec9d3fe35a123960edc2cbdc238f332507b044d5dee1110f49311efc55a2efd3cf041bfb27130c2266e8dc61e5b99f275665823f584bc6139be4c153cdcf153bf4247fb3f57283a53e8733f982d790a74e99a5b10429012bc865296f0d4f408f65ee02cf41879543460ffc79e84615cc2515ce9ba20fe5992b427e0bbec6681911a9e6c6bbc3ca36c9eb8923ef333fb7e02e82c7bfb65b80710d78372a55432a1442d75cad5b562209bed4f85245f0157a09ce10718bbcef2b294dffb3f00a5a804ed7ba4fb680eea86e366e4f0b0a6d804e61a3b9d57afb92ecb147a769874 -ct2 0x79834ce329453d3c4af06789e9dd654e43c16a85d8ba0dfa443aefe1ab4912a12a43b44f58f0b617662a459915e0c92a2429868a6b1d7aaaba500254c7eceba0a2df7144863f1889fab44122c9f355b74e3f357d17f0e693f261c0b9cefd07ca3d1b36563a8a8c985e211f9954ce07d4f75db40ce96feb6c91211a9ff9c0a21cad6c5090acf48bfd88042ad3c243850ad3afd6c33dd343c793c0fa2f98b4eabea399409c1966013a884368fc92310ebcb3be81d3702b936e7e883eeb94c2ebb0f9e5e6d3978c1f1f9c5a10e23a9d3252daac87f9bb748c961d3d361cc7dacb9da38ab8f2a1595d7a2eba5dce5abee659ad91a15b553d6e32d8118d1123859208 -21388731509885000178627064516258054470260331371598943108291856742436111736828979864010924669228672392691259110152052179841234423220373839350729519449867096270377366080249815393746878871366061153796079471618562067885157333408378773203102328726963273544788844541658368239189745882391132838451159906995037703318134437625750463265571575001855682002307507556141914223053440116920635522540306152978955166077383503077296996797116492665606386925464305499727852298454712455680910133707466125522128546462287576144499756117801116464261543533542827392699481765864054797509983998681705356909524163419157085924159390221747612487407 -10832767136661619622293208748444962392355211301390434120939858183061348121126484914263671262032603875084667844823015664447375648718327494489656817860025737727356822703892293211022320699697919627907394583787345038714333739600698382532854618636094930253033489471351451429607353151015568123268427367950348329135569722792929241394325167453525160818746481257803112384890621897151307914147207385945644054978785846514561379487923125221730977998641404608153621221989242862072038048891093337039913905830269768414927334743978508494831586214464123847828971941221037875260516473982025116976142753481691811417555124564400023181428 -15339581512280546253022387613330506135473528946217386214104392886174532962135139018179028980415602501799731665623533337161466343141774695260798342966907592969192136730428838101668117599627074424456369362732331025534652310626217911372168741784410233370188819015541694457313359727564553135243865091813543574169503409997765186767976316668351998243685484183615633052413572395870658899189135714137152486690320920884963915388873421509027812888500063744545503640233833759600980489533968220839778372130766115290961393758948141655306677776381429819578626575875511596616706688649422193432129579216085481063417748767088461582856 -65537 -35 -[+] Started attack... -[+] Attack finished! - -Plaintext message: -HTB{c0mm0n_m0d_4774ck_15_4n07h3r_cl4ss1c} diff --git a/forensics/honeypot/README.md b/forensics/honeypot/README.md index 37d59db..250e8e5 100644 --- a/forensics/honeypot/README.md +++ b/forensics/honeypot/README.md @@ -101,5 +101,4 @@ for ip in ${list[@]}; do done ``` - - I don't know, maybe the challenge is borked somehow?