tryingtoshare

random password generator

May 20th, 2014
135
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. import random
  3.  
  4. def generatepwd(length):
  5.     print type(length)
  6.     #output = 'miamcomicalhostagi#cpasswordphrase'[1:length]
  7.     outputlist = getasciichars()
  8.     outputstring = ''.join(outputlist)
  9.     return outputstring
  10.  
  11. def getasciichars():
  12.     mylist = []
  13.     for x in range(32,126):
  14.         mylist.append(ord(chr(x)))
  15.     print mylist
  16.     print '[%s]' % ', '.join(map(str, mylist))
  17.     outputlist = []
  18.     for x in range(0,length):
  19.         outputlist.append(chr(random.choice(mylist)))
  20.     return outputlist
  21.  
  22.  
  23. if len(sys.argv) > 1:
  24.     length = int(sys.argv[1])
  25.     if length < 8:
  26.         length = 8
  27.     elif length > 20:
  28.         length = 20
  29. else:
  30.     length = 8
  31.  
  32. print "Length of password " + str(length) + " password " + generatepwd(length)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×