Browse Source

Added support for unity3d engine

also minor display change to fn_serverquery (space between port and : )
pull/254/merge
Daniel Gibbs 10 years ago
parent
commit
21db3f635e
  1. 4
      GameServerQuery/gsquery.py
  2. 25
      functions/fn_serverquery

4
GameServerQuery/gsquery.py

@ -3,7 +3,7 @@
# Game Server Query
# Author: Anonymous & Daniel Gibbs
# # Website: http://danielgibbs.co.uk
# Version: 091214
# Version: 231214
import optparse
import socket
@ -25,6 +25,8 @@ class GameServer:
self.query_prompt_string = '\xFF\xFF\xFF\xFFTSource Engine Query\0'
if self.option.engine == 'realvirtuality':
self.query_prompt_string = '\xFF\xFF\xFF\xFFTSource Engine Query\0'
if self.option.engine == 'unity3d':
self.query_prompt_string = '\xFF\xFF\xFF\xFFTSource Engine Query\0'
elif self.option.engine == 'unreal':
self.query_prompt_string = '\x5C\x69\x6E\x66\x6F\x5C'
elif self.option.engine == 'unreal2':

25
functions/fn_serverquery

@ -2,7 +2,7 @@
# LGSM fn_serverquery function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 101214
# Version: 231214
# uses gsquery.py to directly query the server
# detects if the server locks up
@ -15,20 +15,23 @@ if [ -f gsquery.py ]; then
elif [ "${engine}" == "realvirtuality" ]; then
queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
port=${queryport}
elif [ "${engine}" == "unity3d" ]; then
gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd [:digit:])
port=$((${gameport} + 1))
fi
fn_printinfo "Monitoring ${servicename}: Detected gsquery.py"
fn_scriptlog "Detected gsquery.py"
sleep 1
fn_printdots "Monitoring ${servicename}: Querying port: ${ip}:${port}: QUERYING"
fn_scriptlog "Querying port: ${ip}:${port}: QUERYING"
fn_printdots "Monitoring ${servicename}: Querying port: ${ip}:${port} : QUERYING"
fn_scriptlog "Querying port: ${ip}:${port} : QUERYING"
sleep 1
serverquery=$(./gsquery.py -a ${ip} -p ${port} -e ${engine} 2>&1)
exitcode=$?
if [ "${exitcode}" == "1" ]||[ "${exitcode}" == "2" ]||[ "${exitcode}" == "3" ]||[ "${exitcode}" == "4" ]; then
fn_printfail "Monitoring ${servicename}: Querying port: ${ip}:${port}: ${serverquery}"
fn_printfail "Monitoring ${servicename}: Querying port: ${ip}:${port} : ${serverquery}"
sleep 1
echo -en "\n"
fn_scriptlog "Querying port: ${ip}:${port}: ${serverquery}"
fn_scriptlog "Querying port: ${ip}:${port} : ${serverquery}"
if [[ -z "${secondquery}" ]]; then
fn_printinfo "Monitoring ${servicename}: Waiting 30 seconds to re-query"
fn_scriptlog "Waiting 30 seconds to re-query"
@ -45,14 +48,14 @@ if [ -f gsquery.py ]; then
fn_restartserver
exit
elif [ "${exitcode}" == "0" ]; then
fn_printok "Monitoring ${servicename}: Querying port: ${ip}:${port}: OK"
fn_scriptlog "Querying port: ${ip}:${port}: OK"
fn_printok "Monitoring ${servicename}: Querying port: ${ip}:${port} : OK"
fn_scriptlog "Querying port: ${ip}:${port} : OK"
sleep 1
echo -en "\n"
exit
elif [ "${exitcode}" == "126" ]; then
fn_printfail "Monitoring ${servicename}: Querying port: ${ip}:${port}: ERROR: ./gsquery.py: Permission denied"
fn_scriptlog "Querying port: ${ip}:${port}: ./gsquery.py: Permission denied"
fn_printfail "Monitoring ${servicename}: Querying port: ${ip}:${port} : ERROR: ./gsquery.py: Permission denied"
fn_scriptlog "Querying port: ${ip}:${port} : ./gsquery.py: Permission denied"
sleep 1
echo -en "\n"
echo "Attempting to resolve automatically"
@ -69,8 +72,8 @@ if [ -f gsquery.py ]; then
exit
fi
else
fn_printfail "Monitoring ${servicename}: Querying port: ${ip}:${port}: UNKNOWN ERROR"
fn_scriptlog "Querying port: ${ip}:${port}: UNKNOWN ERROR"
fn_printfail "Monitoring ${servicename}: Querying port: ${ip}:${port} : UNKNOWN ERROR"
fn_scriptlog "Querying port: ${ip}:${port} : UNKNOWN ERROR"
sleep 1
echo -en "\n"
./gsquery.py -a ${ip} -p ${port} -e ${engine}

Loading…
Cancel
Save