랭킹으로 돌아가기

SkrewEverything/Swift-Keylogger

Swift

Keylogger for mac written in Swift using HID

keyloggerswiftswift-3macmac-osxkeystrokesapplemacosswift4hackinghackhacking-tool
스타 성장
스타
1.2k
포크
106
주간 성장
이슈
3
5001k
2017년 2월2020년 3월2023년 5월2026년 7월
README

macOS Swift-Keylogger

Backers on Open Collective Sponsors on Open Collective Swift 4.0

It is a simple and easy to use keylogger for macOS. It is not meant to be malicious. There are only few keyloggers available for Mac and none of them are in Swift.

Another problem is with Apple high-level APIs. I don't know the reason but Apple suddenly deprecates and removes the documentation of APIs from its website.

So, I don't want to keep checking about the availability of their APIs and changing my code frequently. That is the reason I went for low-level API which is using HID API.

Most of the keyloggers available only log keystrokes into a file without much information about on which app the keystrokes are generated.

Usage

Clone the repository and open the project in Xcode and build the project and run the executable.

To run it in the background

To be able to close the Terminal when Keylogger is running, use this command while running the executable.

$ nohup ./Keylogger &

And you can quit the Terminal.

To quit/stop the Keylogger

To quit the Keylogger, first, find its PID using ps and use kill to stop the keylogger.

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

When it's run, it creates folder Data

|--Keylogger
|--Data
    |--App
    |--Devices
    |--Key

Key folder stores all the keystrokes according to application. App folder stores all the timestamps of applications being active. Devices folder stores the information about the connected keyboards.

By default, it creates a folder where the executable is present. To change the path edit bundlePathURL in Keylogger.swift

All the data is grouped according to day in each folder.

Integrating Swift-Keylogger with Cocoa App

There are 2 ways:

  1. Using the executable(By using Process to call the external binaries from Cocoa App).
  2. Using source code in your App without the need for external binary

Using executable

NOTE: The documentation of Apple has been constantly changing since the release of Swift. So, I just wanted to give the basic idea of this method without providing the code to avoid updating this part of the code frequently.

  1. Clone it and build the project by yourself or download the already built binary from the releases page.
  2. Use Process to run the external binary from your app.
  3. NOTE: Don't use waitUntilExit() or similar methods which can block the execution of the main UI to run the keylogger!

Using Source code

1. Add Keylogger.swift and CallBackFunctions.swift files to your project.

2. Initialize the Keylogger as a static variable and use start() and stop() to start and stop the keylogger.

Example of ViewController.swift

import Cocoa


class ViewController: NSViewController {

    // Initialize the Keylogger
    static var k = Keylogger()

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override var representedObject: Any? {
        didSet {
        // Update the view, if already loaded.
        }
    }

    // A button to start the keylogger
    @IBAction func start(_ sender: Any) {
        ViewController.k.start()
    }
    
    // A button to stop the keylogger
    @IBAction func stop(_ sender: Any) {
        ViewController.k.stop()
    }
}

3. Now, to run it without any problems, turn off the APP SANDBOX. If you want to use APP SANDBOX, then add the following to your entitlements:

com.apple.security.device.usb = YES

Disclaimer

If the use of this product causes the death of your firstborn or anyone, I'm not responsible ( no warranty, no liability, etc.)

For technical people: It is only for educational purpose.

Note: This keylogger doesn't capture secure input fields like passwords due to EnableSecureEventInput

Contributing

Feel free to fork the project and submit a pull request with your changes!

License

MIT

Free Software, Hell Yeah!

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

관련 저장소
nathanlopez/Stitch

Python Remote Administration Tool (RAT)

PythonPyPIOthermac-osxlinux
nathanlopez.github.io/Stitch/
3.6k709
aydinnyunus/Keylogger

Get Keyboard,Mouse,ScreenShot,Microphone Inputs from Target Computer and Send to your Mail.

PythonPyPIApache License 2.0keyloggerkeylogging
2.8k548
GiacomoLaw/Keylogger

A simple keylogger for Windows, Linux and Mac

C++MIT Licensekeyloggerwindows
simple-keylogger.github.io
2.4k663
mategol/PySilon

Advanced RAT written in Python language, fully controllable through Discord with dedicated GUI builder to make preparation easier.

PythonPyPIMIT Licensepython-ratrat
1.3k206
MinhasKamal/TrojanCockroach

A Stealthy Trojan Spyware

C++MIT Licensespywarevirus
1.2k280
alvin-tosh/Malware-Exhibit

🚀🚀 This is a 🎇🔥 REAL WORLD🔥 🎇 Malware Collection I have Compiled & analysed by researchers🔥 to understand more about Malware threats😈, analysis and mitigation🧐.

AssemblyMIT Licensecryptographycybersecurity
1.2k196
4w4k3/BeeLogger

Generate Gmail Emailing Keyloggers to Windows.

PythonPyPIBSD 3-Clause "New" or "Revised" Licensepythonkeylogger
1.2k337
luantak/ToRat

ToRat is a Remote Administation tool written in Go using Tor as a transport mechanism and RPC for communication

GoGo ModulesThe Unlicenseremote-admin-tooltor
lu4p.github.io/ToRat
1k194
ajayrandhawa/Keylogger

Keylogger is 100% invisible keylogger not only for users, but also undetectable by antivirus software. keylogger Monitors all keystokes, Mouse clicks. It has a seperate process which continues capture system screenshot and send to ftp server in given time.

C++clientvisual
1k207
lu4p/ToRat

ToRat is a Remote Administation tool written in Go using Tor as a transport mechanism and RPC for communication

GoGo Modulesremote-admin-tooltor
lu4p.github.io/ToRat
986199