Making PoC follow spec regarding to the "kapow route" command and, incidentally creating a new "kapow server" command.

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-06-04 14:40:01 +02:00
parent e4cbb96cf4
commit 96739189f1
9 changed files with 93 additions and 98 deletions
+1 -1
View File
@@ -16,4 +16,4 @@
# limitations under the License.
#
kroute add -X POST '/eval' -c '$($(request /body) | response /stream)'
kapow route add -X POST '/eval' -c '$($(request /body) | response /stream)'
+1 -1
View File
@@ -16,4 +16,4 @@
# limitations under the License.
#
kroute add -X GET '/list/{ip}' -c 'nmap -sL $(request /match/ip) | response /body'
kapow route add -X GET '/list/{ip}' -c 'nmap -sL $(request /match/ip) | response /body'
+9 -9
View File
@@ -16,26 +16,26 @@
# limitations under the License.
#
kroute add /list/files -c 'ls -la $(request /param/path) | response /body'
kapow route add /list/files -c 'ls -la $(request /param/path) | response /body'
kroute add /list/processes -c 'ps -aux | response /body'
kapow route add /list/processes -c 'ps -aux | response /body'
kroute add /show/cpuinfo -c 'response /body < /proc/cpuinfo'
kapow route add /show/cpuinfo -c 'response /body < /proc/cpuinfo'
kroute add /show/memory -c 'free -m | response /body'
kapow route add /show/memory -c 'free -m | response /body'
kroute add /show/disk -c 'df -h | response /body'
kapow route add /show/disk -c 'df -h | response /body'
kroute add /show/connections -c 'ss -pluton | response /body'
kapow route add /show/connections -c 'ss -pluton | response /body'
kroute add /show/mounts -c 'mount | response /body'
kapow route add /show/mounts -c 'mount | response /body'
kroute add /tail/dmesg - <<-'EOF'
kapow route add /tail/dmesg - <<-'EOF'
response /header/Content-Type text/plain
dmesg -w | response /stream
EOF
kroute add /tail/journal - <<-'EOF'
kapow route add /tail/journal - <<-'EOF'
response /header/Content-Type text/plain
journalctl -f | response /stream
EOF
+3 -3
View File
@@ -16,11 +16,11 @@
# limitations under the License.
#
kroute add -X POST --entrypoint '/bin/zsh -c' '/convert/{from}/{to}' - <<-'EOF'
kapow route add -X POST --entrypoint '/bin/zsh -c' '/convert/{from}/{to}' - <<-'EOF'
pandoc --from=$(request /match/from) \
--to=$(request /match/to) \
--output=>(response /body) \
=(request /body)
EOF
kroute add -X GET '/formats/input' -c 'pandoc --list-input-formats | response /body'
kroute add -X GET '/formats/output' -c 'pandoc --list-output-formats | grep -v pdf | response /body'
kapow route add -X GET '/formats/input' -c 'pandoc --list-input-formats | response /body'
kapow route add -X GET '/formats/output' -c 'pandoc --list-output-formats | grep -v pdf | response /body'
+2 -2
View File
@@ -16,5 +16,5 @@
# limitations under the License.
#
kroute add -X POST --entrypoint ./topdf '/editor/pdf'
kroute add / -c 'response /header/Content-Type text/html && response /body < pdfeditor.html'
kapow route add -X POST --entrypoint ./topdf '/editor/pdf'
kapow route add / -c 'response /header/Content-Type text/html && response /body < pdfeditor.html'
+3 -3
View File
@@ -16,7 +16,7 @@
# limitations under the License.
#
kroute add / - <<-'EOF'
kapow route add / - <<-'EOF'
response /header/Content-Type text/html
response /body <<-HTML
<html>
@@ -27,7 +27,7 @@ kroute add / - <<-'EOF'
HTML
EOF
kroute add /save/magnet -e '/bin/bash -c' - <<-'EOF'
kapow route add /save/magnet -e '/bin/bash -c' - <<-'EOF'
link=$(request /param/link)
[ -z $link ] && response /status 400 && exit 0
@@ -40,4 +40,4 @@ kroute add /save/magnet -e '/bin/bash -c' - <<-'EOF'
response /header/Location /torrent/list
EOF
kroute add /torrent/list -c 'response /body "Not Implemented Yet"'
kapow route add /torrent/list -c 'response /body "Not Implemented Yet"'