command_postdetails.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  2. # LinuxGSM command_postdetails.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: http://linuxgsm.com/contrib
  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_game.sh
  29. info_distro.sh
  30. info_messages.sh
  31. for queryip in "${queryips[@]}"; do
  32. query_gamedig.sh
  33. if [ "${querystatus}" == "0" ]; then
  34. break
  35. fi
  36. done
  37. touch "${postdetailslog}" || fn_bad_postdetailslog
  38. {
  39. fn_info_message_distro
  40. fn_info_message_server_resource
  41. fn_info_message_gameserver_resource
  42. fn_info_message_gameserver
  43. fn_info_message_script
  44. fn_info_message_backup
  45. # Some game servers do not have parms.
  46. if [ "${shortname}" != "jc2" ] && [ "${shortname}" != "jc3" ] && [ "${shortname}" != "dst" ] && [ "${shortname}" != "pz" ] && [ "${engine}" != "renderware" ]; then
  47. fn_info_message_commandlineparms
  48. fi
  49. fn_info_message_ports_edit
  50. fn_info_message_ports
  51. fn_info_message_select_engine
  52. fn_info_message_statusbottom
  53. } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a "${postdetailslog}" > /dev/null 2>&1
  54. fi
  55. fn_print_dots "termbin.com"
  56. link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0')
  57. fn_print_ok_nl "termbin.com for 30D"
  58. fn_script_log_pass "termbin.com for 30D"
  59. pdurl="${link}"
  60. if [ "${firstcommandname}" == "POST-DETAILS" ]; then
  61. echo -e ""
  62. echo -e "Please share the following url for support: "
  63. echo -e "${pdurl}"
  64. fi
  65. fn_script_log_info "${pdurl}"
  66. alerturl="${pdurl}"
  67. if [ -z "${exitbypass}" ]; then
  68. core_exit.sh
  69. fi