Python
Programming & Scripting
29 posts from HNF26 and picoCTF
HNF26 - 13
The challenge provided an encoded text block along with a short hint: i do a rotate and some 2 Ciphertext: The title “13” and the phrase “i do a rotate and some 2^6” pointed directly to ...
HNF26 - DISKLOCK
The challenge provided three files: DISKLOCK.LOG DISKLOCK.TXT PHOTO.LCK I checked DISKLOCK.LOG first to see what the program had done. According to the log, DISKLOCK v1.0 had encrypted PHOTO.BMP as PHOTO.LCK, then deleted the original image.
HNF26 - Moving Schools
The challenge description said the author was moving to another CTF and had found this flag there: The flag started with SMU26 instead of HNF26, and the text inside the braces looked ...
HNF26 - Textbook Perfect
The challenge provided an RSA modulus n, a public exponent e, and a ciphertext c: The small public exponent, e = 3, made me check whether a cube root attack would work ...
HNF26 - Twice-Used Page
The challenge provided a file named tapes.txt containing two hexadecimal ciphertexts: The challenge title and the two ciphertexts pointed to a classic One-Time Pad (OTP) key reuse ...
HNF26 - The Custodian's Cadence
The challenge hosted a network service on port 2323 with the following description: The custodian of retro-01 still logs in at odd hours. The machine is long gone, but the feed is live.
HNF26 - Forgotten Page
I visited the target website at http://10.10.10.10:8009, but the homepage only displayed the text “Find Me”: With nothing else visible on the page, I checked the challenge description ...
like1000
The challenge description implies that we will probably have to extract the contents of the provided tar file repeatedly until we finally find a flag.
Custom encryption
In this challenge, we will attempt to decode the contents of the given file that has been encrypted with a Python script. We first begin by downloading the 2 files, enc_flag and custom_encryption.py, by running wget <link1> <link2>.
endianness-v2
Welcome to another challenge about endianness. I have done a challenge related to Big-Endian and Little-Endian systems before, which you can check out here: endianness Without further ado, let’s dive into this challenge.
PW Crack 5
This is the final challenge of the “PW Crack” challenge series. What a journey it has been! In this challenge, we will be cracking a password using a dictionary attack, which is a brute-force approach.
PW Crack 4
The 4th addition to the “PW Crack” challenge series! How exciting! Check out the previous challenges if you’re interested: PW Crack 1 PW Crack 2 PW Crack 3 In this challenge, we are provided ...
PW Crack 3
Another challenge in the “PW Crack” series! Check out the previous 2 challenges in this series too: PW Crack 1 PW Crack 2 We first download the 3 challenge files using wget <link1> ...
Serpentine
This is a challenge involving a Python script. We will likely have to manipulate the script to display the flag in this challenge. We first download the provided script using wget <link>.
Codebook
Let’s first download the 2 files provided using wget <link1> <link2>. With reference to the challenge description, we are supposed to follow instructions given and run the script code.py in the same directory as the codebook.txt file.
convertme.py
Alright, our task is to convert a number from decimal to binary, pretty simple! There are many ways to do this. First, we download the Python script convertme.py (using wget), and ran nano immediately to examine the code.
fixme1.py
Alright, it looks like we just have to fix 1 simple syntax error to allow the flag to be printed successfully. Let’s download the challenge file using wget <link> and check for the syntax error.
fixme2.py
In this challenge, we are tasked to fix a single syntax error in the provided Python script. This challenge is highly similar to fixme1.py. As mentioned in fixme1.py, when we run a python file, errors (if any) will be printed in the terminal, specifying the type of error and the line number in which the error occurs.
Python Wrangling
We first download the 3 challenge files, ende.py, pw.txt and flag.txt.en by running wget. I also tried to display the contents of pw.txt and flag.txt.en.
runme.py
Alright, seems like we are given instructions on how we can solve this challenge. We shall check it out. First, we download the python script using wget <link>.
PW Crack 2
This challenge approach is really similar to that of the PW Crack 1 challenge. We just have to input the correct password and we get our flag. There is only a minor modification in this challenge compared to the previous one.
PW Crack 1
Currently, all we know is that we are provided with a password checker file and an encrypted flag file which we can download with wget <link>. Perhaps we need to decrypt the flag and submit it as a password in the password checker? When I tried to cat the encrypted flag, all I got was gibberish.
WhitePages
This challenge was pretty interesting when I tried it, as I’ve never encountered a “blank” .txt file before. As per normal, we first download the provided file by using wget <link> to understand what we’re dealing with.
Tapping
Both the description and the hint imply that the flag we are looking for in this challenge is most likely encoded using morse code. In fact, this made me recall the morse-code challenge where the challenge was to decode morse code (.wav file).
New Caesar
As the name suggests, this challenge revolves around the concept of the caesar cipher. The downloaded file, new_caesar.py is used to encrypt the flag, and the encrypted flag is given in the challenge description: The following is how the encryption script, new_caesar.py looks like.
spelling-quiz
This is, once again, a challenge involving substitution ciphers. We begin by downloading the given file and seeing its contents. After downloading the file using wget <link>, we realise that it is a zip file.
basic-mod2
This challenge is similar to the previous challenge, basic-mod1, but instead of calculating the modulus of each number, we need to calculate the modular inverse ...
basic-mod1
The approach for this challenge was already provided in the description, so we can just follow that. After downloading the file using wget, and running cat message.txt, we get this string of numbers: I used a python script to decrypt the message above in order to get the flag.
The Numbers
Seems like an interesting challenge. The downloaded file looks like this. Now, this is surprising. All the previous challenges have had the same flag format of picoCTF{...}.