{"id":13563924,"url":"https://github.com/SkrewEverything/Swift-Keylogger","last_synced_at":"2025-04-03T20:32:06.183Z","repository":{"id":49366087,"uuid":"80611950","full_name":"SkrewEverything/Swift-Keylogger","owner":"SkrewEverything","description":"Keylogger for mac written in Swift using HID","archived":false,"fork":false,"pushed_at":"2018-07-06T19:16:59.000Z","size":30,"stargazers_count":1126,"open_issues_count":3,"forks_count":109,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-10-30T00:33:28.689Z","etag":null,"topics":["apple","hack","hacking","hacking-tool","keylogger","keystrokes","mac","mac-osx","macos","swift","swift-3","swift4"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SkrewEverything.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-01T10:59:31.000Z","updated_at":"2024-10-26T16:12:22.000Z","dependencies_parsed_at":"2022-08-12T20:10:54.683Z","dependency_job_id":null,"html_url":"https://github.com/SkrewEverything/Swift-Keylogger","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkrewEverything%2FSwift-Keylogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkrewEverything%2FSwift-Keylogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkrewEverything%2FSwift-Keylogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkrewEverything%2FSwift-Keylogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SkrewEverything","download_url":"https://codeload.github.com/SkrewEverything/Swift-Keylogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247075119,"owners_count":20879388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple","hack","hacking","hacking-tool","keylogger","keystrokes","mac","mac-osx","macos","swift","swift-3","swift4"],"created_at":"2024-08-01T13:01:24.601Z","updated_at":"2025-04-03T20:32:05.875Z","avatar_url":"https://github.com/SkrewEverything.png","language":"Swift","funding_links":["https://opencollective.com/Swift-Keylogger"],"categories":["Swift"],"sub_categories":[],"readme":"# macOS Swift-Keylogger\n\n[![Backers on Open Collective](https://opencollective.com/Swift-Keylogger/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/Swift-Keylogger/sponsors/badge.svg)](#sponsors) [![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg)]()\n\nIt 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.\n\nAnother 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.\n\nSo, 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.\n\nMost of the keyloggers available only log keystrokes into a file without much information about on which app the keystrokes are generated.\n\n\n## Usage\n\nClone the repository and open the project in Xcode and build the project and run the executable.\n\n### To run it in the background\n\nTo be able to close the Terminal when Keylogger is running, use this command while running the executable.\n\n```shell\n$ nohup ./Keylogger \u0026\n```\nAnd you can quit the Terminal.\n\n### To quit/stop the Keylogger\n\nTo quit the Keylogger, first, find its PID using `ps` and use `kill` to stop the keylogger.\n\n```shell\n$ ps -e | grep \"Keylogger\"\n$ kill -9 pid_of_keylogger_from_above_command\n```\n\nWhen it's run, it creates folder Data\n```\n|--Keylogger\n|--Data\n    |--App\n    |--Devices\n    |--Key\n```\nKey folder stores all the keystrokes according to application.\nApp folder stores all the timestamps of applications being active.\nDevices folder stores the information about the connected keyboards.\n\nBy default, it creates a folder where the executable is present. \nTo change the path edit `bundlePathURL` in `Keylogger.swift`\n##### All the data is grouped according to day in each folder.\n\n## Integrating Swift-Keylogger with Cocoa App\n\nThere are 2 ways:\n\n1. Using the executable(By using `Process` to call the external binaries from Cocoa App).\n2. Using source code in your App without the need for external binary\n\n### Using executable\n\u003e 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.\n\n1. Clone it and build the project by yourself or download the already built binary from the releases page. \n2. Use [`Process`](https://developer.apple.com/documentation/foundation/process) to run the external binary from your app.\n3. **NOTE: Don't use [`waitUntilExit()`](https://developer.apple.com/documentation/foundation/process/1415808-waituntilexit) or similar methods which can block the execution of the main UI to run the keylogger!**\n\n### Using Source code\n\n**1.** Add `Keylogger.swift` and `CallBackFunctions.swift` files to your project.\n\n**2.** Initialize the Keylogger as a static variable and use `start()` and `stop()` to start and stop the keylogger.\n\n#### Example of ViewController.swift\n```swift\nimport Cocoa\n\n\nclass ViewController: NSViewController {\n\n    // Initialize the Keylogger\n    static var k = Keylogger()\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        // Do any additional setup after loading the view.\n    }\n\n    override var representedObject: Any? {\n        didSet {\n        // Update the view, if already loaded.\n        }\n    }\n\n    // A button to start the keylogger\n    @IBAction func start(_ sender: Any) {\n        ViewController.k.start()\n    }\n    \n    // A button to stop the keylogger\n    @IBAction func stop(_ sender: Any) {\n        ViewController.k.stop()\n    }\n}\n```\n\n**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:\n\n```\ncom.apple.security.device.usb = YES\n```\n\n\n## Disclaimer\nIf the use of this product causes the death of your firstborn or anyone, I'm not responsible ( no warranty, no liability, etc.)\n\nFor technical people: It is only for educational purpose.\n\n\u003eNote: This keylogger doesn't capture secure input fields like passwords due to [`EnableSecureEventInput`](https://developer.apple.com/library/content/technotes/tn2150/_index.html)\n\n\n## Contributing\n\nFeel free to fork the project and submit a pull request with your changes!\n\nLicense\n---\n\nMIT\n\n\n**Free Software, Hell Yeah!**\n\n\n## Contributors\n\nThis project exists thanks to all the people who contribute. \n\u003ca href=\"graphs/contributors\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/contributors.svg?width=890\u0026button=false\" /\u003e\u003c/a\u003e\n\n\n## Backers\n\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Swift-Keylogger#backer)]\n\n\u003ca href=\"https://opencollective.com/Swift-Keylogger#backers\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/backers.svg?width=890\"\u003e\u003c/a\u003e\n\n\n## Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Swift-Keylogger#sponsor)]\n\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/0/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/0/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/1/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/1/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/2/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/2/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/3/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/3/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/4/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/4/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/5/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/5/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/6/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/6/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/7/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/7/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/8/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/8/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/Swift-Keylogger/sponsor/9/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/Swift-Keylogger/sponsor/9/avatar.svg\"\u003e\u003c/a\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSkrewEverything%2FSwift-Keylogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSkrewEverything%2FSwift-Keylogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSkrewEverything%2FSwift-Keylogger/lists"}