You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-2Lines changed: 64 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# macOS Keylogger
1
+
# macOS Swift-Keylogger
2
2
3
3
[](#backers)[](#sponsors)[]()
4
4
@@ -10,7 +10,6 @@ So, I don't want to keep checking about the availability of their APIs and chang
10
10
11
11
Most of the keyloggers available only log keystrokes into a file without much information about on which app the keystrokes are generated.
12
12
13
-
>Note: This keylogger doesn't capture secure input fields like passwords due to [`EnableSecureEventInput`](https://developer.apple.com/library/content/technotes/tn2150/_index.html)
14
13
15
14
## Usage
16
15
@@ -50,11 +49,74 @@ By default, it creates a folder where the executable is present.
50
49
To change the path edit `bundlePathURL` in `Keylogger.swift`
51
50
##### All the data is grouped according to day in each folder.
52
51
52
+
## Integrating Swift-Keylogger with Cocoa App
53
+
54
+
There are 2 ways:
55
+
56
+
1. Using the executable(By using `Process` to call the external binaries from Cocoa App).
57
+
2. Using source code in your App without the need for external binary
58
+
59
+
### Using executable
60
+
> 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.
61
+
62
+
1. Clone it and build the project by yourself or download the already built binary from the releases page.
63
+
2. Use [`Process`](https://developer.apple.com/documentation/foundation/process) to run the external binary from your app.
64
+
3.**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!**
65
+
66
+
### Using Source code
67
+
68
+
**1.** Add `Keylogger.swift` and `CallBackFunctions.swift` files to your project.
69
+
70
+
**2.** Initialize the Keylogger as a static variable and use `start()` and `stop()` to start and stop the keylogger.
71
+
72
+
#### Example of ViewController.swift
73
+
```swift
74
+
importCocoa
75
+
76
+
77
+
classViewController: NSViewController {
78
+
79
+
// Initialize the Keylogger
80
+
staticvar k =Keylogger()
81
+
82
+
overridefuncviewDidLoad() {
83
+
super.viewDidLoad()
84
+
85
+
// Do any additional setup after loading the view.
86
+
}
87
+
88
+
overridevar representedObject: Any? {
89
+
didSet {
90
+
// Update the view, if already loaded.
91
+
}
92
+
}
93
+
94
+
// A button to start the keylogger
95
+
@IBActionfuncstart(_sender: Any) {
96
+
ViewController.k.start()
97
+
}
98
+
99
+
// A button to stop the keylogger
100
+
@IBActionfuncstop(_sender: Any) {
101
+
ViewController.k.stop()
102
+
}
103
+
}
104
+
```
105
+
106
+
**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:
107
+
108
+
```
109
+
com.apple.security.device.usb = YES
110
+
```
111
+
112
+
53
113
## Disclaimer
54
114
If the use of this product causes the death of your firstborn or anyone, I'm not responsible ( no warranty, no liability, etc.)
55
115
56
116
For technical people: It is only for educational purpose.
57
117
118
+
>Note: This keylogger doesn't capture secure input fields like passwords due to [`EnableSecureEventInput`](https://developer.apple.com/library/content/technotes/tn2150/_index.html)
0 commit comments