• 0

WPA2 Key Generator


Question

Just been tinkering around lately and finished another nifty little tool in Python that generates valid WPA/WPA2 passwords. Don't think I'm going to put this one on sourceforge though, it was pretty simple to do and there's only about a billion WPA2 password generators out there, so I wouldn't really be contributing anything new.

 

If anybody wants to use it though, it's compatible with all operating systems that support Python 3 (Not sure how OSX identifies itself in os.name so the option to save it to a file may or may not work on a Mac, but it should generate a valid key on a Mac at the very least). I've posted the sourcecode on the Ubuntu pastebin so you can just copy and paste it into a .py file and tinker with it as you please.

 


Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

 

Just been tinkering around lately and finished another nifty little tool in Python that generates valid WPA/WPA2 passwords. Don't think I'm going to put this one on sourceforge though, it was pretty simple to do and there's only about a billion WPA2 password generators out there, so I wouldn't really be contributing anything new.
 
If anybody wants to use it though, it's compatible with all operating systems that support Python 3 (Not sure how OSX identifies itself in os.name so the option to save it to a file may or may not work on a Mac, but it should generate a valid key on a Mac at the very least). I've posted the sourcecode on the Ubuntu pastebin so you can just copy and paste it into a .py file and tinker with it as you please.
 

 

this might be useful in one of my "security analyzing" sessions, was going to write a simple one my self in java when I had the time python would be more compatible with my system though...has does it follow a pattern or is it random?cba to read it all right now

Link to comment
Share on other sites

  • 0

> ascii = random.randint ( 33, 126 )

 

 

A key generator is only as strong as the random number generator it's using is truly random.

 

Good on you though if you're doing this as an exercise to learn python.

Link to comment
Share on other sites

  • 0

So his implementation is better than the one used in the .NET framework? Tested by millions of programmers around the world? Lol go figure...

 

Why do you think generating a GUID is the same thing as generating a WPA key? You would never using a GUID generator for a key for the reason dandy highlighted: your implementation is only as good as the random number generator. GUID generation is not meant to be truly random. It's meant to give you a globally unique identifier, that is all. That doesn't mean a pattern can't be found or established that compromises the generated identifiers in some way. You don't care though because you don't use it for security, just for unique id generation.

Link to comment
Share on other sites

  • 0

> ascii = random.randint ( 33, 126 )

 

 

A key generator is only as strong as the random number generator it's using is truly random.

 

Good on you though if you're doing this as an exercise to learn python.

Yeah I have tons of little projects I've made just to piddle around and learn a little bit about Python.  I don't think I'll ever become an expert in the field because I spend the majority of my time doing other things, but whenever I do make something I think is somewhat nifty I like to share it.

 

this might be useful in one of my "security analyzing" sessions, was going to write a simple one my self in java when I had the time python would be more compatible with my system though...has does it follow a pattern or is it random?cba to read it all right now

I'm sure that if you tried a pattern could be found, it uses the built in random.randint function in python, and I just specified the number range that includes numbers, letters, and special characters on the ascii chart, then once it picks a number, it converts the number to its corresponding ascii character and appends it to a string that becomes the password.  The random.randint function I don't think is "truly" random, if any computer program is, because when you google how to use it the man page says it generates "pseudo" random numbers, so I'm guessing their methodology is not impervious to compromise if somebody were so motivated.

Link to comment
Share on other sites

  • 0

this might be useful in one of my "security analyzing" sessions, was going to write a simple one my self in java when I had the time python would be more compatible with my system though...has does it follow a pattern or is it random?cba to read it all right now

 

If you get around to reading the code, the last half of it is just saving the password to a text file, because the Windows command line, unlike terminal emulators in *nix, does not allow you to highlight characters and copy them, so I figured if I do choose to use it for myself it would make it easier to use on any OS, plus I could just put the text file on a thumb drive so I could copy and paste the new password to update my mobile devices without having to manually type the whole thing.

Link to comment
Share on other sites

  • 0

Yeah I have tons of little projects I've made just to piddle around and learn a little bit about Python.  I don't think I'll ever become an expert in the field because I spend the majority of my time doing other things, but whenever I do make something I think is somewhat nifty I like to share it.

 

I don't think you need to be an expert anyway to do 95% of the things you want to do. I feel a-lot of the expert part of python is just being more pythonic and unless you are being pedantic: who cares. I still use spaces in my own python code even though it isn't recommended, blasphemy, etc. ;-)

Link to comment
Share on other sites

  • 0

i'd be weary of actually using any scripts like this in production. the pseudo-random generators just aren't cryptographically secure. for stuff like WPA keys I'd just go straight to a web source that uses actual randomness like the GRC random password generator.

 

If you get around to reading the code, the last half of it is just saving the password to a text file, because the Windows command line, unlike terminal emulators in *nix, does not allow you to highlight characters and copy them, so I figured if I do choose to use it for myself it would make it easier to use on any OS, plus I could just put the text file on a thumb drive so I could copy and paste the new password to update my mobile devices without having to manually type the whole thing.

 

well you can, just not with the one that's spawned by python. i never figured out why that is.

Link to comment
Share on other sites

  • 0

you can copy characters from windows command line console:

  • press Alt+Space, a menu will appear
  • choose Edit, this will expand the menu
  • choose Mark, this will begin the selecting mode
  • then you can use mouse or arrow&shift key to choose with part of text you want to copy, and when selection done,
  • press Enter to copy the highlighted area into clipboard
Link to comment
Share on other sites

  • 0

If you get around to reading the code, the last half of it is just saving the password to a text file, because the Windows command line, unlike terminal emulators in *nix, does not allow you to highlight characters and copy them, so I figured if I do choose to use it for myself it would make it easier to use on any OS, plus I could just put the text file on a thumb drive so I could copy and paste the new password to update my mobile devices without having to manually type the whole thing.

Right click > Mark > Select characters > Hit enter

It's supported it for a long time, only difference is that it treats the terminal as a formatted block of text (So the selection is free-form) instead of a line by line text output like *nix terminal emulators.

You could also just redirect the output to a text file, Windows supports > and |, etc.

Edit: How on earth did I miss the above post?

Edit 2: Or the one above that, jeeze. It's probably because Python doesn't use the normal command line "driver" (I think that's the term) and instead does it itself. Running a python script from the normal command prompt should work.

Link to comment
Share on other sites

This topic is now closed to further replies.