
06-30-2008, 08:21 PM
|
|
Member
|
|
Join Date: Jun 2008
Posts: 54
|
|
awesome code!
Wow! This is completely awesome! Love it! Thanks for coding this!
~LV
Quote:
Originally Posted by v0id
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
...
|
|