command_postdetails.sh 2.1 KB

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