Ayubowan 🙏🏾, my name is Asanka

Cover

*NOTICE*

I am discontinuing my Blogger blog in favour of the modern and up to date Hashnode blog. Please find me there moving forward. Refer to this article for more information:
 
🤔 Knowing how to code makes you look at the world from a different perspective 🌏. That's why I'm so passionate about coding. Hello World 👋; welcome to my Blog 🚧. I'm still a student and am 23 years of age, so there's a long journey ahead of me 🙆. I like to dream 💬 big and to see other peoples dreams come true. I'm a tech nerd 🐱‍💻 and a coding enthusiast. Hope you might find me amusing.🤩

  “It is man that ends, but his works can endure.” - The Watchmakers Apprentice

facebook github instagram twitter linkedin YouTube Deviant Pinterest

Catch me on Fiverr        Learn more

03. Python Wrangling - PicoCTF 2021 Writeup

 

Python Wrangling

Category: General Skills | Author: Syreal | Points: 10


Hello All 👋,

This can be a bit tricky especially if you don't know much about python programming. If you don't, download and install python and mess around with it a bit. If you already know how to move around a bit, go ahead and download all three files given.

There are three files: the 'ende.py' is obviously a python script file, the other two turn out to be plain text files if we open them with notepad. We will first open the python script.

You will notice that running it on the python interpreter will not give any output. This is because this is a python module. To run this, we will first open the command prompt or the terminal. Our first task will be to move to the place where the files were downloaded.

cd Downloads

Once we're in the right folder, we will run the python script using python.

python ende.py

If Python is installed correctly, we should get an error as follows.

Usage: ende.py (-e/-d) [file]

This is good because we now know how to open this file! So the name of the script file should be followed by -e or -d and then the name of the file. In this case the encrypted file. As a side note, -e means encrypt while -d means to decrypt. Since we need decrypting we will use -d.

So we will try again with the correct parameters. 'pw.txt' has 'pw' in it while the other one has a '.en' extension to it. So we can assume that 'pw.txt' contains the key while the other one is the actual file to decrypt. Entering the following code actually executes the command this time.

python ende.py -d flag.txt.en

Now it asks for a password, which we will provide from the 'pw.txt' file. Now you might get an error like 'cryptography is not identified'. This is because you don't have the cryptography library installed. Use the following command to install it.

pip install cryptography

Once you have it successfully installed, you can run that command again and it will output the flag! Either way congratulations, you just completed the challenge!

Comments