How to Create a Password Dictionary Generating Script with Python

Jul 13, 2015 12:21 AM
Jul 13, 2015 12:22 AM
635723169640289382.jpg

First of all, I hope the title makes sense. :D Well, this is basically creating a program that can help with dictionary attacks. Generate possible passwords. It pretty much lies in you knowing the person you want to hack.

Story Time

I just like stories :D

Well, I heard about the new series, Mr. Robot from my friend and after seeing 5 minutes of the pilot. I loved it. Stuff he said that I was unfamiliar with or was just rusty with I paused and googled it right away.

Some may not enjoy it that way, but I did, and it was awesome.

Well if you have seen the pilot, you know most of the time he is hacking someone, he uses a dictionary of common things about them. I figured cool, I want one of those, so then I went about my script kiddie-ing and checked online, didn't really find much, and I figured lemme go semi - script kiddie and get someone's code and just copy it and understand it later, that way I can write it myself any time...still nothing.

And that was just getting annoying so I figured I will just have to learn something new and write it myself. I started this as a small project, but then I got carried away(too much actually). The first version is really simple but then the final one I have done is not difficult just a bunch of copy and paste of the code...lol

So this version is kinda long but not scary...lol..I will try and explain everything as best as i can. If you get bored at some point, sorry...but I think if you stick to the end, it will be worth it. :D

So well here goes...

Step 1: Basic Stuff

Well, this part just imports the modules and defines the arguments for it. I wanted it to look professional...lol so I decided to use arguments. No more rawinput ...hehehe!!

635723169640289382.jpg

So well, the first 2 lines just import the modules obviously.

And now for the long explanation.

Line 4: creates and object of the argparse module(kinda)

Line 5-8: create arguments to receive from the command-line. (I'm sure we have all used arguments before so I won't go much into that!!)

Line 11-13: is a different kinda parser arguments. It lets you choose one out of the group. (You know like if you running a script you can either choose verbose or quiet but not both). Something like that. And the action="store_true" is to show that it contains no data.

Step 2: The Real Code - NoRepeat

This section will contain only the code on the norepeat section, this is where in the code the characters in the passwords do not repeat each other.

635723174726853057.jpg

This is not complicated, just a lot of stupid ifs and elses it shouldn't be hard to comprehend. the only part I think I should explain is the itertools.permutations() function(or method or whatever) what it does is make sure that the characters don't repeat(duh!)..well it takes two parameters(or arguments..i got bad programming grammar people!!)

so the first one is the characters themselves and the second one is the length of the characters that will be provided. as you can see the for loop makes it either print or save it in a possible passwords by getting the data in the res(that's where the characters are saved-ish)

Step 3: The Real Code - Repeat

This is the same thing as the NoRepeat except it repeats...lol so a lot more words in your dictionary file hence a better chance of finding the password.

635723178552477109.jpg

Pretty much the same as itertools.permutations except with itertools.product it repeats that's all hence therepeat=i and parameters(or arguments..shame on me!!) are the same thing!!

Step 4: Conclusion

I just realized it's a lot like cupp but I didn't like cupp very much. I mean how many people you gonna hack are married...right?! Well I hope this helps. When I was writing this. I was completely tired, so you have to forgive me for been sloppy or for any mistakes both in the code and in the English as well. Also don't forget to ask questions if you got any. And I didn't test it, but it should work all the same. Check out your indentation(those things can be a pain in the ass!)..That's it for now!!!

Happy hacking!!

Romans 6:12 Therefore do not let sin reign in your mortal body,

that you should obey it in its lusts.

Comments

No Comments Exist

Be the first, drop a comment!