Daniel Gibbs 9 лет назад
Родитель
Сommit
c44874539a
1 измененных файлов с 55 добавлено и 55 удалено
  1. 55 55
      lgsm/functions/command_postdetails.sh

+ 55 - 55
lgsm/functions/command_postdetails.sh

@@ -31,7 +31,7 @@ postdetails=yes
 # to post to pastebin, or
 #  rustserver@gamerig:~$ posttarget= ./rustserver pd
 # to leave the output on the filesystem.
-posttarget=${posttarget="http://pastebin.com"}
+posttarget=${posttarget="http://hastebin.com"}
 
 # For pastebin, you can set the expiration period.
 # use 1 week as the default, other options are '24h' for a day, etc.
@@ -53,8 +53,8 @@ local commandaction="Postdetails"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_bad_tmpfile() {
-  echo "There was a problem creating a temporary file ${tmpfile}."
-  core_exit.sh
+	echo "There was a problem creating a temporary file ${tmpfile}."
+	core_exit.sh
 }
 
 # Rather than a one-pass sed parser, default to using a temporary directory
@@ -72,28 +72,28 @@ touch "${tmpfile}" || fn_bad_tmpfile
 # (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}"
+									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}"
@@ -101,44 +101,44 @@ 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}"
+	sed -i -e 's/steampass[= ]"[^"]*/steampass "--stripped--/' "${tmpfile}"
 fi
 if ! grep -q "^steamuser[= ]\"anonymous\"" "${tmpfile}" ; then
-  sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}"
+	sed -i -e 's/steamuser[= ]"[^"]*/steamuser "--stripped--/' "${tmpfile}"
 fi
 
 
 if [ "${posttarget}" == "http://pastebin.com" ] ; then
-  fn_print_dots "Posting details to pastbin.com for ${postexpire}"
-  sleep 1
-  # grab the return from 'value' from an initial visit to pastebin.
-  csrftoken=$(curl -s "${posttarget}" |
-          sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p')
-  #
-  # Use the csrftoken to then post the content.
-  #
-  link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \
-        -F "post_key=${csrftoken}" -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_ok_nl "Posting details to pastbin.com for ${postexpire}"
-  echo "  * url: ${posttarget}/${link}"
+	fn_print_dots "Posting details to pastbin.com for ${postexpire}"
+	sleep 1
+	# grab the return from 'value' from an initial visit to pastebin.
+	csrftoken=$(curl -s "${posttarget}" |
+					sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p')
+	#
+	# Use the csrftoken to then post the content.
+	#
+	link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \
+				-F "post_key=${csrftoken}" -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_ok_nl "Posting details to pastbin.com for ${postexpire}"
+	echo "  * url: ${posttarget}${link}"
 elif [ "${posttarget}" == "http://hastebin.com" ] ; then
-  fn_print_dots "Posting details to hastbin.com for ${postexpire}"
-  sleep 1
-  # hastebin is a bit simpler.  If successful, the returned result
-  # should look like: {"something":"key"}, putting the reference that
-  # we need in "key".  TODO - error handling. -CedarLUG
-  link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4)
-  fn_print_ok_nl "Posting details to hastbin.com for ${postexpire}"
-  echo "  * url: ${posttarget}/${link}"
+	fn_print_dots "Posting details to hastbin.com for ${postexpire}"
+	sleep 1
+	# hastebin is a bit simpler.  If successful, the returned result
+	# should look like: {"something":"key"}, putting the reference that
+	# we need in "key".  TODO - error handling. -CedarLUG
+	link=$(curl -s -d "$(<${tmpfile})" "${posttarget}/documents" | cut -d\" -f4)
+	fn_print_ok_nl "Posting details to hastbin.com for ${postexpire}"
+	echo "  * url: ${posttarget}/${link}"
 else
-   fn_print_warn_nl Review the output in "${tmpfile}"
-   core_exit.sh
+	 fn_print_warn_nl Review the output in "${tmpfile}"
+	 core_exit.sh
 fi
 
 # cleanup