This Python script generates random passwords using various character sets and configurations. It provides flexibility in choosing password length and the number of passwords to generate. Generate passwords Microsoft 365 style(Cvcddddd
).
- Generate passwords with different character sets:
- Digits only
- Lowercase letters and digits
- Uppercase letters, lowercase letters, and digits
- All printable characters (excluding control characters)
- Generate passwords in CVC (Consonant-Vowel-Consonant) format followed by 5 digits
- Customizable password length and count
- Secure random number generation using the
secrets
module - Prints a header with single-digit column numbers (1-9), using a space for every 10th column
Run the script from the command line:
python password_generator.py [LENGTH] [COUNT]
length
: Length of each password (default: 32, positive integer)count
: Number of passwords to generate (default: 20, positive integer)
./password_generator
Sample Output:
Generating 20 passwords of length 32
123456789 123456789 123456789 12 123456789 123456789 123456789 12 123456789 123456789 123456789 12 123456789 123456789 123456789 12
36534975313522508512477582609714 nkfyc7yimrbe04uepk6aosz4e6d122il UwqFquvWuTvlGX6GgxJkMbFzhqQYE8qy %Zq0O+O0}gT<c3!^v9L(fbc?e_#X5 9* Kur88139
53418343617639933145915175139835 82qtqin46cowa67b9gh3am6olfvo9un0 gsFFdqjRbK1kt2Jmm9M9mSVwA8eb6xhQ jIItfc|=N?s<|iC71+S%.^T4,Id#z=]o Wav45960
02348689072177571112782644846104 vahslhahir603oxuxhohx0m1w67ztf02 UHjTb9Y8oGGLFliXFYTtwgv2M4kHPpo0 Csk*C#]1T"BEd0 S/fx'p#Rmw#b"S_GR Toj73544
91421726792983049063388367028556 cama1xrmvcu0jhj8jqdtc90nq7q0hymm rpsYFQF0fovLZC771MfIZd46bK5Qnz4D *k8}@NE;Q3(D4$h_u0|C0$'`Dt1g9K'P Qir24256
...
python password_generator.py --length 16 --count 10
Sample Output:
Generating 10 passwords of length 16
123456789 123456 123456789 123456 123456789 123456 123456789 123456
1547024292815642 3odm52e9hqwpaee8 i9EBlXKUrF0rKKIE M+\Kgo&T%;cpn-t\ Fim44611
9645942854661753 u41cjco5twp0h2i4 jSRt1Uie4yCHBkZI ;n/HIrdwx r?V6-Y Cuc20962
0257528002529535 frvgovsedtlcdjq9 aFB2zd0Riu3BLgpk yAF^I>A@8z (c]VN Nob40954
7554235848885875 qojwhsbddlgt6phi ebRZ60P6h0J6mLha HMg<H 7iWWPV^i_j Mut50999
...
Note: The actual passwords generated will be random and different each time the script is run.
- Python 3.6+
This script uses the secrets
module for generating cryptographically secure random numbers, making it suitable for creating strong, unpredictable passwords.