Team BlueWater Game Online Tutorial's
Bine ati venit la Team-BlueWater!!Tutorial's 4 all Games!

[Sursa Python] Generator simplu

Go down

[Sursa Python] Generator simplu

Post  Karma on Sun Jul 31, 2011 7:45 am

Code:
import random

print '----------------------'
print '| Passlist Generator |'
print '----------------------'

alph_num = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z','a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',1,2,3,4,5,6,7,8,9]
char_len = [3,4,5,6,7,8,9,10,11,12,13,14]

def _create_():
  global f
  filename = raw_input('Create Passlist Name: ')
  f= open('/Users/greg/Documents/Coding Projects/Passlists Py/' + filename + '.txt', 'w+r')

def _random_():
    global f
    global count
    long = input('How many passwords would you like to generate?: ')
    print '\nGenerating...'
    count_ = 0
    while count_ < long:
                passlen = random.choice(char_len)
                f.write("".join(str(i) for i in random.sample(alph_num, passlen)) + '\n')
                count_ += 1
    f.close()


def _main_():
        _create_()
        _random_()
        print '-Passlist completed-'


_main_()
avatar
Karma
Admin
Admin

Mesaje : 1092
Data de inscriere : 2011-04-22
Varsta : 27
Localizare : Craiova

View user profile http://team-bluewater.forumz.ro

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum