Victor Waknin Victor Waknin - 7 months ago 32
Linux Question

How to write a bash script to test table of logins?

I've participated in a hacking competition in my school. I came up with a solution but i didn't knew how to code it so here am I asking for your help.

The problem involved a security breach on a server. Files with gmail usernames:passw had been leaked and we, the infosec team, had to test which logins were compromised (if users hadn't changed their pw yet) to email them. So my idea was: first, cat all files using

cat * > merged-file
. Then, somehow create a mechanism to test each combination usr + pw on gmail putting a flag or creating another file with the successful ones.

Sorry for my bad english, i'm not a native speaker.


You can check username and password using curl

curl -u $USERNAME:$PASSWORD --silent "" | grep "<TITLE>"

it will return <TITLE>Unauthorized</TITLE> if the combination is not correct.