EvilZone

Programming and Scripting => Scripting Languages => Topic started by: Traitor4000 on February 01, 2014, 03:24:30 PM

Title: [Python] Brute Force List Creator
Post by: Traitor4000 on February 01, 2014, 03:24:30 PM
Just a simple script i needed so i wrote it figured i would share...
Code: [Select]

def getList():
    chars =[]
    x = 'a'
    print 'Enter characters wanted to be used in bruteforce type exit to exit'
    while x != 'exit':
        x = raw_input('Enter a character to be added:')
        if x == 'exit':
            return chars
        chars.append(x)



def retLine(items, n):
    if n==0: yield []
    else:
        for i in xrange(len(items)):
            for ss in retLine(items, n-1):
                yield [items[i]]+ss
   



def main():
    f = open('wordlist', 'w')
    min = input('Enter min: ')
    max = input('Enter max: ')
    theList = getList()
    print theList
    for i in range(min, max+1):
        for s in retLine(theList,i):
            f.write(''.join(s) + '\n')
main()