From ab48c0b7f05c732b1486a85ff865ed5df7e1282c Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 7 May 2019 20:25:17 +0100 Subject: [PATCH] feat(query-raw): add TCP/UDP query to game port (#2341) --- lgsm/functions/command_dev_query_raw.sh | 50 +++++++++++++++++++------ 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh index 4d57e8aca..79072468f 100644 --- a/lgsm/functions/command_dev_query_raw.sh +++ b/lgsm/functions/command_dev_query_raw.sh @@ -7,8 +7,10 @@ local commandname="QUERY-RAW" local commandaction="Query Raw" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" - -echo "=================================" +echo "" +echo "Query Port" +echo "==================================================================" +echo "" echo "Gamedig Raw Output" echo "=================================" echo"" @@ -33,7 +35,6 @@ echo "${gamedigcmd}" echo"" echo "${gamedigraw}" | jq echo"" -echo "=================================" echo "gsquery Raw Output" echo "=================================" echo"" @@ -44,29 +45,56 @@ fi "${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${engine}" echo"" -echo "=================================" -echo "tcp Raw Output" +echo "TCP Raw Output" echo "=================================" echo"" echo "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''" bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}'' querystatus="$?" if [ "${querystatus}" == "0" ]; then - echo "tcp query PASS" + echo "TCP query PASS" else - echo "tcp query FAIL" + echo "TCP query FAIL" fi echo"" -echo "=================================" -echo "udp Raw Output" +echo "UDP Raw Output" echo "=================================" echo"" echo "bash -c 'exec 3<> /dev/udp/'${ip}'/'${queryport}''" bash -c 'exec 3<> /dev/udp/'${ip}'/'${queryport}'' querystatus="$?" if [ "${querystatus}" == "0" ]; then - echo "udp query PASS" + echo "UPD query PASS" +else + echo "UPD query FAIL" +fi +echo "" +echo "Game Port" +echo "==================================================================" +echo "" +echo"" +echo "TCP Raw Output" +echo "=================================" +echo"" +echo "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}''" +bash -c 'exec 3<> /dev/tcp/'${ip}'/'${port}'' +querystatus="$?" +if [ "${querystatus}" == "0" ]; then + echo "TCP query PASS" +else + echo "TCP query FAIL" +fi + +echo"" +echo "UDP Raw Output" +echo "=================================" +echo"" +echo "bash -c 'exec 3<> /dev/udp/'${ip}'/'${port}''" +bash -c 'exec 3<> /dev/udp/'${ip}'/'${port}'' +querystatus="$?" +if [ "${querystatus}" == "0" ]; then + echo "UDP query PASS" else - echo "udp query FAIL" + echo "UDP query FAIL" fi