Skip to content
Advertisement

How to read file in linux command line?

I’m doing this challenge thing and this is one of the levels:

An agent on Level 05 has told us about another big hack he’s working on. Apparently someone broke into a popular shopping site, stole all the usernames and passwords and was going to post them online. Luckily, we got to them first and recovered the details. Why is this important? Well, it seems one of the Yakoottees was a member of that site.

He typically uses one of these three usernames: kazuya, kaz_whizz, kazuya99. We’ve put the recovered data on one of our servers. We’ve given you access, so see if you can find him on there. If we knew the password he uses maybe we can use that later.

Tip: The flag is his password.

I think I need to read this file called “182k_accounts_rip.txt”. The directory is “/root/site_pwned” i think.

Maybe I need to read the file to get the password? The ‘cat’, ‘less’, ‘more’ and ‘tail’ command do not work. Maybe I need to see the current password with the user names mentioned? Please help

Advertisement

Answer

To read the file you can invoke vi or vim command from program using system function or execve family function as

int main(int argc, char *argv[]) {

        system("vim 182k_accounts_rip.txt");
        perror("system");
        /* do the stuff here like use grep to find the pattern*/
        return 0;
}
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement