**Hi all fort i would leave a little keygen/passphase maker for anyone that wants one **
Also would like feed back on it maybe someone could help inprove or some ideas to improve plus to get this to work you have to make a file called Data make shore caps D. in the Data file is where the keys generated will go so here it is:

#!/usr/bin/python

import string
import random

data = open(r'Data')
lines = data.readlines()
data.close()



data = open(r'Data', 'w')
print "Generating random keys from uppercase"
print "and lowercase with numbers..."
print "Please close terminal with the x button"
print "top right of terminal as this is on a loop."
print "\n \n WARNING may generate the same key twice WARNING \n"
t = raw_input("Enter char length :")
a = int(t)
raw_input("If You Wish To Continue Press Any Key.....")

print "\n \n \n Generating........"

x = 1
while True:
    def lowerchar(size=a,chars=string.ascii_lowercase +      string.digits):
        return ''.join(random.choice(chars) for x in range(size))
    def upperchar(size=a,chars=string.ascii_uppercase +      string.digits):
        return ''.join(random.choice(chars) for x in range(size))
    def allchar(size=a,chars=string.ascii_uppercase+string.ascii_lowercase +      string.digits):
        return ''.join(random.choice(chars) for x in range(size))
    lines[+0] = lowerchar()+"\n"+upperchar()+"\n"+allchar()+"\n"
    data.writelines(lines)

    x += 1

I hope this could help or be of use to any one comment n let me know.

putting definitions inside loop is really bad idea. You do not need to define the functions multiple times.

If i put the definition outside the loop it creates the same key so by putting the definition on the inside lets it create random keys thanks for the reply.

I do not understand your code closest I got working (kind of)

#!/usr/bin/python
import string
import random    

data = open(r'./Data', 'w')
print "Generating random keys from uppercase"
print "and lowercase with numbers..."
print "Please close terminal with the x button"
print "top right of terminal as this is on a loop."
print "\n \n WARNING may generate the same key twice WARNING \n"
t = raw_input("Enter char length :")
a = int(t)
raw_input("If You Wish To Continue Press Any Key.....")

print "\n \n \n ........ push Ctrl-C to stop"

def random_join(size, chars):
    return ''.join(random.choice(chars) for x in range(size))

# these could also be defined with functools.partial
def lowerchar(size, chars=string.ascii_lowercase + string.digits):
    return random_join(size, chars)

def upperchar(size,chars=string.ascii_uppercase + string.digits):
    return random_join(size, chars)

def allchar(size, chars=string.ascii_uppercase+string.ascii_lowercase + string.digits):
    return random_join(size, chars)

while True:
    data.write(lowerchar(a)+"\n"+upperchar(a)+"\n"+allchar(a)+"\n")

Its made to create a list of keys for the file Data and the reason it didnt work its because i forgot to mention you have to open Data and put text on line 1 2 3 and 4 like this :
1
1
1
1

like that then run the script thanks for the reply

Here is a update on my keygen now you dont have to make a Data file it will make a file that you type in at the start also it will print at certern cycles of the loop the MB's of the file this will work straight away comments are welcomed...

#!/usr/bin/python

import string
import random
import sys
import time
import os

print "enter the name of the file to hold all the keys:"
filenam = raw_input("Name Of File ::")

temp = sys.stdout

sys.stdout = open(filenam, 'a')
print "Do Not Edit"
sys.stdout.close()
sys.stdout = temp
data = open(filenam, 'r')
lines = data.readlines()
data.close()



data = open(filenam, 'w')
print "Generating random keys from uppercase"
print "and lowercase with numbers..."
print "Please close terminal with the x button"
print "top right of terminal as this is on a loop."
print "\n \n WARNING may generate the same key twice WARNING \n"
t = raw_input("Enter char length :")
a = int(t)
raw_input("If You Wish To Continue Press Any Key.....")

print "\n \n \n Generating........"
k = 3

x = 1
clearscr = 1000000

while x:
    def lowerchar(size=a,chars=string.ascii_lowercase +      string.digits):
        return ''.join(random.choice(chars) for x in range(size))

    def upperchar(size=a,chars=string.ascii_uppercase +      string.digits):
        return ''.join(random.choice(chars) for x in range(size))

    def allchar(size=a,chars=string.ascii_uppercase+string.ascii_lowercase +      string.digits):
        return ''.join(random.choice(chars) for x in range(size))

    lines[+0] = lowerchar()+"\n"+upperchar()+"\n"+allchar()+"\n"
    data.writelines(lines)


    v = 3 * x
    tim = x
    mb = os.path.getsize(filenam) 
    filesiz = ""




    if tim == clearscr:

        if mb >= 1048576:
            mb = mb / 1048576
            filesiz = " MB's"

        print "Processed Keys:: "+str(v)+"      "+"File Size ::"+str(mb)+filesiz
        clearscr = clearscr + 1000000
        mb = mb

    x += 1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.