Compare commits
No commits in common. "3eb81a5127e82a73f9d344cdbbcf42cff02aa6e0" and "bca790cd152e24afe8f864748029dfd276baa19e" have entirely different histories.
3eb81a5127
...
bca790cd15
@ -8,11 +8,3 @@ The folder name is the challenge id, as found in the URL (<https://play.picoctf.
|
|||||||
Inside the folder there is an `inputs` subfolder which just includes all the files from the challenge description.
|
Inside the folder there is an `inputs` subfolder which just includes all the files from the challenge description.
|
||||||
|
|
||||||
Executing `nix run .#CHALLENGE_ID` runs the challenge.
|
Executing `nix run .#CHALLENGE_ID` runs the challenge.
|
||||||
|
|
||||||
## 156 - "Nice netcat..."
|
|
||||||
|
|
||||||
```txt
|
|
||||||
nc mercury.picoctf.net 49039
|
|
||||||
```
|
|
||||||
|
|
||||||
Output is in ASCII. Convert to text.
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
gAAAAABgUAIV8D5MJdzgLLTkkMlbU84ARVwfX4brMt2rJQCjkpLItytfWVZe1L2dp4K8VrKgRU3axStKJEAqcM0iDaxiYE54Boh8UfAAo1RNifKnlDrFz0gLaznVSFVj2xAUa4V35180
|
|
@ -1 +0,0 @@
|
|||||||
68f88f9368f88f9368f88f9368f88f93
|
|
@ -1,60 +0,0 @@
|
|||||||
|
|
||||||
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'.")
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
|||||||
packages.${system} = forAllExercises (
|
packages.${system} = forAllExercises (
|
||||||
exercise:
|
exercise:
|
||||||
pkgs.writers.writePython3Bin "picoCTF_${exercise}" {
|
pkgs.writers.writePython3Bin "picoCTF_${exercise}" {
|
||||||
libraries = with pkgs.python3.pkgs; [cryptography];
|
#libraries = with pkgs.python3.pkgs; [requests];
|
||||||
} "${builtins.readFile ./exercises/${exercise}/main.py}"
|
} "${builtins.readFile ./exercises/${exercise}/main.py}"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user