command_dev_query_raw.sh 2.2 KB

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