Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Secure password generator

Code
#!/usr/bin/env python
import random
import string
import os
import time
import sys
try:
os.system('clear')
times = 0
def randomword():
   s = string.uppercase+string.digits+string.lowercase+string.punctuation
   ring = ''.join(random.sample(s,20))
   print ring
while times < 5:
  randomword()
  times += 1
  time.sleep(0.5)
except KeyboardInterrupt:
    sys.exit(0) # or 1, or whatever
This is a secure password generator, outpout:
Code
P-k8~}jsu]%+l1p6XAr_
=s;R7UFkbAfEW/S|])(:
\BMZ;<o/+dJ'!V}"f#?.
&y`oI-q/a+:\3~u)xgSF
#AJ`quLwxUN_SBV!~g&D
You can't remember this so which is mean you must save it anywhere ... And saving ur password anywhere,uhmm? Unsecure lol.
(Aug 25, 2015 05:02 PM)SIM-1866423 Wrote:  You can't remember this so which is mean you must save it anywhere ... And saving ur password anywhere,uhmm? Unsecure lol.

You're thinking secure as in "can't be stolen or keylogged" - I believe OP means as in "can't be cracked." Logically these can be cracked but not within a human life.
Moving on in life in such a way that doesn't include HF. HF allowed me to get into the security field and peaked my interest: I appreciate everyone's time, effort, and encouragement. If for some reason you have a means to message me outside HF, feel free to, but I won't be coming back.
(Aug 25, 2015 05:02 PM)SIM-1866423 Wrote:  You can't remember this so which is mean you must save it anywhere ... And saving ur password anywhere,uhmm? Unsecure lol.

you can tweak the settings , remove string.punctiation and you have secure passwords but you can still remember it,
Cool share, but your program can be written as one line of code...
PHP Code

<?php 
for s in map(lambda x: ''.join(__import__('random').sample(x, 20)), ['abcdefghijklmnopqrstuvwxyz'+'ABCDEFGHIJKLMNOPQRSTUVWXYZ'+'0123456789'+'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'] * 5): print s 
(Aug 26, 2015 01:54 AM)Introvert Wrote:  Cool share, but your program can be written as one line of code...
PHP Code

<?php 
for s in map(lambda x: ''.join(__import__('random').sample(x, 20)), ['abcdefghijklmnopqrstuvwxyz'+'ABCDEFGHIJKLMNOPQRSTUVWXYZ'+'0123456789'+'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'] * 5): print s 

You could use an ASCII table chart to map the int representation of each character you specified and covert it to char starting from 33 to 125.
Code
for s in range(5): print ''.join(random.sample([chr(c) for c in range(33,125)], 20))

Which does the same, and no need for map, lambda, and string concatenation.
A secure password generator would choose a random string of concatenated words.

Telephone$Mothership!

That is a secure password. It's incredibly easy to remember, incredibly entropic, and incredibly difficult to brute force.

> inb4 my accounts get locked out while people think that's my actual password
SRPP Discord Server

I am a professional network/cloud security architect.
My Old Tutorials
(Aug 26, 2015 05:44 PM)zmetra Wrote:  You could use an ASCII table chart to map the int representation of each character you specified and covert it to char starting from 33 to 125.
Code
for s in range(5): print ''.join(random.sample([chr(c) for c in range(33,125)], 20))

Which does the same, and no need for map, lambda, and string concatenation.

Wow. I hadn't even thought of that! I like it.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by Malum™Jan 14, 2017 06:38 PM 12 647 Jan 14, 2017 06:38 PM
Last Post: sinfulshotx
[Python] by Snowdrop14Jan 19, 2016 06:41 PM 4 401 Jan 19, 2016 06:41 PM
Last Post: horrorland1
[.NET] by Toby Allen JohnAug 23, 2015 04:51 AM 8 645 Aug 23, 2015 04:51 AM
Last Post: SIM-2564555