Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

❖ Practical No:09) Create a simple keylogger using python.

➢ Program:
#Program to generate Random key value.
import string
import random

def keyGenerate():

# initializing size of string


N = int(input("Enter key size:"))

# using random.choices()
# generating random strings
res = ''.join(random.choices(string.ascii_uppercase +
string.digits, k=N))

return res
# print result
print("Random key generation\n")
n=int(input("Enter number of keys to be generated:"))
for i in range(n):
print("The generated random string : " + str(keyGenerate()))

➢ Output:

You might also like