samedi 28 mai 2022

Pycharm, skips function

import time
import random

print('''What Would You Like To Do?
1) Generate New Key
2) Check Key Validation''')

question1 = int(input( ))

if question1 == 1:
    genvalues = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'


    def main():
        outfile = open('keys.txt', 'w')

        print('GENERATING NEW KEYS RESETS OLD KEYS')
        time.sleep(10)
        x = 0
        y = int(input('How Many keys would you like:   '))
        while True:
            x += 1

            keys = f'{random.choices(genvalues, k=5)}-{random.choices(genvalues, k=5)}-{random.choices(genvalues, k=5)}'
            keys2 = keys.replace("'", "")
            keys3 = keys2.replace(",", "")
            keys4 = keys3.replace("[", "")
            keys5 = keys4.replace("]", "")
            print(keys5)
            outfile.write(keys5 + '\n')

            if x == y:
                timesleep = y * 15
                print('You Have', timesleep, ' Seconds Until You Have To Create A New Key')
                time.sleep(timesleep)
                print('\n' * 100)
                outfile.close( )
                break

elif question1 == 2:

    def check():

        keys = {}
        with open('keys.txt', 'r') as file:
            for line in file:
                line = line.split( )
                keys.update({line[0]: line[1]})
        while True:
            serialkey = input('Enter Serial Key:   ')
            if serialkey not in keys:
                print('Invalid')
            else:
                print('Success')



Aucun commentaire:

Enregistrer un commentaire