Advertisement
Guest User

Untitled

a guest
May 6th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import string, random
  4.  
  5. alpha = 'abcdefghijkljmnopqrstuvwxyz0123456789'
  6.  
  7. x = 0
  8. pwd = ""
  9. hasint = 0
  10. charpos = 0
  11. chrmin = 0
  12. chrmax = len(alpha) - 1
  13. while x < 9:
  14. charpos = random.randint(chrmin,chrmax)
  15. char = alpha[charpos]
  16. up = random.randint(0,1)
  17. if up:
  18. char = char.upper()
  19. pwd = "%s%s" % (pwd, char)
  20. if char.isdigit():
  21. hasint = 1
  22. x = x+1
  23. if hasint is 0:
  24. charpos = random.randint(0,8)
  25. pwdlist = list(pwd)
  26. pwdlist[charpos] = str(random.randint(0,9))
  27. pwd = ''.join(pwdlist)
  28. print pwd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement