BOT


SUBMITTED BY: zumgabubr

DATE: April 1, 2024, 1:53 p.m.

FORMAT: Text only

SIZE: 3.7 kB

HITS: 335

  1. #!/bin/bash
  2. clear
  3. #--------RS_APP_MOD-SSH-----------#
  4. source ShellBot.sh
  5. touch lista
  6. [[ -z $1 ]] && {
  7. clear && echo "INFORME O TOKEN" && return 0
  8. }
  9. [[ ! -e RESET ]] && touch RESET
  10. api_bot=$1
  11. ShellBot.init --token "$api_bot" --monitor --flush
  12. ShellBot.username
  13. # - Funcao menu
  14. menu() {
  15. local msg
  16. msg="=×=×=×=×=×=×=×=×=×=×=×=×=×=\n"
  17. msg+="<b>🤖 OLA SEJA BEM VINDO(a) 🤖</b>\n"
  18. msg+="=×=×=×=×=×=×=×=×=×=×=×=×=×=\n\n"
  19. msg+="Gere seu teste agora mesmo!"
  20. ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \
  21. --text "$(echo -e $msg)" \
  22. --reply_markup "$keyboard1" \
  23. --parse_mode html
  24. return 0
  25. }
  26. # - funcao criar ssh
  27. criarteste() {
  28. [[ $(grep -wc ${callback_query_from_id} lista) != '0' ]] && {
  29. ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \
  30. --text "⚠️ VC JA CRIOU SSH HOJE ⚠️"
  31. return 0
  32. }
  33. usuario=$(echo TESTE$(( RANDOM% + 999 )))
  34. senha=$((RANDOM% + 999999))
  35. limite='1'
  36. tempo='1'
  37. tuserdate=$(date '+%C%y/%m/%d' -d " +1 days")
  38. useradd -M -N -s /bin/false $usuario -e $tuserdate > /dev/null 2>&1
  39. (echo "$senha";echo "$senha") | passwd $usuario > /dev/null 2>&1
  40. echo "$senha" > /etc/SSHPlus/senha/$usuario
  41. echo "$usuario $limite" >> /root/usuarios.db
  42. echo "#!/bin/bash
  43. pkill -f "$usuario"
  44. userdel --force $usuario
  45. grep -v ^$usuario[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db
  46. rm /etc/SSHPlus/senha/$usuario > /dev/null 2>&1
  47. rm -rf /etc/SSHPlus/userteste/$usuario.sh" > /etc/SSHPlus/userteste/$usuario.sh
  48. chmod +x /etc/SSHPlus/userteste/$usuario.sh
  49. at -f /etc/SSHPlus/userteste/$usuario.sh now + $tempo hour > /dev/null 2>&1
  50. echo ${callback_query_from_id} >> lista
  51. # - ENVIA O SSH
  52. ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \
  53. --text "$(echo -e "✅ <b>Criado com sucesso</b> ✅\n\nUSUARIO: <code>$usuario</code>\nSENHA: <code>$senha</code>\n\n⏳ Expira em: $tempo Hora")" \
  54. --parse_mode html
  55. return 0
  56. }
  57. #enviar app
  58. enviarapp() {
  59. ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \
  60. --text "♻️ ENVIANDO APLICATIVO, AGUARDE..."
  61. ShellBot.sendDocument --chat_id ${callback_query_message_chat_id} \
  62. --document "@/root/app.apk" \
  63. return 0
  64. }
  65. #informacoes usuario
  66. infouser () {
  67. ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \
  68. --text "$(echo -e "Nome: ${message_from_first_name[$(ShellBot.ListUpdates)]}\nUser: @${message_from_username[$(ShellBot.ListUpdates)]:-null}")\nID: ${message_from_id[$(ShellBot.ListUpdates)]} " \
  69. --parse_mode html
  70. return 0
  71. }
  72. unset botao1
  73. botao1=''
  74. ShellBot.InlineKeyboardButton --button 'botao1' --line 1 --text '♻️ GERAR TESTE ♻️' --callback_data 'gerarssh'
  75. ShellBot.InlineKeyboardButton --button 'botao1' --line 3 --text '🔰 BAIXAR APLICATIVO 🔰' --callback_data 'appenviar'
  76. ShellBot.regHandleFunction --function criarteste --callback_data gerarssh
  77. ShellBot.regHandleFunction --function enviarapp --callback_data appenviar
  78. unset keyboard1
  79. keyboard1="$(ShellBot.InlineKeyboardMarkup -b 'botao1')"
  80. while :; do
  81. [[ "$(date +%d)" != "$(cat RESET)" ]] && {
  82. echo $(date +%d) > RESET
  83. echo ' ' > lista
  84. }
  85. ShellBot.getUpdates --limit 100 --offset $(ShellBot.OffsetNext) --timeout 24
  86. for id in $(ShellBot.ListUpdates); do
  87. (
  88. ShellBot.watchHandle --callback_data ${callback_query_data[$id]}
  89. comando=(${message_text[$id]})
  90. [[ "${comando[0]}" = "/menu" || "${comando[0]}" = "/start" ]] && menu
  91. [[ "${comando[0]}" = "/id" ]] && infouser
  92. ) &
  93. done
  94. done

comments powered by Disqus