Skip to content

Commit 4c690e8

Browse files
committed
Merge branch 'feature/query-raw' into develop
2 parents 0ab5734 + 25c319e commit 4c690e8

File tree

3 files changed

+62
-12
lines changed

3 files changed

+62
-12
lines changed

lgsm/functions/command_dev_query_raw.sh

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,59 @@ info_config.sh
1515
info_parms.sh
1616

1717
echo -e ""
18-
echo -e "Query Port - Raw Output"
18+
echo -e "${lightgreen}Query IP Addresses${default}"
1919
echo -e "=================================================================="
2020
echo -e ""
21-
echo -e "QUERY IP"
2221
for queryip in "${queryips[@]}"; do
2322
echo -e "${queryip}"
2423
done
24+
echo -e ""
25+
echo -e "${lightgreen}Game Server Ports${default}"
26+
echo -e "=================================================================="
27+
{
28+
echo -e "${lightblue}Port Name\tPort Number\tStatus\tTCP\tUDP${default}"
29+
if [ -v port ]; then
30+
echo -e "Game:\t${port}\t$(ss -tupl|grep ${port}|wc -l)\t$(ss -tupl|grep ${port}|grep tcp|awk '{ print $2 }')\t$(ss -tupl|grep ${port}|grep udp|awk '{ print $2 }')"
31+
else
32+
echo -e "Game:\tN/A"
33+
fi
34+
35+
if [ -v queryport ]; then
36+
echo -e "Query:\t${queryport}\t$(ss -tupl|grep ${queryport}|wc -l)\t$(ss -tupl|grep ${queryport}|grep tcp|awk '{ print $2 }')\t$(ss -tupl|grep ${queryport}|grep udp|awk '{ print $2 }')"
37+
else
38+
echo -e "Query:\tN/A"
39+
fi
40+
41+
if [ -v clientport ]; then
42+
echo -e "Client:\t${clientport}\t$(ss -tupl|grep ${clientport}|wc -l)\t$(ss -tupl|grep ${clientport}|grep tcp|awk '{ print $2 }')\t$(ss -tupl|grep ${clientport}|grep udp|awk '{ print $2 }')"
43+
else
44+
echo -e "Client:\tN/A"
45+
fi
46+
47+
if [ -v rconport ]; then
48+
echo -e "RCON:\t${rconport}\t$(ss -tupl|grep ${rconport}|wc -l)\t$(ss -tupl|grep ${rconport}|grep tcp|awk '{ print $2 }')\t$(ss -tupl|grep ${rconport}|grep udp|awk '{ print $2 }')"
49+
else
50+
echo -e "RCON:\tN/A"
51+
fi
52+
53+
if [ -v httpport ]; then
54+
echo -e "HTTP:\t${httpport}\t$(ss -tupl|grep ${httpport}|wc -l)\t$(ss -tupl|grep ${httpport}|grep tcp|awk '{ print $2 }')\t$(ss -tupl|grep ${httpport}|grep udp|awk '{ print $2 }')"
55+
else
56+
echo -e "HTTP:\tN/A"
57+
fi
58+
} | column -s $'\t' -t
59+
echo -e ""
60+
echo -e "${lightgreen}Query Port - Raw Output${default}"
61+
echo -e "=================================================================="
62+
2563
echo -e "================================="
26-
echo -e "Ports"
64+
echo -e "${lightgreen}Ports${default}"
2765
echo -e "================================="
2866
echo -e ""
2967
echo -e "PORT: ${port}"
3068
echo -e "QUERY PORT: ${queryport}"
3169
echo -e ""
32-
echo -e "Gamedig Raw Output"
70+
echo -e "${lightgreen}Gamedig Raw Output${default}"
3371
echo -e "================================="
3472
echo -e ""
3573
if [ ! "$(command -v gamedig 2>/dev/null)" ]; then
@@ -45,7 +83,7 @@ for queryip in "${queryips[@]}"; do
4583
echo "${gamedigraw}" | jq
4684
done
4785
echo -e ""
48-
echo -e "gsquery Raw Output"
86+
echo -e "${lightgreen}gsquery Raw Output${default}"
4987
echo -e "================================="
5088
echo -e ""
5189
for queryip in "${queryips[@]}"; do
@@ -57,7 +95,7 @@ for queryip in "${queryips[@]}"; do
5795
"${functionsdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}"
5896
done
5997
echo -e ""
60-
echo -e "TCP Raw Output"
98+
echo -e "${lightgreen}TCP Raw Output${default}"
6199
echo -e "================================="
62100
echo -e ""
63101
for queryip in "${queryips[@]}"; do
@@ -73,10 +111,10 @@ for queryip in "${queryips[@]}"; do
73111
fi
74112
done
75113
echo -e ""
76-
echo -e "Game Port - Raw Output"
114+
echo -e "${lightgreen}Game Port - Raw Output${default}"
77115
echo -e "=================================================================="
78116
echo -e ""
79-
echo -e "TCP Raw Output"
117+
echo -e "${lightgreen}TCP Raw Output${default}"
80118
echo -e "================================="
81119
echo -e ""
82120
for queryip in "${queryips[@]}"; do
@@ -91,5 +129,15 @@ for queryip in "${queryips[@]}"; do
91129
echo -e "TCP query FAIL"
92130
fi
93131
done
132+
echo -e ""
133+
echo -e "${lightgreen}Steam Master Server Response${default}"
134+
echo -e "=================================================================="
135+
echo -e ""
136+
137+
echo -e ""
138+
echo -e "${lightgreen}ss Details${default}"
139+
echo -e "=================================================================="
140+
echo -e ""
141+
94142
exitcode=0
95143
core_exit.sh

lgsm/functions/info_config.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,15 @@ fn_info_config_battalion1944(){
169169
if [ ! -f "${servercfgfullpath}" ]; then
170170
servername="${unavailable}"
171171
serverpassword="${unavailable}"
172+
gamemode="${unavailable}"
172173
else
173-
servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
174-
serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
175-
174+
servername=$(grep -m2 "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
175+
serverpassword=$(grep "Password" "${servercfgfullpath}" | grep -v "RCONPassword" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
176+
gamemode=$(grep -m2 "PlayMode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/PlayMode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
176177
# Not Set
177178
servername=${servername:-"NOT SET"}
178179
serverpassword=${serverpassword:-"NOT SET"}
180+
gamemode=${gamemode:-"NOT SET"}
179181
fi
180182
}
181183

lgsm/functions/info_messages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ fn_info_message_assettocorsa(){
657657
{
658658
echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
659659
echo -e "> Game\tINBOUND\t${port}\tudp"
660-
echo -e "> HTTP\tINBOUND\t${port}\tudp"
660+
echo -e "> HTTP\tINBOUND\t${httpport}\tudp"
661661
} | column -s $'\t' -t
662662
}
663663

0 commit comments

Comments
 (0)