commit c9764c3f185acf93e22ec0ae255c4151b1d4c217 Author: Maxime Vorwerk Date: Wed Jun 5 15:28:09 2024 +0200 3 first challenges diff --git a/mod_26/flag b/mod_26/flag new file mode 100644 index 0000000..d35e40f --- /dev/null +++ b/mod_26/flag @@ -0,0 +1 @@ +cvpbPGS{arkg_gvzr_V'yy_gel_2_ebhaqf_bs_ebg13_hyLicInt} diff --git a/mod_26/sol.py b/mod_26/sol.py new file mode 100755 index 0000000..732c347 --- /dev/null +++ b/mod_26/sol.py @@ -0,0 +1,19 @@ +#!/usr/bin/python + +def rot13(char): + c = ord(char) + A = ord('A') + Z = ord('Z') + a = ord('a') + z = ord('z') + if c >= A and c <= Z: + char = chr((c-A+13)%(Z-A+1)+A) + elif c >= a and c <= z: + char = chr((c-a+13)%(z-a+1)+a) + print(char, end='') + +with open("flag", "r") as f: + flag = f.read() + for char in flag: + rot13(char) + diff --git a/obedient_cat/flag b/obedient_cat/flag new file mode 100755 index 0000000..7f225d7 --- /dev/null +++ b/obedient_cat/flag @@ -0,0 +1 @@ +picoCTF{s4n1ty_v3r1f13d_2fd6ed29} diff --git a/python_wrangling/ende.py b/python_wrangling/ende.py new file mode 100755 index 0000000..6cd4565 --- /dev/null +++ b/python_wrangling/ende.py @@ -0,0 +1,61 @@ +#!/usr/bin/python + +import sys +import base64 +from cryptography.fernet import Fernet + + + +usage_msg = "Usage: "+ sys.argv[0] +" (-e/-d) [file]" +help_msg = usage_msg + "\n" +\ + "Examples:\n" +\ + " To decrypt a file named 'pole.txt', do: " +\ + "'$ python "+ sys.argv[0] +" -d pole.txt'\n" + + + +if len(sys.argv) < 2 or len(sys.argv) > 4: + print(usage_msg) + sys.exit(1) + + + +if sys.argv[1] == "-e": + if len(sys.argv) < 4: + sim_sala_bim = input("Please enter the password:") + else: + sim_sala_bim = sys.argv[3] + + ssb_b64 = base64.b64encode(sim_sala_bim.encode()) + c = Fernet(ssb_b64) + + with open(sys.argv[2], "rb") as f: + data = f.read() + data_c = c.encrypt(data) + sys.stdout.write(data_c.decode()) + + +elif sys.argv[1] == "-d": + if len(sys.argv) < 4: + sim_sala_bim = input("Please enter the password:") + else: + sim_sala_bim = sys.argv[3] + + ssb_b64 = base64.b64encode(sim_sala_bim.encode()) + c = Fernet(ssb_b64) + + with open(sys.argv[2], "r") as f: + data = f.read() + data_c = c.decrypt(data.encode()) + sys.stdout.buffer.write(data_c) + + +elif sys.argv[1] == "-h" or sys.argv[1] == "--help": + print(help_msg) + sys.exit(1) + + +else: + print("Unrecognized first argument: "+ sys.argv[1]) + print("Please use '-e', '-d', or '-h'.") + diff --git a/python_wrangling/flag.txt.en b/python_wrangling/flag.txt.en new file mode 100755 index 0000000..271a96d --- /dev/null +++ b/python_wrangling/flag.txt.en @@ -0,0 +1 @@ +gAAAAABgUAIWIvSiR0W23DAHIK5DX6Y4BvwES94M_XdDcNAquhp-A0D2z8n812YEXaSD9WhoweBh2cm5Wa0cqzuW0Kc7fOct0OJnpOmVF8A91j0Hx4dKtvk3l5ghPT71Y7GxErPRyJUs \ No newline at end of file diff --git a/python_wrangling/out b/python_wrangling/out new file mode 100644 index 0000000..69afa86 --- /dev/null +++ b/python_wrangling/out @@ -0,0 +1,2 @@ +Please enter the password: +picoCTF{4p0110_1n_7h3_h0us3_ac9bd0ff} diff --git a/python_wrangling/pw.txt b/python_wrangling/pw.txt new file mode 100755 index 0000000..c3a0824 --- /dev/null +++ b/python_wrangling/pw.txt @@ -0,0 +1 @@ +ac9bd0ffac9bd0ffac9bd0ffac9bd0ff