Implemented basic TUI
This commit is contained in:
parent
21c1d468a4
commit
0cb8c59882
16
Makefile
16
Makefile
@ -1,12 +1,12 @@
|
||||
weave:
|
||||
srcweave --formatter srcweave-format --weave docs/ ReadMe.md Building.md Dependencies.md EnvironmentVariables.md LICENSE.md \
|
||||
security/Authentication.md security/ThreatModel.md Plumbing.md server/Server.md server/Streaming.md server/Sendkeys.md server/XdotoolCommands.md \
|
||||
Client.md tools/Tools.md tools/Editor.md tools/Input.md tools/RawCapture.md
|
||||
Client.md tools/Tools.md tools/Editor.md tools/Input.md tools/RawCapture.md tools/TUI.md
|
||||
util/clean.py
|
||||
tangle:
|
||||
srcweave --formatter srcweave-format --tangle smartkeyboard/ ReadMe.md Plumbing.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 \
|
||||
tools/RawCapture.md
|
||||
server/Server.md server/Streaming.md server/Sendkeys.md server/XdotoolCommands.md security/ThreatModel.md Client.md tools/Tools.md tools/Editor.md tools/Input.md \
|
||||
tools/RawCapture.md tools/TUI.md
|
||||
clean:
|
||||
rm -rf docs
|
||||
find smartkeyboard/ -type f -not -name "*_test.go" -delete
|
||||
@ -20,6 +20,16 @@ build: tangle
|
||||
- cd smartkeyboard/client && go mod init keyboard.voidnet.tech
|
||||
- cd smartkeyboard/client && go mod tidy
|
||||
- cd smartkeyboard/client && go build -tags osusergo,netgo -o ../../bin/keyboard-client
|
||||
- cd smartkeyboard/tools/editor && go mod init keyboard.voidnet.tech
|
||||
- cd smartkeyboard/tools/editor && go mod tidy
|
||||
- cd smartkeyboard/tools/editor && go build -tags osusergo,netgo -o ../../../bin/keyboard-editor
|
||||
- cd smartkeyboard/tools/input && go mod init keyboard.voidnet.tech
|
||||
- cd smartkeyboard/tools/input && go mod tidy
|
||||
- cd smartkeyboard/tools/input && go build -tags osusergo,netgo -o ../../../bin/keyboard-input
|
||||
- cp smartkeyboard/tools/rawcapture/rawcapture.py bin/keyboard-rawcapture.py
|
||||
- chmod +x bin/keyboard-rawcapture.py
|
||||
- cp smartkeyboard/tools/tui/tui.py bin/tui.py
|
||||
- chmod +x bin/tui.py
|
||||
|
||||
test: tangle
|
||||
-cd smartkeyboard && go mod init keyboard.voidnet.tech
|
||||
|
17
ReadMe.md
17
ReadMe.md
@ -77,12 +77,6 @@ On first run it will output your authentication token. Store it in a safe place
|
||||
|
||||
It is highly recommended to use SSH forwarding (preferred) or a reverse https proxy to access the server.
|
||||
|
||||
### SSH example
|
||||
|
||||
To connect with ssh, run this on the client:
|
||||
|
||||
`ssh -R 8080:localhost:8080 user@myserver`
|
||||
|
||||
|
||||
### Socket file
|
||||
|
||||
@ -94,5 +88,16 @@ It is more secure and mildly more efficient to use a unix socket file. To do thi
|
||||
|
||||
From here you can use any program that can write to a FIFO to send keystrokes to the server. For example, you could use `cat` to send a file to the server, or `cowsay` to send a cow message to the server.
|
||||
|
||||
|
||||
### SSH example
|
||||
|
||||
To connect with ssh, run this on the client:
|
||||
|
||||
`ssh -R 8080:localhost:8080 user@myserver`
|
||||
|
||||
You would then run the above keyboard-client command with `ws://localhost:8080/sendkeys` as the argument.
|
||||
|
||||
### Tools
|
||||
|
||||
There are a few tools provided to help you get started. They are all in the `tools` directory.
|
||||
|
||||
|
@ -19,8 +19,8 @@ import (
|
||||
|
||||
func main(){
|
||||
var input string
|
||||
@{get client input file from environment}
|
||||
if ! clientFifoInputFileExists {
|
||||
@{get client fifo input file from environment}
|
||||
if ! clientFifoInputFileEnvExists {
|
||||
os.Exit(1)
|
||||
}
|
||||
for {
|
||||
|
43
tools/TUI.md
43
tools/TUI.md
@ -1,3 +1,44 @@
|
||||
# SmartKeyboardTUI
|
||||
|
||||
SmartKeyboardTUI is a terminal user interface for SmartKeyboard. It wraps the other tools in this repository.
|
||||
SmartKeyboardTUI is a terminal user interface for SmartKeyboard. It wraps other commands and provides a way to quickly switch between them.
|
||||
|
||||
The commands it wraps are arbitrary and defined in commands.txt. The commands.txt file is a simple text file with one command per line. The first word of each line is the command name, and the rest of the line is the command to run. The command name is used to switch to that command. The command is run with the shell, so you can use pipes, redirection, etc.
|
||||
|
||||
|
||||
``` python
|
||||
--- /tools/tui/tui.py
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
with open("commands.txt") as f:
|
||||
commands = [line.strip().split(" ", 1) for line in f.readlines()]
|
||||
|
||||
|
||||
output_file = os.getenv("KEYBOARD_FIFO", sys.stdout)
|
||||
|
||||
while True:
|
||||
for c, cmd in enumerate(commands):
|
||||
print(f"\r{c+1}: {cmd[0]} ")
|
||||
print('\n\r', end='')
|
||||
try:
|
||||
inp = sys.stdin.read(1)
|
||||
inp = int(inp)
|
||||
except ValueError:
|
||||
if inp == "q":
|
||||
break
|
||||
inp = 0
|
||||
continue
|
||||
if inp < 1 or inp > len(commands):
|
||||
continue
|
||||
cmd = commands[inp-1][1]
|
||||
subprocess.run(cmd, shell=True, stdout=output_file)
|
||||
print('\n\r')
|
||||
|
||||
---
|
||||
|
||||
|
||||
```
|
Loading…
Reference in New Issue
Block a user