command_dev_query_raw.sh 2.2 KB

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