Python Forum
keylogger help? (not for malicious use, to be used with data visualisation)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
keylogger help? (not for malicious use, to be used with data visualisation)
#1
hi,

I'm trying to install a keylogger on Mac OS, following this tutorial: tutorial for keylogger

i follow all the steps and seem to have everything correct, (check IDLE that pynput is installed correctly, comes up with no errors)
and have the following code:

from pynput.keyboard import Key, Listener
import logging

log_dir"/Users/dav3javu/Desktop/logs"

logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='%(asctime)s: %(message)s')

def on_press(key):
    logging.info(str(key))

with Listener(on_press=on_press) as listener:
    listener.join()
but when I go to restart and check the log file, no data/entries are being produced at all (the file is empty) , can anyone see what i'm doing wrong? (not a natural programmer - just trying to dabble for a project)

thanks!
Reply
#2
You forgot an equal sign on line 4:
log_dir = "/Users/dav3javu/Desktop/logs"
I don't know if that code is a copy paste of your original program but if it is, Python would see that statement and raise a syntax error. Your code isn't even running.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create a Kibana Visualisation with python script? adzadz 0 1,259 Jul-20-2020, 06:41 AM
Last Post: adzadz
  HELP: need a Keylogger with those features cocododo 1 1,951 May-03-2019, 12:33 AM
Last Post: micseydel
  how to pause pyxhook keylogger johweb 0 2,362 Jun-13-2018, 03:17 PM
Last Post: johweb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020