Victor Waknin Victor Waknin - 27 days ago 7
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.

Answer

You can check username and password using curl

curl -u $USERNAME:$PASSWORD --silent "https://mail.google.com/mail/feed/atom" | grep "<TITLE>"

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

Comments