Skip to content

Instantly share code, notes, and snippets.

@nanmo
Last active December 16, 2015 05:58
Show Gist options
  • Save nanmo/5387691 to your computer and use it in GitHub Desktop.
Save nanmo/5387691 to your computer and use it in GitHub Desktop.
import random
import argparse
parser = argparse.ArgumentParser(description='Generate random characters from specified length/lines.')
parser.add_argument('length', help='length of line', type=int )
parser.add_argument('number', help='number of lines', type=int )
args = parser.parse_args()
passlen = args.length
count = args.number
s = 'abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789'
for i in range(count):
password = ''
for j in range(passlen):
password += random.choice(s)
print password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment