command_postdetails.sh 2.1 KB

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