I am doing an assignment where I have a passwd file and I am to find all the passwords in it. Most of them were easy with Jack the ripper and some tweaking but the extra credit requires I find a 8 byte Alphanumeric password generated by rand in perl 5.10.0 and encrypted with crypt. I came up with three ways to approaching this:
- Brute force: 62^8 Computations = 300 Weeks on my machine. I could rent a server with 300 times my machine power to do in 1 week. Somehow that feels like a waste of resources/electricity for an extra credit.
Break Crypt: Not sure on this one, I have however generated a char-set from the other passwords I found, reducing the Incremental brute force to 5 days, but I think that will only work if this password contains only characters present in the previous ones (17 plain-texts), so maybe if i get lucky! (Highly Unlikely)
Break rand: If I can find the same seed used to generate the password. I can then generate dictionaries to feed to Jack. In order to get the seed from the file given to me however I have to understand how perl is creating the seed (and if it is even possible on 5.10.0).
From what I have researched on earlier Perl versions only the System Time was used as a seed. I made a script that uses the m_time
(Time From Epoch) on the passwd file given to me (+-10 to be sure although I'm sure the file got generated in one second) as seed to generate a dictionary, in this format, since I do not know at what call of rand()
my password actually starts:
abcdefgh
bcdefghi
cdefhijk
I fed the dictionary to Jack. Of course this didn't work because after Perl 5.004 Perl uses other stuff (the point of my question) to generate a seed.
So, my question is if anyone knows where to find the source code Perl uses to generate the seed, and/or source code for rand/srand. I was looking for something that looked like this, but for version 5.10.0:
What are the weaknesses of Perl's srand() default seed, post version 5.004?
I tried using grep in the /lib/perl
directory but I get lost in all the #define
structure files.
Also feel free to let me know if you think I am completely offtrack with the assignment and/or any advice on the matter.
1) At the first rand of perl it will call srand(), it uses an integer value as a seed (2^32) possibilities, but the REAL seed has 2 trailing bytes unused. 2) Each rand will actually use the UNIX drand48() and change the seed following the documentation. – Reni Sep 20 '15 at 18:33