Fix rapcapture
This commit is contained in:
parent
d48ca89d20
commit
304ea888ff
6
Makefile
6
Makefile
@ -4,7 +4,8 @@ weave:
|
|||||||
util/removefencedcode.py
|
util/removefencedcode.py
|
||||||
tangle:
|
tangle:
|
||||||
srcweave --formatter srcweave-format --tangle smartkeyboard/ ReadMe.md security/Authentication.md EnvironmentVariables.md Dependencies.md \
|
srcweave --formatter srcweave-format --tangle smartkeyboard/ ReadMe.md security/Authentication.md EnvironmentVariables.md Dependencies.md \
|
||||||
server/Server.md server/Streaming.md server/Sendkeys.md server/XdotoolCommands.md ThreatModel.md Client.md tools/Tools.md tools/Editor.md tools/Input.md
|
server/Server.md server/Streaming.md server/Sendkeys.md server/XdotoolCommands.md ThreatModel.md Client.md tools/Tools.md tools/Editor.md tools/Input.md \
|
||||||
|
tools/RawCapture.md
|
||||||
clean:
|
clean:
|
||||||
rm -rf docs
|
rm -rf docs
|
||||||
find smartkeyboard/ -type f -not -name "*_test.go" -delete
|
find smartkeyboard/ -type f -not -name "*_test.go" -delete
|
||||||
@ -18,6 +19,9 @@ build: tangle
|
|||||||
- cd smartkeyboard/client && go mod init keyboard.voidnet.tech
|
- cd smartkeyboard/client && go mod init keyboard.voidnet.tech
|
||||||
- cd smartkeyboard/client && go mod tidy
|
- cd smartkeyboard/client && go mod tidy
|
||||||
- cd smartkeyboard/client && go build -o ../../bin/keyboard-client
|
- cd smartkeyboard/client && go build -o ../../bin/keyboard-client
|
||||||
|
- cd smartkeyboard/tools/rawcapture && go mod init rawcapture.keyboard.voidnet.tech
|
||||||
|
- cd smartkeyboard/tools/rawcapture && go mod tidy
|
||||||
|
- cd smartkeyboard/tools/rawcapture && go build -o ../../../bin/rawcapture
|
||||||
|
|
||||||
|
|
||||||
test: tangle
|
test: tangle
|
||||||
|
101
tools/RawCapture.md
Normal file
101
tools/RawCapture.md
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# Raw Capture
|
||||||
|
|
||||||
|
This tool captures keyboard input from /dev/input/eventX and pipes it to the fifo accordingly.
|
||||||
|
|
||||||
|
It is meant to be ran from it's own tty, and is not meant to be used with a graphical environment, although a full screen terminal emulator will work for most input.
|
||||||
|
|
||||||
|
An escape sequence of escape+f1 will exit the program, but this can be changed via a command line argument.
|
||||||
|
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
This mode is especially useful for workflows with a lot of keyboard shortcuts or use of modifier keys, for example i3wm.
|
||||||
|
|
||||||
|
Generally a user would be in this mode when not typing extensively.
|
||||||
|
|
||||||
|
# Entrypoint
|
||||||
|
|
||||||
|
``` go
|
||||||
|
|
||||||
|
--- /tools/rawcapture/rawcapture.go
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
//"os/signal"
|
||||||
|
"github.com/MarinX/keylogger"
|
||||||
|
)
|
||||||
|
//ioutil.WriteFile(clientFifoInputFile, []byte(input), 0644)
|
||||||
|
|
||||||
|
/*
|
||||||
|
func receive(signalCh chan os.Signal, doneCh chan struct{}) {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
// Example. Process to receive a message
|
||||||
|
// case msg := <-receiveMessage():
|
||||||
|
case <-signalCh:
|
||||||
|
pass
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
func main(){
|
||||||
|
@{get client fifo input file from environment}
|
||||||
|
if ! clientFifoInputFileEnvExists {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
doneCh := make(chan struct{})
|
||||||
|
|
||||||
|
signalCh := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(signalCh, os.Interrupt)
|
||||||
|
|
||||||
|
go receive(signalCh, doneCh)
|
||||||
|
*/
|
||||||
|
|
||||||
|
keyboard := keylogger.FindKeyboardDevice()
|
||||||
|
if keyboard == "" {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
k, err := keylogger.New(keyboard)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("could not get keyboard")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
events := k.Read()
|
||||||
|
var key = ""
|
||||||
|
//byte keyByte = 0
|
||||||
|
|
||||||
|
// range of events
|
||||||
|
for e := range events {
|
||||||
|
switch e.Type {
|
||||||
|
// EvKey is used to describe state changes of keyboards, buttons, or other key-like devices.
|
||||||
|
// check the input_event.go for more events
|
||||||
|
case keylogger.EvKey:
|
||||||
|
key = e.KeyString()
|
||||||
|
if len(key) == 0{
|
||||||
|
fmt.Println(e.Code)
|
||||||
|
}
|
||||||
|
// if the state of key is pressed
|
||||||
|
if e.KeyPress() {
|
||||||
|
ioutil.WriteFile(clientFifoInputFile, []byte(fmt.Sprintf("{KEYDWN}%s", key)), 0644)
|
||||||
|
//fmt.Println(e.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the state of key is released
|
||||||
|
if e.KeyRelease() {
|
||||||
|
ioutil.WriteFile(clientFifoInputFile, []byte(fmt.Sprintf("{KEYUP}%s", key)), 0644)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
---
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user