command_postdetails.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. # LinuxGSM command_postdetails.sh function
  3. # Author: CedarLUG
  4. # Contributor: CedarLUG
  5. # Website: https://linuxgsm.com
  6. # Description: Strips sensitive information out of Details output
  7. commandname="POST-DETAILS"
  8. commandaction="Posting details"
  9. functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  10. fn_firstcommand_set
  11. posttarget="https://termbin.com"
  12. # source all of the functions defined in the details command.
  13. info_messages.sh
  14. fn_bad_postdetailslog() {
  15. fn_print_fail_nl "Unable to create temporary file ${postdetailslog}."
  16. core_exit.sh
  17. }
  18. # Remove any existing postdetails.log file.
  19. if [ -f "${postdetailslog}" ]; then
  20. rm -f "${postdetailslog:?}"
  21. fi
  22. # Rather than a one-pass sed parser, default to using a temporary directory.
  23. if [ "${exitbypass}" ]; then
  24. postdetailslog="${alertlog}"
  25. else
  26. # Run checks and gathers details to display.
  27. check.sh
  28. info_config.sh
  29. info_parms.sh
  30. info_distro.sh
  31. info_messages.sh
  32. for queryip in "${queryips[@]}"
  33. do
  34. query_gamedig.sh
  35. if [ "${querystatus}" == "0" ]; then
  36. break
  37. fi
  38. done
  39. touch "${postdetailslog}" || fn_bad_postdetailslog
  40. {
  41. fn_info_message_distro
  42. fn_info_message_server_resource
  43. fn_info_message_gameserver_resource
  44. fn_info_message_gameserver
  45. fn_info_message_script
  46. fn_info_message_backup
  47. # Some game servers do not have parms.
  48. if [ "${shortname}" != "jc2" ]&&[ "${shortname}" != "jc3" ]&&[ "${shortname}" != "dst" ]&&[ "${shortname}" != "pz" ]&&[ "${engine}" != "renderware" ]; then
  49. fn_parms
  50. fn_info_message_commandlineparms
  51. fi
  52. fn_info_message_ports
  53. fn_info_message_select_engine
  54. fn_info_message_statusbottom
  55. } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${postdetailslog}" > /dev/null 2>&1
  56. fi
  57. fn_print_dots "termbin.com"
  58. link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0')
  59. fn_print_ok_nl "termbin.com for 30D"
  60. fn_script_log_pass "termbin.com for 30D"
  61. pdurl="${link}"
  62. if [ "${firstcommandname}" == "POST-DETAILS" ]; then
  63. echo -e ""
  64. echo -e "Please share the following url for support: "
  65. echo -e "${pdurl}"
  66. fi
  67. fn_script_log_info "${pdurl}"
  68. alerturl="${pdurl}"
  69. if [ -z "${exitbypass}" ]; then
  70. core_exit.sh
  71. fi