command_dev_query_raw.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. commandname="DEV-QUERY-RAW"
  7. commandaction="Developer query raw"
  8. functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  9. check.sh
  10. info_config.sh
  11. info_parms.sh
  12. echo -e ""
  13. echo -e "Query Port - Raw Output"
  14. echo -e "=================================================================="
  15. echo -e ""
  16. echo -e "Ports"
  17. echo -e "================================="
  18. echo -e ""
  19. echo -e "PORT: ${port}"
  20. echo -e "QUERY PORT: ${queryport}"
  21. echo -e ""
  22. echo -e "Gamedig Raw Output"
  23. echo -e "================================="
  24. echo -e ""
  25. if [ ! "$(command -v gamedig 2>/dev/null)" ]; then
  26. fn_print_failure_nl "gamedig not installed"
  27. fi
  28. if [ ! "$(command -v jq 2>/dev/null)" ]; then
  29. fn_print_failure_nl "jq not installed"
  30. fi
  31. query_gamedig.sh
  32. echo -e "${gamedigcmd}"
  33. echo""
  34. echo -e "${gamedigraw}" | jq
  35. echo -e ""
  36. echo -e "gsquery Raw Output"
  37. echo -e "================================="
  38. echo -e ""
  39. echo -e "./query_gsquery.py -a \"${ip}\" -p \"${queryport}\" -e \"${querytype}\""
  40. echo -e ""
  41. if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
  42. fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
  43. fi
  44. "${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${querytype}"
  45. echo -e ""
  46. echo -e "TCP Raw Output"
  47. echo -e "================================="
  48. echo -e ""
  49. echo -e "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''"
  50. echo -e ""
  51. bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''
  52. querystatus="$?"
  53. echo -e ""
  54. if [ "${querystatus}" == "0" ]; then
  55. echo -e "TCP query PASS"
  56. else
  57. echo -e "TCP query FAIL"
  58. fi
  59. echo -e ""
  60. echo -e "Game Port - Raw Output"
  61. echo -e "=================================================================="
  62. echo -e ""
  63. echo -e "TCP Raw Output"
  64. echo -e "================================="
  65. echo -e ""
  66. echo -e "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}''"
  67. echo -e ""
  68. bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}''
  69. querystatus="$?"
  70. echo -e ""
  71. if [ "${querystatus}" == "0" ]; then
  72. echo -e "TCP query PASS"
  73. else
  74. echo -e "TCP query FAIL"
  75. fi
  76. exitcode=0
  77. core_exit.sh