Thread: Best Passwords?
View Single Post
  #20 (permalink)  
Old 06-30-2008, 08:21 PM
LissaValerian LissaValerian is offline
Member
 
Join Date: Jun 2008
Posts: 54
LissaValerian is on a distinguished road
Smile awesome code!

Wow! This is completely awesome! Love it! Thanks for coding this!

~LV



Quote:
Originally Posted by v0id View Post
And here is the script:
Code:
# lipg.py
#  - Lissa-Inspired Password Generator
 
import sys
import random
 
if len(sys.argv) == 2:
    helpingString = sys.argv[1].split()
else:
    helpingString = raw_input("Enter helping string: ").split()
 
partsToNumerize = []
helpingStringLength = len(helpingString)
for notUseful in range(0, helpingStringLength / 3):
    while True:
        number = random.randint(0, helpingStringLength - 1)
        if number not in partsToNumerize:
            partsToNumerize.append(number)
            break
 
generatedPassword = ""
for index in range(0, helpingStringLength):
    if index in partsToNumerize:
        generatedPassword += str(len(helpingString[index]))
    else:
        generatedPassword += helpingString[index][0]
 
print "Generated password:   %s" % generatedPassword
And this is how to use it, using parameters:
Code:
$ python lipg.py "Your helping string"
...
And how to use it, using no parameters:
Code:
$ python lipg.py
Enter helping string: Your helping string
...
And if you want to get rid of the "python" in the beginning, you can chmod it:
Code:
$ chmod +x lipg.py
$ ./lipg.py "Your helping string"
...
$ ./lipg.py
Enter helping string: Your helping string
...
Reply With Quote

Sponsored Links