0

I've got a textfile about 400mb with hashes and passwords like this:

h73kdkf947gjsl489fjh74jkdl:lolpassword

AND like this:

blabklabla@mail.com:lolpassword

Now, there's alot of lines and there's no way I will or can remove the hash or password one by one.

Is there a command or script that will do this? Just filter away either just the hash/email or just the password, and then exporting this to a new .txt file? I'm working on a custom wordlist since I cannot find any good ones in my native language.

3
  • 1
    cut -d: -f1 yourfile for first field of -f2 for second field Feb 6 '17 at 15:06
  • 1
    @GeorgeVasiliou that assumes that there is only one : in the line. The password could also contain : and I guess the hash can as well.
    – terdon
    Feb 6 '17 at 15:08
  • @terdon Yeap, good point... I wrote it fast, based on the OP data. But to separate the password from the hashes /email in one row, we need a discrete valid separator... and if semicolon is not a good separator to use, i can not think of a different separator not present even in the first field. Actually all chars can be part of first and second field, and thus can not be used as separators..... Feb 6 '17 at 15:28
0

Seems like the passwords are separated by ":"

If I understood you correctly, this command below would do your job.

cut -d ":" -f 2 textfile > passwords.txt
8
  • That assumes that there is only one : in the line. The password could also contain : and I guess the hash can as well.
    – terdon
    Feb 6 '17 at 15:09
  • @terdon : I guess, neither the hashes contain an colon " : " symbol nor the email ID. Would ask you to give it a try and check the passwords.
    – scribbler
    Feb 6 '17 at 15:16
  • Yes this "cut -d ":" -f 2 textfile > passwords.txt" worked like a charm!!!! Thank you very much!
    – diddlydope
    Feb 6 '17 at 15:26
  • But how do i filter when the lines are like this "('username', 'passwordhashhashashash, '0.00000000000.0') and I only want the hashes to my new textfile, also how to filter this "username:hash:email" and again, just to keep the hashes? Thank you
    – diddlydope
    Feb 6 '17 at 15:29
  • 1
    I can't, I don't have access to the OP's file. I am simply pointing out that passwords can contain arbitrary characters, including a : so your approach will break for any password that contains a :. In addition, it will also break if the hash
    – terdon
    Feb 6 '17 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.