Просмотр исходного кода

Reverted 6b46ca67747475ca9bc02df6f3315a6be8cdf1f9

Daniel Gibbs 9 лет назад
Родитель
Сommit
d7fa49ffa4
3 измененных файлов с 63 добавлено и 212 удалено
  1. 62 69
      lgsm/functions/command_details.sh
  2. 0 130
      lgsm/functions/command_postdetails.sh
  3. 1 13
      lgsm/functions/core_getopt.sh

+ 62 - 69
lgsm/functions/command_details.sh

@@ -580,73 +580,66 @@ fn_details_ark(){
 
 
 # Run checks and gathers details to display.
-
-fn_display_details() {
-	check.sh
-	info_config.sh
-	info_distro.sh
-	info_glibc.sh
-	info_parms.sh
-	fn_details_os
-	fn_details_performance
-	fn_details_disk
-	fn_details_gameserver
-	fn_details_script
-	fn_details_backup
-	# Some game servers do not have parms.
-	if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
-		fn_parms
-		fn_details_commandlineparms
-	fi
-	fn_details_ports
-	# Display details depending on game or engine.
-	if [ "${engine}" == "avalanche" ]; then
-		fn_details_avalanche
-	elif [ "${engine}" == "dontstarve" ]; then
-		fn_details_dontstarve
-	elif [ "${engine}" == "lwjgl2" ]; then
-		fn_details_minecraft
-	elif [ "${engine}" == "projectzomboid" ]; then
-		fn_details_projectzomboid
-	elif [ "${engine}" == "idtech3" ]; then
-		fn_details_idtech3
-	elif [ "${engine}" == "realvirtuality" ]; then
-		fn_details_realvirtuality
-	elif [ "${engine}" == "seriousengine35" ]; then
-		fn_details_seriousengine35
-	elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
-		fn_details_source
-	elif [ "${engine}" == "spark" ]; then
-		fn_details_spark
-	elif [ "${engine}" == "starbound" ]; then
-		fn_details_starbound
-	elif [ "${engine}" == "teeworlds" ]; then
-		fn_details_teeworlds
-	elif [ "${engine}" == "terraria" ]; then
-		fn_details_terraria
-	elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
-		fn_details_unreal
-	elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
-		fn_details_ark
-	elif [ "${gamename}" == "Hurtworld" ]; then
-		fn_details_hurtworld
-	elif [ "${gamename}" == "7 Days To Die" ]; then
-		fn_details_sdtd
-	elif [ "${gamename}" == "TeamSpeak 3" ]; then
-		fn_details_teamspeak3
-	elif [ "${gamename}" == "Mumble" ]; then
-		fn_details_mumble
-	elif [ "${gamename}" == "Rust" ]; then
-		fn_details_rust
-	else
-		fn_print_error_nl "Unable to detect server engine."
-	fi
-
-	fn_details_statusbottom
-}
-
-if [ -z ${POSTDETAILS} ] ;
-then 
-  fn_display_details
-  core_exit.sh
+check.sh
+info_config.sh
+info_distro.sh
+info_glibc.sh
+info_parms.sh
+fn_details_os
+fn_details_performance
+fn_details_disk
+fn_details_gameserver
+fn_details_script
+fn_details_backup
+# Some game servers do not have parms.
+if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
+	fn_parms
+	fn_details_commandlineparms
 fi
+fn_details_ports
+
+# Display details depending on game or engine.
+if [ "${engine}" == "avalanche" ]; then
+	fn_details_avalanche
+elif [ "${engine}" == "dontstarve" ]; then
+	fn_details_dontstarve
+elif [ "${engine}" == "lwjgl2" ]; then
+	fn_details_minecraft
+elif [ "${engine}" == "projectzomboid" ]; then
+	fn_details_projectzomboid
+elif [ "${engine}" == "idtech3" ]; then
+	fn_details_idtech3
+elif [ "${engine}" == "realvirtuality" ]; then
+	fn_details_realvirtuality
+elif [ "${engine}" == "seriousengine35" ]; then
+	fn_details_seriousengine35
+elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
+	fn_details_source
+elif [ "${engine}" == "spark" ]; then
+	fn_details_spark
+elif [ "${engine}" == "starbound" ]; then
+	fn_details_starbound
+elif [ "${engine}" == "teeworlds" ]; then
+	fn_details_teeworlds
+elif [ "${engine}" == "terraria" ]; then
+	fn_details_terraria
+elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
+	fn_details_unreal
+elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
+	fn_details_ark
+elif [ "${gamename}" == "Hurtworld" ]; then
+	fn_details_hurtworld
+elif [ "${gamename}" == "7 Days To Die" ]; then
+	fn_details_sdtd
+elif [ "${gamename}" == "TeamSpeak 3" ]; then
+	fn_details_teamspeak3
+elif [ "${gamename}" == "Mumble" ]; then
+	fn_details_mumble
+elif [ "${gamename}" == "Rust" ]; then
+	fn_details_rust
+else
+	fn_print_error_nl "Unable to detect server engine."
+fi
+
+fn_details_statusbottom
+core_exit.sh

+ 0 - 130
lgsm/functions/command_postdetails.sh

@@ -1,130 +0,0 @@
-#!/bin/bash -x
-# LGSM command_postdetails.sh function
-# Author: CedarLUG
-# Contributor: CedarLUG
-# Website: https://gameservermanagers.com
-# Description: Strips sensitive information out of Details output
-
-local commandname="POSTDETAILS"
-local commandaction="Postdetails"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
-
-# POSTDETAILS variable affects the output of command_details.sh.  Setting
-# it here silences the output from sourcing command_details.sh.
-POSTDETAILS=yes
-
-# Set POSTTARGET to the appropriately-defined post destination.  The present
-# option is only pastebin, but hastebin is on the todo list (and should be
-# a lot easier than pastebin.
-#
-# Another reason for an alternative here is that pastebin limits guest
-# posts to 10 per day, which might be a tight limit for some debugging situations.
- 
-POSTTARGET="http://pastebin.com"
-POSTEXPIRE="1W" # use 1 week as the default, other options are '24h' for a day, etc.
-
-# This file sources the command_details.sh file to leverage all
-# of the already-defined functions.  To keep the command_details.sh
-# from actually producing output, the main executable statements have
-# been wrapped in the equivalent of an ifdef clause, that looks
-# for the variable "postdetails" to be defined. -CedarLUG
-
-# source all of the functions defined in the details command
-. ${functionsdir}/command_details.sh
-
-fn_bad_tmpfile() {
-	echo "There was a problem creating a temporary file ${tmpfile}."
-	core_exit.sh
-}
-
-fn_gen_rand() {
-	# This is just a simple random generator to generate a random
- 	# name for storing the output.  Named pipes would (possibly) be
-	# better. -CedarLUG
-	#
-	# len holds the number of digits in our random string
-	local len=$1
-	# If not specified, default to 10.
-       	: {len:=10}
-	# Quick generator for a random filename, pulled from /dev/urandom
-      	tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${len} | xargs
-}
-
-# Rather than a one-pass sed parser, default to using a temporary directory
-filedir="${lgsmdir}/tmp"
-
-# Not all game servers possess a tmp directory.  So create it if
-# it doesn't already exist
-mkdir -p ${filedir} 2>&1 >/dev/null
-
-tmpfile=${filedir}/$(fn_gen_rand 10).tmp
-
-touch ${tmpfile} || fn_bad_tmpfile
-
-# fn_display_details is found in the command_details.sh file (which 
-# was sourced above.  The output is parsed for passwords and other
-# confidential information. -CedarLUG
-
-# The numerous sed lines could certainly be condensed quite a bit,
-# but they are separated out to provide examples for how to add
-# additional criteria in a straight-forward manner.
-# (This was originally a sed one-liner.) -CedarLUG
-
-fn_display_details | sed -e 's/password="[^"]*/password="--stripped--/' |
-                sed -e 's/password "[^"]*/password "--stripped--/' |
-                sed -e 's/password: .*/password: --stripped--/' |
-                sed -e 's/gslt="[^"]*/gslt="--stripped--/' |
-                sed -e 's/gslt "[^"]*/gslt "--stripped--/' |
-                sed -e 's/pushbullettoken="[^"]*/pushbullettoken="--stripped--/' |
-                sed -e 's/pushbullettoken "[^"]*/pushbullettoken "--stripped--/' |
-                sed -e 's/authkey="[^"]*/authkey="--stripped--/' |
-                sed -e 's/authkey "[^"]*/authkey "--stripped--/' |
-                sed -e 's/authkey [A-Za-z0-9]\+/authkey --stripped--/' |
-                sed -e 's/rcts_strAdminPassword="[^"]*/rcts_strAdminPassword="--stripped--/' |
-                sed -e 's/rcts_strAdminPassword "[^"]*/rcts_strAdminPassword "--stripped--/' |
-                sed -e 's/sv_setsteamaccount [A-Za-z0-9]\+/sv_setsteamaccount --stripped--/' |
-                sed -e 's/sv_password="[^"]*/sv_password="--stripped--/' |
-                sed -e 's/sv_password "[^"]*/sv_password "--stripped--/' |
-                sed -e 's/zmq_stats_password="[^"]*/zmq_stats_password="--stripped--/' |
-                sed -e 's/zmq_stats_password "[^"]*/zmq_stats_password "--stripped--/' |
-                sed -e 's/zmq_rcon_password="[^"]*/zmq_rcon_password="--stripped--/' |
-                sed -e 's/zmq_rcon_password "[^"]*/zmq_rcon_password "--stripped--/' |
-                sed -e 's/pass="[^"]*/pass="--stripped--/' |
-                sed -e 's/pass "[^"]*/pass "--stripped--/' |
-                sed -e 's/rconServerPassword="[^"]*/rconServerPassword="--stripped--/' |
-                sed -e 's/rconServerPassword "[^"]*/rconServerPassword "--stripped--/' > ${tmpfile}
-
-# strip off all console escape codes (colorization)
-sed -i -r "s/[\x1B,\x0B]\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" ${tmpfile}
-
-# If the gameserver uses anonymous steam credentials, leave them displayed
-# in the output.  Otherwise, strip these out as well.
-if ! grep -q "^steampass[= ]\"\"" ${tmpfile} ; then
-	sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' ${tmpfile}
-fi
-if ! grep -q "^steamuser[= ]\"anonymous\"" ${tmpfile} ; then
-	sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' ${tmpfile}
-fi
-
-if [ "$POSTTARGET" == "http://pastebin.com" ] ; then 
-   # grab the return from 'value' from an initial visit to pastebin.
-   TOKEN=$(curl -s $POSTTARGET |
-           sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p')
-   # 
-   # Use the TOKEN to then post the content.
-   #
-   link=$(curl -s "$POSTTARGET/post.php" -D - -F "submit_hidden=submit_hidden" \
-	       -F "post_key=$TOKEN" -F "paste_expire_date=${POSTEXPIRE}" \
-	       -F "paste_name=${gamename} Debug Info" \
-               -F "paste_format=8" -F "paste_private=0" \
-               -F "paste_type=bash" -F "paste_code=<${tmpfile}" |
-	       awk '/^location: / { print $2 }' | sed "s/\n//g")
-
-   # Output the resulting link.
-   fn_print_warn_nl "You now need to visit (and verify) the content posted at ${POSTTARGET}${link}"
-fi
-
-# cleanup
-rm ${tmpfile} || /bin/true
-
-core_exit.sh

+ 1 - 13
lgsm/functions/core_getopt.sh

@@ -27,8 +27,6 @@ case "${getopt}" in
 		command_monitor.sh;;
 	ta|test-alert)
 		command_test_alert.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
 	dt|details)
 		command_details.sh;;
 	b|backup)
@@ -68,7 +66,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
 		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
@@ -94,8 +91,6 @@ case "${getopt}" in
 		command_monitor.sh;;
 	ta|test-alert)
 		command_test_alert.sh;;
-	pd|postdetails)
-		command_postdetails.sh;;
 	dt|details)
 		command_details.sh;;
 	b|backup)
@@ -131,7 +126,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password."
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}install\t${default}i  |Install the server."
@@ -193,7 +187,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
 		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
@@ -250,7 +243,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}install\t${default}i  |Install the server."
 	} | column -s $'\t' -t
@@ -319,7 +311,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
 		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
@@ -382,7 +373,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
 		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
@@ -456,7 +446,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
 		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
@@ -522,7 +511,6 @@ case "${getopt}" in
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
 		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
-		echo -e "${blue}postdetails\t${default}pd | Post stripped details to pastebin (for support)"
 		echo -e "${blue}backup\t${default}b  |Create archive of the server."
 		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
 		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
@@ -553,4 +541,4 @@ elif [ "${engine}" == "unreal" ]; then
 else
 	fn_getopt_generic
 fi
-core_exit.sh
+core_exit.sh