command_dev_query_raw.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 commandname="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"
  11. echo -e "=================================================================="
  12. echo -e ""
  13. echo -e "Gamedig Raw Output"
  14. echo -e "================================="
  15. echo""
  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. if [ "${engine}" == "idtech3_ql" ]; then
  26. local engine="quakelive"
  27. elif [ "${shortname}" == "kf2" ]; then
  28. local engine="unreal4"
  29. fi
  30. query_gamedig.sh
  31. echo -e "${gamedigcmd}"
  32. echo""
  33. echo -e "${gamedigraw}" | jq
  34. echo""
  35. echo -e "gsquery Raw Output"
  36. echo -e "================================="
  37. echo""
  38. echo -e "./query_gsquery.py -a \"${ip}\" -p \"${queryport}\" -e \"${engine}\""
  39. if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
  40. fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
  41. fi
  42. "${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${engine}"
  43. echo""
  44. echo -e "TCP Raw Output"
  45. echo -e "================================="
  46. echo""
  47. echo -e "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''"
  48. bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''
  49. querystatus="$?"
  50. if [ "${querystatus}" == "0" ]; then
  51. echo -e "TCP query PASS"
  52. else
  53. echo -e "TCP query FAIL"
  54. fi
  55. echo""
  56. echo -e "UDP Raw Output"
  57. echo -e "================================="
  58. echo""
  59. echo -e "bash -c 'exec 3<> /dev/udp/'${ip}'/'${queryport}''"
  60. bash -c 'exec 3<> /dev/udp/'${ip}'/'${queryport}''
  61. querystatus="$?"
  62. if [ "${querystatus}" == "0" ]; then
  63. echo -e "UPD query PASS"
  64. else
  65. echo -e "UPD query FAIL"
  66. fi
  67. echo -e ""
  68. echo -e "Game Port"
  69. echo -e "=================================================================="
  70. echo -e ""
  71. echo""
  72. echo -e "TCP Raw Output"
  73. echo -e "================================="
  74. echo""
  75. echo -e "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}''"
  76. bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}''
  77. querystatus="$?"
  78. if [ "${querystatus}" == "0" ]; then
  79. echo -e "TCP query PASS"
  80. else
  81. echo -e "TCP query FAIL"
  82. fi
  83. echo""
  84. echo -e "UDP Raw Output"
  85. echo -e "================================="
  86. echo""
  87. echo -e "bash -c 'exec 3<> /dev/udp/'${ip}'/'${port}''"
  88. bash -c 'exec 3<> /dev/udp/'${ip}'/'${port}''
  89. querystatus="$?"
  90. if [ "${querystatus}" == "0" ]; then
  91. echo -e "UDP query PASS"
  92. else
  93. echo -e "UDP query FAIL"
  94. fi