caseyscarborough / keylogger

A no-frills keylogger for macOS.
573 stars 166 forks source link

`sudo make load` does not work #33

Open Producdevity opened 2 years ago

Producdevity commented 2 years ago

Prerequisites

Expected Behavior

That the keylogger would start after running sudo make load.

Current Behavior

I am getting this error: make: *** No rule to make target 'load'. Stop.

Context

caseyscarborough commented 2 years ago

This error is typically when make is either unable to find the Makefile, the target in the Makefile, or doesn't have the proper permissions. Can you ensure there are no changes to the Makefile (like spaces instead of tabs), you're in the repository root, and you have permissions to the file?

If that's still not working, here's a few other things you can try:

I haven't tested this on macOS 12 so perhaps there could be an issue there, but it seems more like something related to make.

Producdevity commented 2 years ago

Thanks for your response!

I am running versions GNU Make 3.81.

This is the content in the keylogger.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>keylogger</string>
  <key>ProgramArguments</key>
  <array>
      <string>/usr/local/bin/keylogger</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <true/>
</dict>
</plist>

I am not sure but I think that that means it does run it at startup and the sudo make load is only making sure the Daemon is starting right now too, correct?

(Makefile is unedited btw)

lfreinag commented 3 months ago

I am having the same symptoms as @Producdevity.

The interesting thing is that if I run manually and locally (at the git cloned repository) the command keylogger it all works like a charm.

So I solved this problem with nohup:

nohup ./Keylogger &

You will need to kill it differently though:

ps -e | grep "Keylogger" kill -9 pid_of_keylogger_from_above_command

I hope this helps someone 😉

P.D. For the record, I am also running macOS 12. But I am running 12.6.6 🤔 Maybe this is the issue?

lfreinag commented 3 months ago

Sorry for the multiple answers. I have now redone the whole setup to see if my solution worked. It didn't!

But now I know exactly what the problem is.

On the Settings --> Security & Privacy --> Accessibility options you need to have both "Terminal" and "keylogger" allowed.

When running it from the terminal with keylogger I got the popup automatically to add the "Terminal" to the options.

Then if you run launchctl load /Library/LaunchDaemons/keylogger.plist from the terminal, you will get another popup automatically to add the "keylogger" to the options and it will work after this.

Be aware that if it returns an error once you run the launchctl load command, stating that the keylogger.plist is already running you will need to perform a sudo make unload and then retry.

I hope this solves the problems for any other users trying to use your app. Can @Producdevity or someone test that this solution is correct?

I am not sure if it is worth it to add it to the documentation side of the issues but I can gladly add a PR to add it 😉 If it is confirmed of course.