So I just recently started having interest and playing CTF's on OverTheWire website and I am still in the first challenge called the bandit Lvl5 if you'll consider looking at it. So it teaches the use of linux command line etc
So here on this challenge I am tasked that there are hidden files in home directory I have to find them and in one of those files I will find a password to go to the next level taking note the are over 20 hidden files that come up.
So I then thought no man yes I can go through this manually but it will take forever so I tried making a script that I thought would work to get the hidden files and open one by one. But it does not work as I wanted.
I wanted to append those hidden files into a list and then run a for loop that will open each one of them and then I will be able to see results and spot password
Code Below
import os
a = []
for i in os.system('find .inhere/'):
a.append(i)
for j in a:
print("\n\n cat j ")
So it my first time messing code of such manner trying to interact with the command line using python can you please help on how I can go about it or if my code can be fixed
os.system()doesn't return the output of the command. Usesubprocess.Popen()for this. And you need to split the output into lines, it's not done automatically for you.os.system()returns the exit status of the command.os.system()came to mind, so I guess my mistake also could have be there on not reading the documentation