command_dev_query_raw.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  2. # command_dev_query_raw.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Raw gamedig output of the server.
  6. local modulename="QUERY-RAW"
  7. local commandaction="Query Raw"
  8. local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  9. echo -e ""
  10. echo -e "Query Port - Raw Output"
  11. echo -e "=================================================================="
  12. echo -e ""
  13. echo -e "Gamedig Raw Output"
  14. echo -e "================================="
  15. echo -e ""
  16. if [ ! "$(command -v gamedig 2>/dev/null)" ]; then
  17. fn_print_failure_nl "gamedig not installed"
  18. fi
  19. if [ ! "$(command -v jq 2>/dev/null)" ]; then
  20. fn_print_failure_nl "jq not installed"
  21. fi
  22. check.sh
  23. info_config.sh
  24. info_parms.sh
  25. query_gamedig.sh
  26. echo -e "${gamedigcmd}"
  27. echo""
  28. echo -e "${gamedigraw}" | jq
  29. echo -e ""
  30. echo -e "gsquery Raw Output"
  31. echo -e "================================="
  32. echo -e ""
  33. echo -e "./query_gsquery.py -a \"${ip}\" -p \"${queryport}\" -e \"${querytype}\""
  34. echo -e ""
  35. if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
  36. fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
  37. fi
  38. "${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${querytype}"
  39. echo -e ""
  40. echo -e "TCP Raw Output"
  41. echo -e "================================="
  42. echo -e ""
  43. echo -e "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''"
  44. echo -e ""
  45. bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''
  46. querystatus="$?"
  47. echo -e ""
  48. if [ "${querystatus}" == "0" ]; then
  49. echo -e "TCP query PASS"
  50. else
  51. echo -e "TCP query FAIL"
  52. fi
  53. echo -e ""
  54. echo -e "Game Port - Raw Output"
  55. echo -e "=================================================================="
  56. echo -e ""
  57. echo -e "TCP Raw Output"
  58. echo -e "================================="
  59. echo -e ""
  60. echo -e "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}''"
  61. echo -e ""
  62. bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}''
  63. querystatus="$?"
  64. echo -e ""
  65. if [ "${querystatus}" == "0" ]; then
  66. echo -e "TCP query PASS"
  67. else
  68. echo -e "TCP query FAIL"
  69. fi
  70. core_exit.sh