mostly working
This commit is contained in:
parent
304ea888ff
commit
6fcaba194a
@ -30,7 +30,7 @@ We use keylogger to get keyboard input on the client and simulate keystrokes on
|
|||||||
|
|
||||||
--- keylogger import string
|
--- keylogger import string
|
||||||
|
|
||||||
"github.com/MarinX/keylogger"
|
"github.com/EgosOwn/keylogger"
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -51,6 +51,13 @@ markdown book is actually the source code
|
|||||||
* Well defined [threat model](ThreatModel.md)
|
* Well defined [threat model](ThreatModel.md)
|
||||||
|
|
||||||
|
|
||||||
|
# Running
|
||||||
|
|
||||||
|
## Server
|
||||||
|
|
||||||
|
`sudo KEYBOARD_TCP_BIND_ADDRESS=0.0 KEYBOARD_TCP_BIND_PORT=8080 ./keyboard`
|
||||||
|
|
||||||
|
|
||||||
# Entrypoint
|
# Entrypoint
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
//"os/signal"
|
//"os/signal"
|
||||||
"github.com/MarinX/keylogger"
|
"github.com/EgosOwn/keylogger"
|
||||||
)
|
)
|
||||||
//ioutil.WriteFile(clientFifoInputFile, []byte(input), 0644)
|
//ioutil.WriteFile(clientFifoInputFile, []byte(input), 0644)
|
||||||
|
|
||||||
@ -57,16 +57,27 @@ func main(){
|
|||||||
|
|
||||||
go receive(signalCh, doneCh)
|
go receive(signalCh, doneCh)
|
||||||
*/
|
*/
|
||||||
|
keyboard := ""
|
||||||
|
|
||||||
keyboard := keylogger.FindKeyboardDevice()
|
|
||||||
|
if len(os.Args) > 1 {
|
||||||
|
keyboard = os.Args[1]
|
||||||
|
} else {
|
||||||
|
keyboard = keylogger.FindKeyboardDevice()
|
||||||
|
}
|
||||||
if keyboard == "" {
|
if keyboard == "" {
|
||||||
|
fmt.Println("could not find keyboard")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
fmt.Println("Using keyboard " + keyboard)
|
||||||
|
|
||||||
|
|
||||||
k, err := keylogger.New(keyboard)
|
k, err := keylogger.New(keyboard)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("could not get keyboard")
|
fmt.Println("could not get keyboard")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
defer k.Close()
|
||||||
|
|
||||||
events := k.Read()
|
events := k.Read()
|
||||||
var key = ""
|
var key = ""
|
||||||
@ -78,18 +89,19 @@ func main(){
|
|||||||
// EvKey is used to describe state changes of keyboards, buttons, or other key-like devices.
|
// EvKey is used to describe state changes of keyboards, buttons, or other key-like devices.
|
||||||
// check the input_event.go for more events
|
// check the input_event.go for more events
|
||||||
case keylogger.EvKey:
|
case keylogger.EvKey:
|
||||||
key = e.KeyString()
|
|
||||||
if len(key) == 0{
|
|
||||||
fmt.Println(e.Code)
|
|
||||||
}
|
|
||||||
// if the state of key is pressed
|
// if the state of key is pressed
|
||||||
if e.KeyPress() {
|
if e.KeyPress() {
|
||||||
|
key = e.KeyString()
|
||||||
|
fmt.Println(key)
|
||||||
|
fmt.Println(e.Code)
|
||||||
ioutil.WriteFile(clientFifoInputFile, []byte(fmt.Sprintf("{KEYDWN}%s", key)), 0644)
|
ioutil.WriteFile(clientFifoInputFile, []byte(fmt.Sprintf("{KEYDWN}%s", key)), 0644)
|
||||||
//fmt.Println(e.Code)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the state of key is released
|
// if the state of key is released
|
||||||
if e.KeyRelease() {
|
if e.KeyRelease() {
|
||||||
|
key = e.KeyString()
|
||||||
ioutil.WriteFile(clientFifoInputFile, []byte(fmt.Sprintf("{KEYUP}%s", key)), 0644)
|
ioutil.WriteFile(clientFifoInputFile, []byte(fmt.Sprintf("{KEYUP}%s", key)), 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user