Browse Source

removed old paste sites and kept termbin

pull/3051/head
Daniel Gibbs 5 years ago
parent
commit
9188e79a9a
  1. 65
      lgsm/functions/command_postdetails.sh

65
lgsm/functions/command_postdetails.sh

@ -10,25 +10,7 @@ commandaction="Posting details"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set
# Set posttarget to the appropriately-defined post destination.
# The options for posttarget are:
# The default destination - hastebin
# posttarget="https://hastebin.com"
#
# Secondary destination - pastebin
# posttarget="http://pastebin.com
#
# Third option - leave on the filesystem
# posttarget=
#
# All of these options can be specified/overridden from the top-level
# invocation, as in:
# rustserver@gamerig:~$ posttarget="http://pastebin.com" ./rustserver pd
# to post to pastebin, or
# rustserver@gamerig:~$ posttarget= ./rustserver pd
# to leave the output on the filesystem.
posttarget=${posttarget="https://termbin.com"}
posttarget="https://termbin.com"
# source all of the functions defined in the details command.
info_messages.sh
@ -78,43 +60,13 @@ else
fn_info_message_statusbottom
} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${postdetailslog}" > /dev/null 2>&1
fi
# Pastebin
if [ "${posttarget}" == "http://pastebin.com" ] ; then
fn_print_dots "pastbin.com for 30D"
# 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=30D" \
-F "paste_name=${gamename} Debug Info" \
-F "paste_format=8" -F "paste_private=0" \
-F "paste_type=bash" -F "paste_code=<${postdetailslog}" |
awk '/^location: / { print $2 }' | sed "s/\n//g")
# Output the resulting link.
fn_print_ok_nl "pastbin.com for 30D"
fn_script_log_pass "pastbin.com for 30D"
pdurl="${posttarget}${link}"
# Hastebin
elif [ "${posttarget}" == "https://hastebin.com" ] ; then
fn_print_dots "hastebin.com"
# 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 -H "HTTP_X_REQUESTED_WITH:XMLHttpRequest" -s -d "$(<${postdetailslog})" "${posttarget}/documents" | cut -d\" -f4)
fn_print_ok_nl "hastebin.com for 30D"
fn_script_log_pass "hastebin.com for 30D"
pdurl="${posttarget}/${link}"
# Termbin
elif [ "${posttarget}" == "https://termbin.com" ] ; then
fn_print_dots "termbin.com"
link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0')
fn_print_ok_nl "termbin.com for 30D"
fn_script_log_pass "termbin.com for 30D"
pdurl="${link}"
fi
fn_print_dots "termbin.com"
link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0')
fn_print_ok_nl "termbin.com for 30D"
fn_script_log_pass "termbin.com for 30D"
pdurl="${link}"
if [ ${firstcommandname} == "POST-DETAILS" ]; then
echo -e ""
echo -e "Please share the following url for support: "
@ -124,6 +76,5 @@ fn_script_log_info "${pdurl}"
if [ -z "${exitbypass}" ]; then
core_exit.sh
else
alerturl="${pdurl}"
fi
alerturl="${pdurl}"

Loading…
Cancel
Save