Thank you for your time to read my post!
I'll upgrade the script following your suggestion ASAP.
You're welcome.
I think you could simply use os.urandom with hashlib.sha256 to create pretty random and secure passwords of any length, i.e.:
import sys, os, hashlib, base64
pwlen = sys.argv[1]
pw_hash = hashlib.sha256(os.urandom(128))
print base64.b64encode(pw_hash.hexdigest())[0:int(sys.argv[1])]
I am sure there are plenty of improvements for above method but it should give you and idea. Though if you are on a Linux system for example, you can do all of this in a bash one-liner.
HTH
Thank you again!
I'll definitely study your suggestion further, and I'll try to implement.
Just to say, my current version doesn't simply generate a random password from the python lib, it produce each character using the random lib than, substitute from 1 to 3 characters (randomly) into numbers, and than again substitute from 1 to 3 characters into capital letters.
I know that there is a big room for improvement.