murkgui.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # menu_plugin
  3. PLUGIN_NAME="murkgui"
  4. PLUGIN_FUNCTION="Start murkgui listener"
  5. PLUGIN_DESCRIPTION="Allows graphical plugins and menus to run commands on the system"
  6. PLUGIN_AUTHOR="rainestorme"
  7. PLUGIN_VERSION=1
  8. echo "Listening for commands on /home/chronos/user/Downloads/murkgui"
  9. echo "Press Ctrl+C to exit."
  10. mkdir -p /home/chronos/user/Downloads/murkgui
  11. touch /home/chronos/user/Downloads/murkgui/up
  12. touch /home/chronos/user/Downloads/murkgui/down
  13. doas() {
  14. ssh -t -p 1337 -i /rootkey -oStrictHostKeyChecking=no root@127.0.0.1 "$@"
  15. }
  16. while true; do
  17. if [ -f "/home/chronos/user/Downloads/murkgui/up" ]; then
  18. cmd=$(cat /home/chronos/user/Downloads/murkgui/up)
  19. echo " " > /home/chronos/user/Downloads/murkgui/up
  20. read -a cmd_array <<< "$cmd"
  21. if [[ "${cmd_array[0]}" == "exec" ]]; then
  22. exec="${cmd_array[@]:1}"
  23. doas "$exec > /home/chronos/user/Downloads/murkgui/down"
  24. elif [[ "${cmd_array[0]}" == "chronos" ]]; then
  25. exec="${cmd_array[@]:1}"
  26. $exec > /home/chronos/user/Downloads/murkgui/down
  27. fi
  28. fi
  29. sleep 0.1
  30. done