Legacy challenges from the US Navy Cyber Competition Team 2019 Assessment sponsored by US TENTH Fleet
CCT2019 - pcap1
This is a pcap-focused challenge originally created for the U.S. Navy Cyber Competition Team 2019 Assessment. Although the assessment is over, the created challenges are provided for community consumption here.
If you find the right clues, they will guide you to the next step. I did include some red herrings in this challenge, but you can stay on track by focusing on pcap-related skills.
HINT1: It's a pcap challenge. If you're doing stego or re, you're either down a rabbit hole or there's an easier way.
HINT2: It is very important to do the first step correctly. If you don't recover the first file in its entirety, you may not be able to complete steps later on in the challenge. The second pcap file has 4588 packets in it. Contact me on Discord (send a DM to username zoobah) if you are struggling with this step.
HINT3: On the final step, this was built to run in a amd64 Kali Linux environment. If you are using a different Linux distro, you may run into some problems. Answer the questions below
Find the flag.
CCT2019 - re3
Download Task Files
There's some kind of a high security lock blocking the way. Defeat the GUI to claim your key!
NOTE: The key is a 32-character hex blob and doesn't follow the CCT{.*} format. It'll be apparent when you've found it.
If you need a Windows machine to help reverse engineering this, please use the Windows base room.
Answer the questions below
What is the key to re3? (Hey, that rhymes)
3...
CCT2019 - for1
Download Task Files
UPDATE: There was a bug found in cryptii that has now been fixed, but will cause issues on the final step of the challenge. For now, when you find the the cipher text FSXL PXTH EKYT DJXS PYMO JLAY VPRP VO, replace it with this cipher text instead: JHSL PGLW YSQO DQVL PFAO TPCY KPUD TF. Everything else at that step, e.g., the configuration file can remain as-is. I intend to update the challenge file to correct this issue, but this will serve as a temporary fix until that time.
Our former employee Ed is suspected of suspicious activity. We found this image on his work desktop and we believe it is something worth analyzing. Can you assist us in extracting any information of value?
HINT1: if you're not sure if a password is upper- or lower-case, try all lower-case.
HINT2: There are many steps that can be done concurrently in this challenge. If you find you need something, you may have not found the key to unlock it yet. If you have something useful and you're not sure where to use it, it's possible the file you need is still hidden somewhere.
HINT3: https://cryptii.com/ - Cool website, bro
HINT4: the flag will follow the format CCT{.*}
Answer the questions below
What is the flag?
CCT{...}
CCT2019 - crypto1
Download Task Files
Find ye some flags. There are three parts to this challenge, each with its own flag. Solve crypto1a obtain the crypto1a flag and to unlock crypto1b. Solve crypto1b to obtain the crypto1b flag and unlock crypto1c. Solve crypto1c and you'll have all three flags.
HINT1: crypto1a and crypto1b can be solved with freely available online tools
HINT2: For crypto1c, you probably have to code a solution to solve it as I'm not aware of any online tools for this variant. It's not complex to solve if you can figure out the scheme and it is possible to solve by hand although it could be a bit tedious.
┌──(witty㉿kali)-[~/Downloads]
└─$ mkdir CCT2019
┌──(witty㉿kali)-[~/Downloads]
└─$ mv for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8 CCT2019
┌──(witty㉿kali)-[~/Downloads]
└─$ cd CCT2019
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ ls
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ file for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8: JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=6, xresolution=86, yresolution=94, resolutionunit=2], baseline, precision 8, 514x480, components 3
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ pip3 install stegoveritas
──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ export PATH="$PATH:/home/witty/.local/bin"
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ exiftool for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8
ExifTool Version Number : 12.55
File Name : for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8
Directory : .
File Size : 30 kB
File Modification Date/Time : 2023:02:18 13:36:38-05:00
File Access Date/Time : 2023:02:18 13:37:13-05:00
File Inode Change Date/Time : 2023:02:18 13:37:05-05:00
File Permissions : -rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.01
Exif Byte Order : Big-endian (Motorola, MM)
X Resolution : 96
Y Resolution : 96
Resolution Unit : inches
Artist : Ed
Y Cb Cr Positioning : Centered
Copyright : CCT 2019
XMP Toolkit : Image::ExifTool 11.16
Description : .--- ..- ... - .- .-- .- .-. -- ..- .--. .-. .. --. .... - ..--..
Author : Ed
Image Width : 514
Image Height : 480
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Image Size : 514x480
Megapixels : 0.247
The code you provided is in Morse code and translates to "JUSTAWARMUPRIGHT?"
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ stegoveritas for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8
ERROR:StegoVeritas:Missing the following required packages: foremost, libexempi3
ERROR:StegoVeritas:Either install them manually or run 'stegoveritas_install_deps'.
Running Module: SVImage
+------------------+------+
| Image Format | Mode |
+------------------+------+
| JPEG (ISO 10918) | RGB |
+------------------+------+
Trailing Data Discovered... Saving
b'PK\x03\x04\x14\x00\t\x00\x08\x00\x91e\xe6N\x0c8H]\x9f\x00\x00\x00\xbd\x00\x00\x00\x0c\x00\x1c\x00fakeflag.txtUT\t\x00\x03\xf2\xcf ]\x16\xd0 ]ux\x0b\x00\x01\x04\x00\x00\x00\x00\x04\x00\x00\x00\x00B\xd1b=s\xdb\xff\xf6&\xe6 A\x83\x10\xc3\xf1\xa4\xb9\x0c,\xdacb\xd3G\xe99\xcd\xc5\xee\xbd\xd7\xf7\xe7D*\xc3\x8eG\xf2"\x1b)\r\xc5\xd8\xf7)\xff\xabJn\x1d\xdd\xd4QR\x11A\xf2Ne\x87{pyu\x91\x18H\xd3m=\x96h[l\x85WW6d\x84\xcd\xd7ox\xcf`\xeb\x05\xe7\xd2\x06K\xc8\xf1JX\x96;\xbf$u\x1a@&\x84\r\xed\xd0{\xd7q\xda\x1c\xf59&\x1e \xdf\x0b"\rqV\x1d\xea\xa1?\x86\x8e\x08G\x9a\xd0\xb1i\x85\x85?[\x1d\xa7\xd7\xe2.\xa1w\x84\x07\n3\x84\xc1\xbfgkPK\x07\x08\x0c8H]\x9f\x00\x00\x00\xbd\x00\x00\x00PK\x01\x02\x1e\x03\x14\x00\t\x00\x08\x00\x91e\xe6N\x0c8H]\x9f\x00\x00\x00\xbd\x00\x00\x00\x0c\x00\x18\x00\x00\x00\x00\x00\x01\x00\x00\x00\xa4\x81\x00\x00\x00\x00fakeflag.txtUT\x05\x00\x03\xf2\xcf ]ux\x0b\x00\x01\x04\x00\x00\x00\x00\x04\x00\x00\x00\x00PK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00R\x00\x00\x00\xf5\x00\x00\x00\x00\x00'
Running Module: MultiHandler
Found something worth keeping!
JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=6, xresolution=86, yresolution=94, resolutionunit=2], baseline, precision 8, 514x480, components 3
+--------+------------------+------------------------------------------------------------------------------------------------------------------------+--------------+
| Offset | Carved/Extracted | Description | File Name |
+--------+------------------+------------------------------------------------------------------------------------------------------------------------+--------------+
| 0x7212 | Carved | Zip archive data, encrypted at least v2.0 to extract, compressed size: 159, uncompressed size: 189, name: fakeflag.txt | 7212.zip |
| 0x7212 | Extracted | Zip archive data, encrypted at least v2.0 to extract, compressed size: 159, uncompressed size: 189, name: fakeflag.txt | fakeflag.txt |
+--------+------------------+------------------------------------------------------------------------------------------------------------------------+--------------+
Traceback (most recent call last):
File "/home/witty/.local/bin/stegoveritas", line 8, in <module>
sys.exit(main())
File "/home/witty/.local/lib/python3.10/site-packages/stegoveritas/stegoveritas.py", line 270, in main
veritas.run()
File "/home/witty/.local/lib/python3.10/site-packages/stegoveritas/stegoveritas.py", line 53, in run
module.run()
File "/home/witty/.local/lib/python3.10/site-packages/stegoveritas/modules/__init__.py", line 30, in run
module = importlib.import_module('.analysis.' + f[:-3], module_base)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/witty/.local/lib/python3.10/site-packages/stegoveritas/modules/multi/analysis/xmp.py", line 8, in <module>
import libxmp.utils
File "/home/witty/.local/lib/python3.10/site-packages/libxmp/__init__.py", line 50, in <module>
from .core import XMPMeta, XMPIterator
File "/home/witty/.local/lib/python3.10/site-packages/libxmp/core.py", line 50, in <module>
from . import exempi as _cexempi
File "/home/witty/.local/lib/python3.10/site-packages/libxmp/exempi.py", line 69, in <module>
EXEMPI = _load_exempi()
File "/home/witty/.local/lib/python3.10/site-packages/libxmp/exempi.py", line 60, in _load_exempi
raise ExempiLoadError('Exempi library not found.')
libxmp.ExempiLoadError: Exempi library not found.
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ ls
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8 results
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cd results
┌──(witty㉿kali)-[~/Downloads/CCT2019/results]
└─$ ls
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_autocontrast.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_0.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_1.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_2.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_3.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_4.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_5.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_6.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Blue_7.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_blue_plane.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Edge-enhance_More.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Edge-enhance.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_-100.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_100.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_-25.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_25.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_-50.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_50.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_-75.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_enhance_sharpness_75.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_equalize.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Find_Edges.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_GaussianBlur.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_grayscale.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_0.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_1.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_2.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_3.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_4.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_5.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_6.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Green_7.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_green_plane.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_inverted.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Max.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Median.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Min.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Mode.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_0.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_1.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_2.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_3.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_4.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_5.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_6.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Red_7.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_red_plane.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Sharpen.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_Smooth.png
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8_solarized.png
keepers
trailing_data.bin
┌──(witty㉿kali)-[~/Downloads/CCT2019/results]
└─$ cd keepers
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ ls
1676745782.792027-d9acb94279093d34109c9f8509fda654 7212.zip fakeflag.txt
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ cat fakeflag.txt
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ cat -A fakeflag.txt
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ ls -lah
total 52K
drwxr-xr-x 2 witty witty 4.0K Feb 18 13:43 .
drwxr-xr-x 3 witty witty 12K Feb 18 13:42 ..
-rw-r--r-- 1 witty witty 29K Feb 18 13:43 1676745782.792027-d9acb94279093d34109c9f8509fda654
-rw-r--r-- 1 witty witty 349 Feb 18 13:43 7212.zip
-rw-r--r-- 1 witty witty 0 Jul 6 2019 fakeflag.txt
In results
0ni0n_0f_0bfu5c@ti0n
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ unzip 7212.zip
Archive: 7212.zip
[7212.zip] fakeflag.txt password: 0ni0n_0f_0bfu5c@ti0n
password incorrect--reenter: 0ni0n_0f_0bfu5c@ti0n
password incorrect--reenter: 0ni0n_0f_0bfu5c@ti0n
skipping: fakeflag.txt incorrect password
uhmm
let's try with morse code founded
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ unzip 7212.zip
Archive: 7212.zip
[7212.zip] fakeflag.txt password: justawarmupright?
replace fakeflag.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: fakeflag.txt
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ ls
7212.zip fakeflag.txt for1.jpg
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ cat fakeflag.txt
I didn't say it would be easy, Neo. Peer into the Matrix. See what others cannot and witness the truth. Though I caution that it may be more than what you expect.
- Morpheus
PW: Z10N0101
We get another password! `Z10N0101`, 0ni0n_0f_0bfu5c@ti0n and justawarmupright?
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ steghide extract -sf for1.jpg
Enter passphrase: Z10N0101
wrote extracted data to "archive.zip".
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ ls
7212.zip archive.zip fakeflag.txt for1.jpg
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ unzip archive.zip
Archive: archive.zip
[archive.zip] cipher.txt password: 0ni0n_0f_0bfu5c@ti0n
extracting: cipher.txt
inflating: config.txt
extracting: flag.zip
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ cat cipher.txt
FSXL PXTH EKYT DJXS PYMO JLAY VPRP VO
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ cat config.txt
C G. VI. VII. VIII. AMTU RING AM BY CH DR EL FX GO IV JN KU PS QT WZ
https://cryptii.com/
cipher.txt (Modified according to challenge description):
JHSL PGLW YSQO DQVL PFAO TPCY KPUD TF
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ unzip flag.zip
Archive: flag.zip
[flag.zip] flag.txt password:
skipping: flag.txt incorrect password
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ pip install py-enigma
Defaulting to user installation because normal site-packages is not writeable
Collecting py-enigma
Downloading py-enigma-0.1.tar.gz (36 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: py-enigma
Building wheel for py-enigma (setup.py) ... done
Created wheel for py-enigma: filename=py_enigma-0.1-py3-none-any.whl size=46861 sha256=6ae98a9ba41d352dadb1703b5bf4b4b808c37cc8b8e91466d12d19bbed66d4b8
Stored in directory: /home/witty/.cache/pip/wheels/32/00/f9/e331bdcf19eae1a077d8909308b7707f0fcfd1392a6ef66cb0
Successfully built py-enigma
Installing collected packages: py-enigma
Successfully installed py-enigma-0.1
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ python3 decrypt_enigma.py
ctfforensicsisnotrealforensics
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ cat decrypt_enigma.py
from enigma.machine import EnigmaMachine
import enigma.plugboard
enigma.plugboard.MAX_PAIRS=13
machine = EnigmaMachine.from_key_sheet(
rotors='Gamma VI VII VIII', # Appeared in file as "G. VI VII VIII".
reflector='C-Thin', # Appeared in file as 'C', I changed to Thin for better results.
ring_settings='R I N G', # Appeared in file as "XXXX"
plugboard_settings="AM BY CH DR EL FX GO IV JN KU PS QT WZ") # No changes from file.
machine.set_display('AMTU') # No changes from file.
ciphertext = 'JHSL PGLW YSQO DQVL PFAO TPCY KPUD TF'.replace(" ", "")
plaintext = machine.process_text(ciphertext)
print(plaintext.lower())
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ unzip flag.zip
Archive: flag.zip
[flag.zip] flag.txt password:
extracting: flag.txt
┌──(witty㉿kali)-[~/Downloads/CCT2019/results/keepers]
└─$ cat flag.txt
CCT{...}
Here's a detailed explanation of the code:
`from enigma.machine import EnigmaMachine import enigma.plugboard`
This imports the `EnigmaMachine` class and `enigma.plugboard` module from the `enigma` package.
`enigma.plugboard.MAX_PAIRS=13`
This sets the maximum number of plugboard pairs to 13. The plugboard is an optional component of the Enigma machine that allows the user to swap pairs of letters before encryption.
`machine = EnigmaMachine.from_key_sheet( rotors='Gamma VI VII VIII', # Appeared in file as "G. VI VII VIII". reflector='C-Thin', # Appeared in file as 'C', I changed to Thin for better results. ring_settings='R I N G', # Appeared in file as "XXXX" plugboard_settings="AM BY CH DR EL FX GO IV JN KU PS QT WZ") # No changes from file.`
This creates an `EnigmaMachine` object and sets its configuration using a `key sheet`. The key sheet is a string that specifies the rotor sequence, reflector, ring settings, and plugboard settings.
In this case, the rotor sequence is "Gamma VI VII VIII", the reflector is "C-Thin", the ring settings are "R I N G", and the plugboard settings are "AM BY CH DR EL FX GO IV JN KU PS QT WZ". Note that the comments indicate the original values from the file.
`machine.set_display('AMTU')`
This sets the machine's display to "AMTU". The display is the set of letters that are visible to the operator at any given time.
`ciphertext = 'JHSL PGLW YSQO DQVL PFAO TPCY KPUD TF'.replace(" ", "")`
This sets the ciphertext to "JHSLPGLWYSQODQVLPFAOTPCYKPUDTF", which is the same as the original ciphertext without spaces.
`plaintext = machine.process_text(ciphertext)`
This decrypts the ciphertext using the `process_text` method of the `EnigmaMachine` object and sets the plaintext to the result.
`print(plaintext.lower())`
This prints the decrypted plaintext in lowercase letters.
Thx ChatGPT
┌──(witty㉿kali)-[~/Downloads]
└─$ mv crypto1.zip CCT2019
┌──(witty㉿kali)-[~/Downloads]
└─$ cd CCT2019
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ ls
crypto1.zip
for18f90d68390b565c308871a52c6572de8.for1_8f90d68390b565c308871a52c6572de8
results
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cat crypto1a.txt
Ab .aof y.jdbc'g. urp ornkcbi Ja.oap ogxoycygycrb jcld.po ,cnn rbnf i.y frg or uap x.jago. ru lgbjygaycrb ofmxrnov Oycnnw cy odrgne i.y frg jnro. .brgid yr ucigp. rgy yd. p.oyv Xgy jab frg ucigp. rgy yd. t.f ,dcjd dall.bo yr x. yd. bam. ru yd. _nafrgy_ ,dcjd jp.ay.e ydcov Ajygannfw frg dae x.yy.p .by.p cy ydpcj. hgoy yr x. oau. (ann nr,.p[jao. cu frg ln.ao.)v
https://www.dcode.fr/keyboard-change-cipher
dvorak
qwerty
aN EASY TECHNIQUE FOR SOLVING cAESAR SUBSTITUTION CIPHERS WILL ONLY GET YOU SO FAR BECAUSE OF PUNCTUATION SYMBOLS> sTILL< IT SHOULD GET YOU CLOSE ENOUGH TO FIGURE OUT THE REST> bUT CAN YOU FIGURE OUT THE KEY WHICH HAPPENS TO BE THE NAME OF THE 'LAYOUT' WHICH CREATED THIS> aCTUALLY< YOU HAD BETTER ENTER IT THRICE JUST TO BE SAFE 9ALL LOWER_CASE IF YOU PLEASE0>
uhmm so change
> to .
< to ,
9 to (
0 o )
and switched the lower and upper cases
An easy technique for solving Caesar substitution ciphers will only get you so far because of punctuation symbols. Still, it should get you close enough to figure out the rest. But can you figure out the key which happens to be the name of the "layout" which created this. Actually, you had better enter it thrice just to be safe (all lower-case if you please).
three times so dvorakdvorakdvorak
let's see
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ unzip crypto1a.zip
Archive: crypto1a.zip
[crypto1a.zip] crypto1a_flag.txt password: dvorakdvorakdvorak
inflating: crypto1a_flag.txt
inflating: crypto1b.txt
inflating: crypto1b.zip
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cat crypto1a_flag.txt
Well, you made it. Not a particularly difficult challenge, but shows you know at least something about crypto.
For your troubles, here is your flag:
CCT{...}
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cat crypto1b.txt
A word of advice for the next one. Don't straddle the fence or you'll end up riding a rail or five. It'll hurt from the bottom up.
n h newuhe eddre nect tota ufyaolim7ter val lcy vsf slAroeeoiroigtatradetlno o pek ?Sl n aee s epeth atedpairu hsg?Hot oe.wygoelrfo 93aei alsw'e elntte l o.A eat o,b' by le frnsk,nt tes uv hl o ir lgHayairiteobbaam ibuohlm tursernuuohgteseoob srk spsrirt1 mdvoho'eI nmpiihi ainuetere susutpa .lwc dsa t t,iiorgoguhfecae r tcslhslayhn eseaftaeo peelsantnthu e,nwati Tetees ecfh ai ofCteb seisn eto potb hyli'rCtirbsx oaego'sbttamt u?Mingfh.e ev dac cfp c om hahh t enm t.esg f ut t oilso uhao
The Zigzag cipher is a transposition cipher where the plaintext is written diagonally rather than horizontally, making it more difficult to read. To decrypt it, the recipient must re-order the letters in the message so that they can read the original message. The zigzag pattern can be in any angle (e.g., vertical, horizontal, diagonal), and the depth of the zigzag can also vary.
Here is an example of a Zigzag cipher in action, using the message "HELLO WORLD" as plaintext and a zigzag depth of 4:
H . . . O . . . R . .
. E . L . W . L . D .
. . L . . . O . . . .
The ciphertext for this message would be "HOR.ELLWD.LO". To decrypt it, the recipient would re-order the letters according to the zigzag pattern and depth to reveal the original message.
https://www.dcode.fr/rail-fence-cipher
Keep punctuation and spaces
Key/Number number of rows/levels (height) 5
Start from Bottom (left)
No initial offset (recommended)
Use an offset of N characters, N=1
Decrypt Rail Fence
Moving·right·along·through·a·different·challenge.·How·are·you·at·ciphers·like·these?·Solvable·by·hand·and·made·easier·because·of·the·placement·of·the·upper·case·letters·and·punctuation·throughout·the·message,·no?·How·about·this·for·a·key.·The·way·the·goose·spells·terrific·from·the·1973·animated·movie·of·Charlotte's·web.·I've·seen·a·misspelling·in·the·title·of·a·clip·on·youtube.·At·the·very·least·it's·four·Cs,·but·it's·probably·six.·All·lower·case·for·goodness'·sake,·but·not·that·it·matters,·oui·oui?
or with a script
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ nano rail_decoder.py
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ python3 rail_decoder.py
Moving right along through a different challenge. How are you at ciphers like these? Solvable by hand and made easier because of the placement of the upper case letters and punctuation throughout the message, no? How about this for a key. The way the goose spells terrific from the 1973 animated movie of Charlotte's web. I've seen a misspelling in the title of a clip on youtube. At the very least it's four Cs, but it's probably six. All lower case for goodness' sake, but not that it matters, oui oui?
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cat rail_decoder.py
enc = "n h newuhe eddre nect tota ufyaolim7ter val lcy vsf slAroeeoiroigtatradetlno o pek ?Sl n aee s epeth atedpairu hsg?Hot oe.wygoelrfo 93aei alsw'e elntte l o.A eat o,b' by le frnsk,nt tes uv hl o ir lgHayairiteobbaam ibuohlm tursernuuohgteseoob srk spsrirt1 mdvoho'eI nmpiihi ainuetere susutpa .lwc dsa t t,iiorgoguhfecae r tcslhslayhn eseaftaeo peelsantnthu e,nwati Tetees ecfh ai ofCteb seisn eto potb hyli'rCtirbsx oaego'sbttamt u?Mingfh.e ev dac cfp c om hahh t enm t.esg f ut t oilso uhao"
rails = 5
offset = rails-1
def railNumber(position, rails, offset):
position = (position + offset) % (rails * 2 - 2)
if (position < rails):
return position
else:
return 2*rails-position-2
def decrypt(enc, rails, offset):
result = ['+'] * len(enc)
k = 0
for i in range(rails):
for j in range(len(enc)):
if (railNumber(j, rails, offset) == i):
result[j] = enc[k]
k+=1
return "".join(result)
print(decrypt(enc,rails,offset))
This script is an implementation of the rail fence cipher, a simple transposition cipher that rearranges the letters of a message in a zigzag pattern across multiple lines.
Here is a step-by-step explanation of how the script works:
1. A message to be encrypted is stored in the variable `enc`.
2. The number of rails (lines) used for the cipher is set to 5, and the offset (the difference between the number of rails and 1) is calculated.
3. The `railNumber` function calculates the rail number for a given position in the ciphertext. It takes the position, number of rails, and offset as arguments, and uses modular arithmetic to determine the rail number based on the position.
4. The `decrypt` function takes the ciphertext, number of rails, and offset as arguments. It creates a list `result` containing a `+` symbol for each character in the ciphertext. It then iterates over each rail, and for each rail, iterates over each character in the ciphertext. If the character's rail number matches the current rail, it is added to the `result` list. Finally, the `result` list is converted to a string and returned as the decrypted plaintext.
5. The decrypted plaintext is printed to the console.
The rail fence cipher is a relatively weak cipher and can be easily broken by cryptanalysis. It is mainly used as a fun and easy exercise in cryptography.
google it
Charlotte : You're terrific, as far as I am concerned. Charlotte : [after glaring at Templeton] And does anybody know how to spell it? Goose : I think it's **T, double-E, double-R, double-R, double-I, double-F, double-I, double-C, C, C**!
https://www.youtube.com/watch?v=Xf5a_F-zNgE&t=71s
so teerrrriiffiicccc
but it's probably six.
so the pass is teerrrriiffiicccccc
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ unzip crypto1b.zip
Archive: crypto1b.zip
[crypto1b.zip] crypto1b_flag.txt password: teerrrriiffiicccccc
extracting: crypto1b_flag.txt
inflating: crypto1c.txt
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cat crypto1b_flag.txt
CCT{...}
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cat crypto1c.txt
Last one of the basic batch. But is it compression, encoding, or encryption?
11122112141311112123131222211121621211124112213221112162112113114163113211421121132221622222411321311331611221121413111121231312222111216322121412123312222111122141624112123212416214122231631132114221112162321321242113531132142162321211424112123212322111121322231221111322216222232122141212112163113211422111216231224113221211211232216231224113113232121151124162312311111311416311321142211113212221112162411321222111216212111214132122211121623212114241121232123221111213222312211113222162411211422111124112214113316121421413132163131211211212321241642112141311112162222241132122211121624112231241121121121323221311416311321142141322122111216121212163131214121322213221111321311331615113114162411213242121632122411311322111211241631312211112123212416221321412132221112162411213222141621142211113212221112162112113222164211214131111132131622222123241122323113161421142111111341211212111151322122111122111111512213221111241122131151232121121135211422111132123221115124112123212311513113211422111111513113211211212111221111511
HINT3: For crypto1c, start with "0" not "1".
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ file crypto1c.txt
crypto1c.txt: ASCII text, with very long lines (1022), with CRLF line terminators
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ pip install pycrypto
seems to start wih 0 and 2 will be 11 and interleaving numbers like 021 will be 0110
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ pip install pycryptodome
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ python3 crypt1c.py
0101100101101111011101010010011101110110011001010010000001101101011000010110010001100101001000000110100101110100001000000111010001101000011010010111001100100000011001100110000101110010001011100010000001011001011011110111010100100111011101100110010100100000011100110110111101101100011101100110010101100100001000000110000101101100011011000010000001101111011001100010000001110100011010000110010100100000011000110111001001111001011100000111010001101111001000000110001101101000011000010110110001101100011001010110111001100111011001010111001100100000011001100111001001101111011011010010000001110100011010000110010100100000011000100110000101110011011010010110001100100000011000100110000101110100011000110110100000101100001000000110001001110101011101000010000001110100011010000110010101110010011001010010000001100001011100100110010100100000011011010110111101110010011001010010000001100011011010000110000101101100011011000110010101101110011001110110010101110011001000000110000101101000011001010110000101100100001011100010000001001000011011110111011100100000011101110110100101101100011011000010000001111001011011110111010100100000011001100110000101110010011001010010000001100001011001110110000101101001011011100111001101110100001000000111010001101000011011110111001101100101001000000100100100100000011101110110111101101110011001000110010101110010001011100010000001000001011101000010000001100001011011100111100100100000011100100110000101110100011001010010110000100000011101110110010101101100011011000010000001100100011011110110111001100101001000000110000101101110011001000010000001101000011001010111001001100101001000000110100101110011001000000111100101101111011101010111001000100000011001100110110001100001011001110011101000100000010000110100001101010100011110110100100101011111011100110110010101100101010111110110010001100101011000010110010001011111011000110110100101110000011010000110010101110010011100110101111101100001011011000110110001011111011101000110100001100101010111110111010001101001011011010110010101111101
You've made it this far. You've solved all of the crypto challenges from the basic batch, but there are more challenges ahead. How will you fare against those I wonder. At any rate, well done and here is your flag: CCT{....}
┌──(witty㉿kali)-[~/Downloads/CCT2019]
└─$ cat crypt1c.py
from Crypto.Util.number import long_to_bytes
enc = "11122112141311112123131222211121621211124112213221112162112113114163113211421121132221622222411321311331611221121413111121231312222111216322121412123312222111122141624112123212416214122231631132114221112162321321242113531132142162321211424112123212322111121322231221111322216222232122141212112163113211422111216231224113221211211232216231224113113232121151124162312311111311416311321142211113212221112162411321222111216212111214132122211121623212114241121232123221111213222312211113222162411211422111124112214113316121421413132163131211211212321241642112141311112162222241132122211121624112231241121121121323221311416311321142141322122111216121212163131214121322213221111321311331615113114162411213242121632122411311322111211241631312211112123212416221321412132221112162411213222141621142211113212221112162112113222164211214131111132131622222123241122323113161421142111111341211212111151322122111122111111512213221111241122131151232121121135211422111132123221115124112123212311513113211422111111513113211211212111221111511"
result = ""
for i in range(len(enc)):
binary = '0' if i % 2 == 0 else '1'
result+=binary*int(enc[i])
print(result)
flag = long_to_bytes(int(result, 2)).decode("ASCII") # binary to string.
print(flag)
The code you provided takes an encoded message in the variable `enc`, and decodes it using a simple interleave encoding scheme.
In the `for` loop, it iterates over each character in `enc`. For each character, it checks if the index is even or odd using the expression `i % 2 == 0`. If the index is even, it sets `binary` to `'0'`, otherwise it sets it to `'1'`. Then, it multiplies the value of the character by the value of `binary` and appends that many `0`s or `1`s to the `result` variable.
After the loop completes, the `result` variable contains a sequence of `0`s and `1`s that represent the decoded message. The code then converts this binary string to ASCII using the `long_to_bytes` function and prints the decoded message to the console.