command_dev_query_raw.sh 2.5 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 ""
  10. echo "Query Port"
  11. echo "=================================================================="
  12. echo ""
  13. echo "Gamedig Raw Output"
  14. echo "================================="
  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 "${gamedigcmd}"
  32. echo""
  33. echo "${gamedigraw}" | jq
  34. echo""
  35. echo "gsquery Raw Output"
  36. echo "================================="
  37. echo""
  38. echo "./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 "TCP Raw Output"
  45. echo "================================="
  46. echo""
  47. echo "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 "TCP query PASS"
  52. else
  53. echo "TCP query FAIL"
  54. fi
  55. echo""
  56. echo "UDP Raw Output"
  57. echo "================================="
  58. echo""
  59. echo "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 "UPD query PASS"
  64. else
  65. echo "UPD query FAIL"
  66. fi
  67. echo ""
  68. echo "Game Port"
  69. echo "=================================================================="
  70. echo ""
  71. echo""
  72. echo "TCP Raw Output"
  73. echo "================================="
  74. echo""
  75. echo "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 "TCP query PASS"
  80. else
  81. echo "TCP query FAIL"
  82. fi
  83. echo""
  84. echo "UDP Raw Output"
  85. echo "================================="
  86. echo""
  87. echo "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 "UDP query PASS"
  92. else
  93. echo "UDP query FAIL"
  94. fi