Repository: januda-ui/DRAGON-VPS-MANAGER Branch: main Commit: 5fcb8403232b Files: 69 Total size: 586.8 KB Directory structure: gitextract_gvgjjjr7/ ├── Install/ │ ├── EasyRSA-3.0.1.tgz │ ├── ShellBot.sh │ ├── Url │ ├── badvpn-udpgw │ ├── instsqd │ ├── jq-linux64 │ ├── list │ ├── squid3 │ ├── sshd_config │ ├── stunnel.pem │ ├── tcptweaker.sh │ └── versao ├── LICENSE ├── Modulos/ │ ├── addhost │ ├── ajuda │ ├── alterarlimite │ ├── alterarsenha │ ├── attscript │ ├── badvpn │ ├── badvpn-udpgw │ ├── banner │ ├── blockt │ ├── bot │ ├── botgen │ ├── botgerador │ ├── botssh │ ├── botsshteste │ ├── botteste │ ├── cabecalho │ ├── conexao │ ├── criarteste │ ├── criarusuario │ ├── delhost │ ├── delscript │ ├── detalhes │ ├── dns │ ├── dns-server │ ├── droplimiter │ ├── expcleaner │ ├── infousers │ ├── instsqd │ ├── limiter │ ├── menu │ ├── mudardata │ ├── onlineapp.sh │ ├── open.py │ ├── otimizar │ ├── proxy.py │ ├── reiniciarservicos │ ├── reiniciarsistema │ ├── remover │ ├── senharoot │ ├── slow_dns │ ├── slowdns │ ├── speedtest │ ├── sshmonitor │ ├── uexpired │ ├── userbackup │ ├── verifatt │ ├── verifbot │ └── wsproxy.py ├── README.md ├── Sistema/ │ ├── script/ │ │ └── stunnel.pem │ ├── server.key │ ├── server.pub │ └── versao ├── hehe ├── senharoot.sh └── stunnel.pem ================================================ FILE CONTENTS ================================================ ================================================ FILE: Install/ShellBot.sh ================================================ #!/usr/bin/env bash #----------------------------------------------------------------------------------------------------------- # DATE: March 7, 2017 # SCRIPT: ShellBot.sh # VERSION: 6.4.0 # DEVELOPED BY: Juliano Santos [SHAMAN] # PAGE: http://www.shellscriptx.blogspot.com.br # FANPAGE: https://www.facebook.com/shellscriptx # GITHUB: https://github.com/shellscriptx # CONTACT: shellscriptx@gmail.com # # DESCRIPTION: ShellBot is an unofficial API designed to facilitate the creation of # bots on the TELEGRAM platform. Consisting of a collection of methods # and functions that allow the developer to: # # * Manage groups, channels and members. # * Send messages, documents, music, contacts and etc. # * Upload keyboards (KeyboardMarkup and InlineKeyboard). # * Get information about members, files, groups and channels. # * For more information see the documentation: # # https://github.com/shellscriptx/ShellBot/wiki # # ShellBot maintains the default naming of registered methods of the # Original API (Telegram), as well as its fields and values. the methods # require parameters and arguments for calling and executing. Parameters # mandatory returns an error message if the argument is omitted. # # NOTE: Developed in Shell Script language, using the interpreter of # BASH commands and making the most of its built-in features, # reducing the level of external package dependencies. #----------------------------------------------------------------------------------------------------------- [[ $_SHELLBOT_SH_ ]] && return 1 if ! awk 'BEGIN { exit ARGV[1] < 4.3 }' ${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]}; then echo "${BASH_SOURCE:-${0##*/}}: erro: requer o interpretador de comandos 'bash 4.3' ou superior." 1>&2 exit 1 fi # Information readonly -A _SHELLBOT_=( [name]='ShellBot' [keywords]='Shell Script Telegram API' [description]='Unofficial API for creating bots on the Telegram platform.' [version]='6.4.0' [language]='shellscript' [shell]=${SHELL} [shell_version]=${BASH_VERSION} [author]='Juliano Santos [SHAMAN]' [email]='shellscriptx@gmail.com' [wiki]='https://github.com/shellscriptx/shellbot/wiki' [github]='https://github.com/shellscriptx/shellbot' [packages]='curl 7.0, getopt 2.0, jq 1.5' ) # Check dependencies. while read _pkg_ _ver_; do if command -v $_pkg_ &>/dev/null; then if [[ $($_pkg_ --version 2>&1) =~ [0-9]+\.[0-9]+ ]]; then if ! awk 'BEGIN { exit ARGV[1] < ARGV[2] }' $BASH_REMATCH $_ver_; then printf "%s: erro: requer o pacote '%s %s' ou superior.\n" ${_SHELLBOT_[name]} $_pkg_ $_ver_ 1>&2 exit 1 fi else printf "%s: erro: '%s' não foi possível obter a versão.\n" ${_SHELLBOT_[name]} $_pkg_ 1>&2 exit 1 fi else printf "%s: erro: '%s' o pacote requerido está ausente.\n" ${_SHELLBOT_[name]} $_pkg_ 1>&2 exit 1 fi done <<< "${_SHELLBOT_[packages]//,/$'\n'}" # bash (options). shopt -s checkwinsize \ cmdhist \ complete_fullquote \ expand_aliases \ extglob \ extquote \ force_fignore \ histappend \ interactive_comments \ progcomp \ promptvars \ sourcepath # Desabilita a expansão de nomes de arquivos (globbing). set -f readonly _SHELLBOT_SH_=1 # Inicialização readonly _BOT_SCRIPT_=${0##*/} # Script readonly _CURL_OPT_='--silent --request' # CURL (opções) # Erros readonly _ERR_TYPE_BOOL_='tipo incompatível: suporta somente "true" ou "false".' readonly _ERR_TYPE_INT_='tipo incompatível: suporta somente inteiro.' readonly _ERR_TYPE_FLOAT_='tipo incompatível: suporta somente float.' readonly _ERR_PARAM_REQUIRED_='opção requerida: verique se o(s) parâmetro(s) ou argumento(s) obrigatório(s) estão presente(s).' readonly _ERR_TOKEN_UNAUTHORIZED_='não autorizado: verifique se possui permissões para utilizar o token.' readonly _ERR_TOKEN_INVALID_='token inválido: verique o número do token e tente novamente.' readonly _ERR_BOT_ALREADY_INIT_='ação não permitida: o bot já foi inicializado.' readonly _ERR_FILE_NOT_FOUND_='falha ao acessar: não foi possível ler o arquivo.' readonly _ERR_DIR_WRITE_DENIED_='permissão negada: não é possível gravar no diretório.' readonly _ERR_DIR_NOT_FOUND_='Não foi possível acessar: diretório não encontrado.' readonly _ERR_FILE_INVALID_ID_='id inválido: arquivo não encontrado.' readonly _ERR_UNKNOWN_='erro desconhecido: ocorreu uma falha inesperada. Reporte o problema ao desenvolvedor.' readonly _ERR_SERVICE_NOT_ROOT_='acesso negado: requer privilégios de root.' readonly _ERR_SERVICE_EXISTS_='erro ao criar o serviço: o nome do serviço já existe.' readonly _ERR_SERVICE_SYSTEMD_NOT_FOUND_='erro ao ativar: o sistema não possui suporte ao gerenciamento de serviços "systemd".' readonly _ERR_SERVICE_USER_NOT_FOUND_='usuário não encontrado: a conta de usuário informada é inválida.' readonly _ERR_VAR_NAME_='variável não encontrada: o identificador é inválido ou não existe.' readonly _ERR_FUNCTION_NOT_FOUND_='função não encontrada: o identificador especificado é inválido ou não existe.' readonly _ERR_ARG_='argumento inválido: o argumento não é suportado pelo parâmetro especificado.' readonly _ERR_RULE_ALREADY_EXISTS_='falha ao definir: o nome da regra já existe.' readonly _ERR_HANDLE_EXISTS_='erro ao registar: já existe um handle vinculado ao callback' readonly _ERR_CONNECTION_='falha de conexão: não foi possível estabelecer conexão com o Telegram.' # Maps declare -A _BOT_HANDLE_ declare -A _BOT_RULES_ declare -A return declare -i _BOT_RULES_INDEX_ declare _VAR_INIT_ Json() { local obj=$(jq -Mc "$1" <<< "${*:2}"); obj=${obj#\"}; echo "${obj%\"}"; } SetDelmValues(){ local obj=$(jq "[..|select(type == \"string\" or type == \"number\" or type == \"boolean\")|tostring]|join(\"${_BOT_DELM_/\"/\\\"}\")" <<< "$1") obj=${obj#\"}; echo "${obj%\"}" } GetAllValues(){ jq '[..|select(type == "string" or type == "number" or type == "boolean")|tostring]|.[]' <<< "$1" } GetAllKeys(){ jq -r 'path(..|select(type == "string" or type == "number" or type == "boolean"))|map(if type == "number" then .|tostring|"["+.+"]" else . end)|join(".")|gsub("\\.\\[";"[")' <<< "$1" } FlagConv() { local var str=$2 while [[ $str =~ \$\{([a-z_]+)\} ]]; do if [[ ${BASH_REMATCH[1]} == @(${_VAR_INIT_// /|}) ]]; then var=${BASH_REMATCH[1]}[$1] str=${str//${BASH_REMATCH[0]}/${!var}} else str=${str//${BASH_REMATCH[0]}} fi done echo "$str" } CreateLog() { local fid fbot fname fuser lcode cid ctype local ctitle mid mdate mtext etype local i fmt obj oid for ((i=0; i < $1; i++)); do printf -v fmt "$_BOT_LOG_FORMAT_" || MessageError API # Suprimir erros. exec 5<&2 exec 2<&- # Objeto (tipo) if [[ ${message_contact_phone_number[$i]:-${edited_message_contact_phone_number[$i]}} ]] || [[ ${channel_post_contact_phone_number[$i]:-${edited_channel_post_contact_phone_number[$i]}} ]]; then obj=contact elif [[ ${message_sticker_file_id[$i]:-${edited_message_sticker_file_id[$i]}} ]] || [[ ${channel_post_sticker_file_id[$i]:-${edited_channel_post_sticker_file_id[$i]}} ]]; then obj=sticker elif [[ ${message_animation_file_id[$i]:-${edited_message_animation_file_id[$i]}} ]] || [[ ${channel_post_animation_file_id[$i]:-${edited_channel_post_animation_file_id[$i]}} ]]; then obj=animation elif [[ ${message_photo_file_id[$i]:-${edited_message_photo_file_id[$i]}} ]] || [[ ${channel_post_photo_file_id[$i]:-${edited_channel_post_photo_file_id[$i]}} ]]; then obj=photo elif [[ ${message_audio_file_id[$i]:-${edited_message_audio_file_id[$i]}} ]] || [[ ${channel_post_audio_file_id[$i]:-${edited_channel_post_audio_file_id[$i]}} ]]; then obj=audio elif [[ ${message_video_file_id[$i]:-${edited_message_video_file_id[$i]}} ]] || [[ ${channel_post_video_file_id[$i]:-${edited_channel_post_video_file_id[$i]}} ]]; then obj=video elif [[ ${message_voice_file_id[$i]:-${edited_message_voice_file_id[$i]}} ]] || [[ ${channel_post_voice_file_id[$i]:-${edited_channel_post_voice_file_id[$i]}} ]]; then obj=voice elif [[ ${message_document_file_id[$i]:-${edited_message_document_file_id[$i]}} ]] || [[ ${channel_post_document_file_id[$i]:-${edited_channel_post_document_file_id[$i]}} ]]; then obj=document elif [[ ${message_venue_location_latitude[$i]:-${edited_message_venue_location_latitude[$i]}} ]] || [[ ${channel_post_venue_location_latitude[$i]-${edited_channel_post_venue_location_latitude[$i]}} ]]; then obj=venue elif [[ ${message_location_latitude[$i]:-${edited_message_location_latitude[$i]}} ]] || [[ ${channel_post_location_latitude[$i]:-${edited_channel_post_location_latitude[$i]}} ]]; then obj=location elif [[ ${message_text[$i]:-${edited_message_text[$i]}} ]] || [[ ${channel_post_text[$i]:-${edited_channel_post_text[$i]}} ]]; then obj=text elif [[ ${callback_query_id[$i]} ]]; then obj=callback elif [[ ${inline_query_id[$i]} ]]; then obj=inline elif [[ ${chosen_inline_result_result_id[$i]} ]]; then obj=chosen fi # Objeto (id) [[ ${oid:=${message_contact_phone_number[$i]}} ]] || [[ ${oid:=${message_sticker_file_id[$i]}} ]] || [[ ${oid:=${message_animation_file_id[$i]}} ]] || [[ ${oid:=${message_photo_file_id[$i]}} ]] || [[ ${oid:=${message_audio_file_id[$i]}} ]] || [[ ${oid:=${message_video_file_id[$i]}} ]] || [[ ${oid:=${message_voice_file_id[$i]}} ]] || [[ ${oid:=${message_document_file_id[$i]}} ]] || [[ ${oid:=${edited_message_contact_phone_number[$i]}} ]] || [[ ${oid:=${edited_message_sticker_file_id[$i]}} ]] || [[ ${oid:=${edited_message_animation_file_id[$i]}} ]] || [[ ${oid:=${edited_message_photo_file_id[$i]}} ]] || [[ ${oid:=${edited_message_audio_file_id[$i]}} ]] || [[ ${oid:=${edited_message_video_file_id[$i]}} ]] || [[ ${oid:=${edited_message_voice_file_id[$i]}} ]] || [[ ${oid:=${edited_message_document_file_id[$i]}} ]] || [[ ${oid:=${channel_post_contact_phone_number[$i]}} ]] || [[ ${oid:=${channel_post_sticker_file_id[$i]}} ]] || [[ ${oid:=${channel_post_animation_file_id[$i]}} ]] || [[ ${oid:=${channel_post_photo_file_id[$i]}} ]] || [[ ${oid:=${channel_post_audio_file_id[$i]}} ]] || [[ ${oid:=${channel_post_video_file_id[$i]}} ]] || [[ ${oid:=${channel_post_voice_file_id[$i]}} ]] || [[ ${oid:=${channel_post_document_file_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_contact_phone_number[$i]}} ]] || [[ ${oid:=${edited_channel_post_sticker_file_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_animation_file_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_photo_file_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_audio_file_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_video_file_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_voice_file_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_document_file_id[$i]}} ]] || [[ ${oid:=${message_message_id[$i]}} ]] || [[ ${oid:=${edited_message_message_id[$i]}} ]] || [[ ${oid:=${channel_post_message_id[$i]}} ]] || [[ ${oid:=${edited_channel_post_message_id[$i]}} ]] || [[ ${oid:=${callback_query_id[$i]}} ]] || [[ ${oid:=${inline_query_id[$i]}} ]] || [[ ${oid:=${chosen_inline_result_result_id[$i]}} ]] # Remetente (id) [[ ${fid:=${message_from_id[$i]}} ]] || [[ ${fid:=${edited_message_from_id[$i]}} ]] || [[ ${fid:=${callback_query_from_id[$i]}} ]] || [[ ${fid:=${inline_query_from_id[$i]}} ]] || [[ ${fid:=${chosen_inline_result_from_id[$i]}} ]] # Bot [[ ${fbot:=${message_from_is_bot[$i]}} ]] || [[ ${fbot:=${edited_message_from_is_bot[$i]}} ]] || [[ ${fbot:=${callback_query_from_is_bot[$i]}} ]] || [[ ${fbot:=${inline_query_from_is_bot[$i]}} ]] || [[ ${fbot:=${chosen_inline_result_from_is_bot[$i]}} ]] # Usuário (nome) [[ ${fname:=${message_from_first_name[$i]}} ]] || [[ ${fname:=${edited_message_from_first_name[$i]}} ]] || [[ ${fname:=${callback_query_from_first_name[$i]}} ]] || [[ ${fname:=${inline_query_from_first_name[$i]}} ]] || [[ ${fname:=${chosen_inline_result_from_first_name[$i]}} ]] || [[ ${fname:=${channel_post_author_signature[$i]}} ]] || [[ ${fname:=${edited_channel_post_author_signature[$i]}} ]] # Usuário (conta) [[ ${fuser:=${message_from_username[$i]}} ]] || [[ ${fuser:=${edited_message_from_username[$i]}} ]] || [[ ${fuser:=${callback_query_from_username[$i]}} ]] || [[ ${fuser:=${inline_query_from_username[$i]}} ]] || [[ ${fuser:=${chosen_inline_result_from_username[$i]}} ]] # Idioma [[ ${lcode:=${message_from_language_code[$i]}} ]] || [[ ${lcode:=${edited_message_from_language_code[$i]}} ]] || [[ ${lcode:=${callback_query_from_language_code[$i]}} ]] || [[ ${lcode:=${inline_query_from_language_code[$i]}} ]] || [[ ${lcode:=${chosen_inline_result_from_language_code[$i]}} ]] # Bate-papo (id) [[ ${cid:=${message_chat_id[$i]}} ]] || [[ ${cid:=${edited_message_chat_id[$i]}} ]] || [[ ${cid:=${callback_query_message_chat_id[$i]}} ]] || [[ ${cid:=${channel_post_chat_id[$i]}} ]] || [[ ${cid:=${edited_channel_post_chat_id[$i]}} ]] # Bate-papo (tipo) [[ ${ctype:=${message_chat_type[$i]}} ]] || [[ ${ctype:=${edited_message_chat_type[$i]}} ]] || [[ ${ctype:=${callback_query_message_chat_type[$i]}} ]] || [[ ${ctype:=${channel_post_chat_type[$i]}} ]] || [[ ${ctype:=${edited_channel_post_chat_type[$i]}} ]] # Bate-papo (título) [[ ${ctitle:=${message_chat_title[$i]}} ]] || [[ ${ctitle:=${edited_message_chat_title[$i]}} ]] || [[ ${ctitle:=${callback_query_message_chat_title[$i]}} ]] || [[ ${ctitle:=${channel_post_chat_title[$i]}} ]] || [[ ${ctitle:=${edited_channel_post_chat_title[$i]}} ]] # Mensagem (id) [[ ${mid:=${message_message_id[$i]}} ]] || [[ ${mid:=${edited_message_message_id[$i]}} ]] || [[ ${mid:=${callback_query_id[$i]}} ]] || [[ ${mid:=${inline_query_id[$i]}} ]] || [[ ${mid:=${chosen_inline_result_result_id[$i]}} ]] || [[ ${mid:=${channel_post_message_id[$i]}} ]] || [[ ${mid:=${edited_channel_post_message_id[$i]}} ]] # Mensagem (data) [[ ${mdate:=${message_date[$i]}} ]] || [[ ${mdate:=${edited_message_date[$i]}} ]] || [[ ${mdate:=${callback_query_message_date[$i]}} ]] || [[ ${mdate:=${channel_post_date[$i]}} ]] || [[ ${mdate:=${edited_channel_post_date[$i]}} ]] # Mensagem (texto) [[ ${mtext:=${message_text[$i]}} ]] || [[ ${mtext:=${edited_message_text[$i]}} ]] || [[ ${mtext:=${callback_query_message_text[$i]}} ]] || [[ ${mtext:=${inline_query_query[$i]}} ]] || [[ ${mtext:=${chosen_inline_result_query[$i]}} ]] || [[ ${mtext:=${channel_post_text[$i]}} ]] || [[ ${mtext:=${edited_channel_post_text[$i]}} ]] # Mensagem (tipo) [[ ${etype:=${message_entities_type[$i]}} ]] || [[ ${etype:=${edited_message_entities_type[$i]}} ]] || [[ ${etype:=${callback_query_message_entities_type[$i]}} ]] || [[ ${etype:=${channel_post_entities_type[$i]}} ]] || [[ ${etype:=${edited_channel_post_entities_type[$i]}} ]] # Flags fmt=${fmt//\{BOT_TOKEN\}/${_BOT_INFO_[0]:--}} fmt=${fmt//\{BOT_ID\}/${_BOT_INFO_[1]:--}} fmt=${fmt//\{BOT_FIRST_NAME\}/${_BOT_INFO_[2]:--}} fmt=${fmt//\{BOT_USERNAME\}/${_BOT_INFO_[3]:--}} fmt=${fmt//\{BASENAME\}/${_BOT_SCRIPT_:--}} fmt=${fmt//\{OK\}/${return[ok]:-${ok:--}}} fmt=${fmt//\{UPDATE_ID\}/${update_id[$i]:--}} fmt=${fmt//\{OBJECT_TYPE\}/${obj:--}} fmt=${fmt//\{OBJECT_ID\}/${oid:--}} fmt=${fmt//\{FROM_ID\}/${fid:--}} fmt=${fmt//\{FROM_IS_BOT\}/${fbot:--}} fmt=${fmt//\{FROM_FIRST_NAME\}/${fname:--}} fmt=${fmt//\{FROM_USERNAME\}/${fuser:--}} fmt=${fmt//\{FROM_LANGUAGE_CODE\}/${lcode:--}} fmt=${fmt//\{CHAT_ID\}/${cid:--}} fmt=${fmt//\{CHAT_TYPE\}/${ctype:--}} fmt=${fmt//\{CHAT_TITLE\}/${ctitle:--}} fmt=${fmt//\{MESSAGE_ID\}/${mid:--}} fmt=${fmt//\{MESSAGE_DATE\}/${mdate:--}} fmt=${fmt//\{MESSAGE_TEXT\}/${mtext:--}} fmt=${fmt//\{ENTITIES_TYPE\}/${etype:--}} fmt=${fmt//\{METHOD\}/${FUNCNAME[2]/main/ShellBot.getUpdates}} fmt=${fmt//\{RETURN\}/$(SetDelmValues "$2")} exec 2<&5 # log [[ $fmt ]] && { echo "$fmt" >> "$_BOT_LOG_FILE_" || MessageError API; } # Limpa objetos fid= fbot= fname= fuser= lcode= cid= ctype= ctitle= mid= mdate= mtext= etype= obj= oid= done return $? } MethodReturn() { # Retorno case $_BOT_TYPE_RETURN_ in json) echo "$1";; value) SetDelmValues "$1";; map) local key val vars vals i obj return=() mapfile -t vars <<< $(GetAllKeys "$1") mapfile -t vals <<< $(GetAllValues "$1") for i in ${!vars[@]}; do key=${vars[$i]//[0-9\[\]]/} key=${key#result.} key=${key//./_} val=${vals[$i]} val=${val#\"} val=${val%\"} [[ ${return[$key]} ]] && return[$key]+=${_BOT_DELM_}${val} || return[$key]=$val [[ $_BOT_MONITOR_ ]] && printf "[%s]: return[%s] = '%s'\n" "${FUNCNAME[1]}" "$key" "$val" done ;; esac [[ $(jq -r '.ok' <<< "$1") == true ]] return $? } MessageError() { # Variáveis locais local err_message err_param assert i # A variável 'BASH_LINENO' é dinâmica e armazena o número da linha onde foi expandida. # Quando chamada dentro de um subshell, passa ser instanciada como um array, armazenando diversos # valores onde cada índice refere-se a um shell/subshell. As mesmas caracteristicas se aplicam a variável # 'FUNCNAME', onde é armazenado o nome da função onde foi chamada. # Obtem o índice da função na hierarquia de chamada. [[ ${FUNCNAME[1]} == CheckArgType ]] && i=2 || i=1 # Lê o tipo de ocorrência. # TG - Erro externo retornado pelo core do telegram. # API - Erro interno gerado pela API do ShellBot. case $1 in TG) err_param="$(Json '.error_code' "$2")" err_message="$(Json '.description' "$2")" ;; API) err_param="${3:--}: ${4:--}" err_message="$2" assert=true ;; esac # Imprime erro printf "%s: erro: linha %s: %s: %s: %s\n" \ "${_BOT_SCRIPT_}" \ "${BASH_LINENO[$i]:--}" \ "${FUNCNAME[$i]:--}" \ "${err_param:--}" \ "${err_message:-$_ERR_UNKNOWN_}" 1>&2 # Finaliza script/thread em caso de erro interno, caso contrário retorna 1 ${assert:-false} && exit 1 || return 1 } CheckArgType() { # CheckArgType recebe os dados da função chamadora e verifica # o dado recebido com o tipo suportado pelo parâmetro. # É retornado '0' para sucesso, caso contrário uma mensagem # de erro é retornada e o script/thread é finalizado com status '1'. case $1 in user) id "$3" &>/dev/null || MessageError API "$_ERR_SERVICE_USER_NOT_FOUND_" "$2" "$3";; func) [[ $(type -t "$3") == function ]] || MessageError API "$_ERR_FUNCTION_NOT_FOUND_" "$2" "$3";; var) [[ -v $3 ]] || MessageError API "$_ERR_VAR_NAME_" "$2" "$3";; int) [[ $3 =~ ^-?[0-9]+$ ]] || MessageError API "$_ERR_TYPE_INT_" "$2" "$3";; float) [[ $3 =~ ^-?[0-9]+\.[0-9]+$ ]] || MessageError API "$_ERR_TYPE_FLOAT_" "$2" "$3";; bool) [[ $3 =~ ^(true|false)$ ]] || MessageError API "$_ERR_TYPE_BOOL_" "$2" "$3";; token) [[ $3 =~ ^[0-9]+:[a-zA-Z0-9_-]+$ ]] || MessageError API "$_ERR_TOKEN_INVALID_" "$2" "$3";; file) [[ $3 =~ ^@ && ! -f ${3#@} ]] && MessageError API "$_ERR_FILE_NOT_FOUND_" "$2" "$3";; return) [[ $3 == @(json|map|value) ]] || MessageError API "$_ERR_ARG_" "$2" "$3";; cmd) [[ $3 =~ ^/[a-zA-Z0-9_]+$ ]] || MessageError API "$_ERR_ARG_" "$2" "$3";; flag) [[ $3 =~ ^[a-zA-Z0-9_]+$ ]] || MessageError API "$_ERR_ARG_" "$2" "$3";; esac return $? } FlushOffset() { local sid eid jq_obj while :; do jq_obj=$(ShellBot.getUpdates --limit 100 --offset $(ShellBot.OffsetNext)) IFS=' ' read -a update_id <<< $(jq -r '.result|.[]|.update_id' <<< $jq_obj) [[ $update_id ]] || break sid=${sid:-${update_id[0]}} eid=${update_id[-1]} done echo "${sid:-0}|${eid:-0}" return $? } CreateUnitService() { local service=${1%.*}.service local ok='\033[0;32m[OK]\033[0;m' local fail='\033[0;31m[FALHA]\033[0;m' ((UID == 0)) || MessageError API "$_ERR_SERVICE_NOT_ROOT_" # O modo 'service' requer que o sistema de gerenciamento de processos 'systemd' # esteja presente para que o Unit target seja linkado ao serviço. if ! which systemctl &>/dev/null; then MessageError API "$_ERR_SERVICE_SYSTEMD_NOT_FOUND_"; fi # Se o serviço existe. test -e /lib/systemd/system/$service && \ MessageError API "$_ERR_SERVICE_EXISTS_" "$service" # Gerando as configurações do target. cat > /lib/systemd/system/$service << _eof [Unit] Description=$1 - (SHELLBOT) After=network-online.target [Service] User=$2 WorkingDirectory=$PWD ExecStart=/bin/bash $1 ExecReload=/bin/kill -HUP \$MAINPID ExecStop=/bin/kill -KILL \$MAINPID KillMode=process Restart=on-failure RestartPreventExitStatus=255 Type=simple [Install] WantedBy=multi-user.target _eof [[ $? -eq 0 ]] && { printf '%s foi criado com sucesso !!\n' $service echo -n "Habilitando..." systemctl enable $service &>/dev/null && echo -e $ok || \ { echo -e $fail; MessageError API; } sed -i -r '/^\s*ShellBot.init\s/s/\s--?(s(ervice)?|u(ser)?\s+\w+)\b//g' "$1" systemctl daemon-reload echo -n "Iniciando..." systemctl start $service &>/dev/null && { echo -e $ok systemctl status $service echo -e "\nUso: sudo systemctl {start|stop|restart|reload|status} $service" } || echo -e $fail } || MessageError API exit 0 } # Inicializa o bot, definindo sua API e _TOKEN_. ShellBot.init() { local method_return delm ret logfmt jq_obj offset local token monitor flush service user logfile logfmt # Verifica se o bot já foi inicializado. [[ $_SHELLBOT_INIT_ ]] && MessageError API "$_ERR_BOT_ALREADY_INIT_" local param=$(getopt --name "$FUNCNAME" \ --options 't:mfsu:l:o:r:d:' \ --longoptions 'token:, monitor, flush, service, user:, log_file:, log_format:, return:, delimiter:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -t|--token) CheckArgType token "$1" "$2" token=$2 shift 2 ;; -m|--monitor) # Ativa modo monitor monitor=true shift ;; -f|--flush) # Define a FLAG flush para o método 'ShellBot.getUpdates'. Se ativada, faz com que # o método obtenha somente as atualizações disponíveis, ignorando a extração dos # objetos JSON e a inicialização das variáveis. flush=true shift ;; -s|--service) service=true shift ;; -u|--user) CheckArgType user "$1" "$2" user=$2 shift 2 ;; -l|--log_file) logfile=$2 shift 2 ;; -o|--log_format) logfmt=$2 shift 2 ;; -r|--return) CheckArgType return "$1" "$2" ret=$2 shift 2 ;; -d|--delimiter) delm=$2 shift 2 ;; --) shift break ;; esac done # Parâmetro obrigatório. [[ $token ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --token]" [[ $user && ! $service ]] && MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --service]" [[ $service ]] && CreateUnitService "$_BOT_SCRIPT_" "${user:-$USER}" declare -gr _TOKEN_=$token # TOKEN declare -gr _API_TELEGRAM_="https://api.telegram.org/bot$_TOKEN_" # API # Testa conexão. curl -s "$_API_TELEGRAM_" &>- || MessageError API "$_ERR_CONNECTION_" # Um método simples para testar o token de autenticação do seu bot. # Não requer parâmetros. Retorna informações básicas sobre o bot em forma de um objeto Usuário. ShellBot.getMe() { # Chama o método getMe passando o endereço da API, seguido do nome do método. jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.}) # Verifica o status de retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.getMe &>- || MessageError API "$_ERR_TOKEN_UNAUTHORIZED_" '[-t, --token]' # Salva as informações do bot. declare -gr _BOT_INFO_=( [0]=$_TOKEN_ [1]=$(Json '.result.id' $jq_obj) [2]=$(Json '.result.first_name' $jq_obj) [3]=$(Json '.result.username' $jq_obj) ) # Configurações. declare -gr _BOT_FLUSH_=$flush declare -gr _BOT_MONITOR_=$monitor declare -gr _BOT_SERVICE_=$service declare -gr _BOT_USER_SERVICE_=$user declare -gr _BOT_TYPE_RETURN_=${ret:-value} declare -gr _BOT_DELM_=${delm:-|} declare -gr _BOT_LOG_FILE_=${logfile} declare -gr _BOT_LOG_FORMAT_=${logfmt:-%(%d/%m/%Y %H:%M:%S)T: \{BASENAME\}: \{BOT_USERNAME\}: \{UPDATE_ID\}: \{METHOD\}: \{CHAT_TYPE\}: \{FROM_USERNAME\}: \{OBJECT_TYPE\}: \{OBJECT_ID\}: \{MESSAGE_TEXT\}} declare -gr _SHELLBOT_INIT_=1 # SHELLBOT (FUNÇÕES) # Inicializa as funções para chamadas aos métodos da API do telegram. ShellBot.ListUpdates(){ echo ${!update_id[@]}; } ShellBot.TotalUpdates(){ echo ${#update_id[@]}; } ShellBot.OffsetEnd(){ local -i offset=${update_id[@]: -1}; echo $offset; } ShellBot.OffsetNext(){ echo $((${update_id[@]: -1}+1)); } ShellBot.token() { echo "${_BOT_INFO_[0]}"; } ShellBot.id() { echo "${_BOT_INFO_[1]}"; } ShellBot.first_name() { echo "${_BOT_INFO_[2]}"; } ShellBot.username() { echo "${_BOT_INFO_[3]}"; } ShellBot.getConfig() { local jq_obj printf -v jq_obj '{"monitor":%s,"flush":%s,"service":%s,"return":"%s","delimiter":"%s","user":"%s","log_file":"%s","log_format":"%s"}' \ "${_BOT_MONITOR_:-false}" \ "${_BOT_FLUSH_:-false}" \ "${_BOT_SERVICE_:-false}" \ "${_BOT_TYPE_RETURN_}" \ "${_BOT_DELM_}" \ "${_BOT_USER_SERVICE_}" \ "${_BOT_LOG_FILE_}" \ "${_BOT_LOG_FORMAT_}" MethodReturn "$jq_obj" return $? } ShellBot.regHandleFunction() { local function data handle args local param=$(getopt --name "$FUNCNAME" \ --options 'f:a:d:' \ --longoptions 'function:, args:, callback_data:' \ -- "$@") eval set -- "$param" while : do case $1 in -f|--function) CheckArgType func "$1" "$2" function=$2 shift 2 ;; -a|--args) args=$2 shift 2 ;; -d|--callback_data) data=$2 shift 2 ;; --) shift break ;; esac done [[ $function ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-f, --function]" [[ $data ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-d, --callback_data]" [[ ${_BOT_HANDLE_[$data]} ]] && MessageError API "$_ERR_HANDLE_EXISTS_" '[-d, --callback_data]' _BOT_HANDLE_[$data]=func:$function' '$args return 0 } ShellBot.regHandleExec() { local cmd data local param=$(getopt --name "$FUNCNAME" \ --options 'c:d:' \ --longoptions 'command:, callback_data:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--command) cmd=$2 shift 2 ;; -d|--callback_data) data=$2 shift 2 ;; --) shift break ;; esac done [[ $cmd ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --command]" [[ $data ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-d, --callback_data]" [[ ${_BOT_HANDLE_[$data]} ]] && MessageError API "$_ERR_HANDLE_EXISTS_" "[-d, --callback_data]" _BOT_HANDLE_[$data]=exec:$cmd return 0 } ShellBot.watchHandle() { local data flag cmd local param=$(getopt --name "$FUNCNAME" \ --options 'd' \ --longoptions 'callback_data' \ -- "$@") eval set -- "$param" while : do case $1 in -d|--callback_data) shift 2 data=$1 ;; *) shift break ;; esac done # Handles (somente-leitura) readonly _BOT_HANDLE_ [[ $data ]] || return 1 # vazio IFS=':' read -r flag cmd <<< "${_BOT_HANDLE_[$data]}" case $flag in func) $cmd;; exec) eval "$cmd";; esac # retorno return 0 } ShellBot.getWebhookInfo() { # Variável local local jq_obj # Chama o método getMe passando o endereço da API, seguido do nome do método. jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.}) # Verifica o status de retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.deleteWebhook() { # Variável local local jq_obj # Chama o método getMe passando o endereço da API, seguido do nome do método. jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.}) # Verifica o status de retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.setWebhook() { local url certificate max_connections allowed_updates jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'u:c:m:a:' \ --longoptions 'url:, certificate:, max_connections:, allowed_updates:' \ -- "$@") eval set -- "$param" while : do case $1 in -u|--url) url=$2 shift 2 ;; -c|--certificate) CheckArgType file "$1" "$2" certificate=$2 shift 2 ;; -m|--max_connections) CheckArgType int "$1" "$2" max_connections=$2 shift 2 ;; -a|--allowed_updates) allowed_updates=$2 shift 2 ;; --) shift break ;; esac done [[ $url ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --url]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${url:+-d url="$url"} \ ${certificate:+-d certificate="$certificate"} \ ${max_connections:+-d max_connections="$max_connections"} \ ${allowed_updates:+-d allowed_updates="$allowed_updates"}) # Testa o retorno do método. MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.setChatPhoto() { local chat_id photo jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:p:' \ --longoptions 'chat_id:,photo:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -p|--photo) CheckArgType file "$1" "$2" photo=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $photo ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-p, --photo]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${photo:+-F photo="$photo"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.deleteChatPhoto() { local chat_id jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.setChatTitle() { local chat_id title jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:t:' \ --longoptions 'chat_id:,title:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -t|--title) title=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $title ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --title]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${title:+-d title="$title"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.setChatDescription() { local chat_id description jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:d:' \ --longoptions 'chat_id:,description:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -d|--description) description=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $description ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-d, --description]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${description:+-d description="$description"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.pinChatMessage() { local chat_id message_id disable_notification jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:n:' \ --longoptions 'chat_id:, message_id:, disable_notification:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; -n|--disable_notification) CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${message_id:+-d message_id="$message_id"} \ ${disable_notification:+-d disable_notification="$disable_notification"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.unpinChatMessage() { local chat_id jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.restrictChatMember() { local chat_id user_id until_date permissions jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:u:d:p:' \ --longoptions 'chat_id:, user_id:, until_date:, permissions:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; -d|--until_date) CheckArgType int "$1" "$2" until_date=$2 shift 2 ;; -p|--permissions) permissions=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" [[ $permissions ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-p, --permissions]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${user_id:+-d user_id="$user_id"} \ ${until_date:+-d until_date="$until_date"} \ ${permissions:+-d permissions="$permissions"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.promoteChatMember() { local chat_id user_id can_change_info can_post_messages \ can_edit_messages can_delete_messages can_invite_users \ can_restrict_members can_pin_messages can_promote_members \ jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:u:i:p:e:d:v:r:f:m:' \ --longoptions 'chat_id:, user_id:, can_change_info:, can_post_messages:, can_edit_messages:, can_delete_messages:, can_invite_users:, can_restrict_members:, can_pin_messages:, can_promote_members:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; -i|--can_change_info) CheckArgType bool "$1" "$2" can_change_info=$2 shift 2 ;; -p|--can_post_messages) CheckArgType bool "$1" "$2" can_post_messages=$2 shift 2 ;; -e|--can_edit_messages) CheckArgType bool "$1" "$2" can_edit_messages=$2 shift 2 ;; -d|--can_delete_messages) CheckArgType bool "$1" "$2" can_delete_messages=$2 shift 2 ;; -v|--can_invite_users) CheckArgType bool "$1" "$2" can_invite_users=$2 shift 2 ;; -r|--can_restrict_members) CheckArgType bool "$1" "$2" can_restrict_members=$2 shift 2 ;; -f|--can_pin_messages) CheckArgType bool "$1" "$2" can_pin_messages=$2 shift 2 ;; -m|--can_promote_members) CheckArgType bool "$1" "$2" can_promote_members=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --user_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${user_id:+-d user_id="$user_id"} \ ${can_change_info:+-d can_change_info="$can_change_info"} \ ${can_post_messages:+-d can_post_messages="$can_post_messages"} \ ${can_edit_messages:+-d can_edit_messages="$can_edit_messages"} \ ${can_delete_messages:+-d can_delete_messages="$can_delete_messages"} \ ${can_invite_users:+-d can_invite_users="$can_invite_users"} \ ${can_restrict_members:+-d can_restrict_members="$can_restrict_members"} \ ${can_pin_messages:+-d can_pin_messages="$can_pin_messages"} \ ${can_promote_members:+-d can_promote_members="$can_promote_members"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.exportChatInviteLink() { local chat_id jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) # Testa o retorno do método. MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.sendVideoNote() { local chat_id video_note duration length disable_notification \ reply_to_message_id reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:v:t:l:n:r:k:' \ --longoptions 'chat_id:, video_note:, duration:, length:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -v|--video_note) CheckArgType file "$1" "$2" video_note=$2 shift 2 ;; -t|--duration) CheckArgType int "$1" "$2" duration=$2 shift 2 ;; -l|--length) CheckArgType int "$1" "$2" length=$2 shift 2 ;; -n|--disable_notification) CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $video_note ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-v, --video_note]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${video_note:+-F video_note="$video_note"} \ ${duration:+-F duration="$duration"} \ ${length:+-F length="$length"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Testa o retorno do método. MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.InlineKeyboardButton() { local __button __line __text __url __callback_data \ __switch_inline_query __switch_inline_query_current_chat local __param=$(getopt --name "$FUNCNAME" \ --options 'b:l:t:u:c:q:s:' \ --longoptions 'button:, line:, text:, url:, callback_data:, switch_inline_query:, switch_inline_query_chat:' \ -- "$@") eval set -- "$__param" while : do case $1 in -b|--button) # Ponteiro que recebe o endereço de "button" com as definições # da configuração do botão inserido. CheckArgType var "$1" "$2" __button=$2 shift 2 ;; -l|--line) CheckArgType int "$1" "$2" __line=$(($2-1)) shift 2 ;; -t|--text) __text=$(echo -e "$2") shift 2 ;; -u|--url) __url=$2 shift 2 ;; -c|--callback_data) __callback_data=$2 shift 2 ;; -q|--switch_inline_query) __switch_inline_query=$2 shift 2 ;; -s|--switch_inline_query_current_chat) __switch_inline_query_current_chat=$2 shift 2 ;; --) shift break ;; esac done [[ $__button ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-b, --button]" [[ $__text ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --text]" [[ $__callback_data ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --callback_data]" [[ $__line ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-l, --line]" __button=$__button[$__line] printf -v $__button '%s' "${!__button#[}" printf -v $__button '%s' "${!__button%]}" printf -v $__button '%s {"text": "%s", "callback_data": "%s", "url": "%s", "switch_inline_query": "%s", "switch_inline_query_current_chat": "%s"}' \ "${!__button:+${!__button},}" \ "${__text}" \ "${__callback_data}" \ "${__url}" \ "${__switch_inline_query}" \ "${__switch_inline_query_current_chat}" printf -v $__button '%s' "[${!__button}]" return $? } ShellBot.InlineKeyboardMarkup() { local __button __keyboard local __param=$(getopt --name "$FUNCNAME" \ --options 'b:' \ --longoptions 'button:' \ -- "$@") eval set -- "$__param" while : do case $1 in -b|--button) # Ponteiro que recebe o endereço da variável "teclado" com as definições # de configuração do botão inserido. CheckArgType var "$1" "$2" __button="$2" shift 2 ;; --) shift break ;; esac done [[ $__button ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-b, --button]" __button=$__button[@] printf -v __keyboard '%s,' "${!__button}" printf -v __keyboard '%s' "${__keyboard%,}" # Constroi a estrutura dos objetos + array keyboard, define os valores e salva as configurações. # Por padrão todos os valores são 'false' até que seja definido. printf '{"inline_keyboard": [%s]}' "${__keyboard}" return $? } ShellBot.answerCallbackQuery() { local callback_query_id text show_alert url cache_time jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:t:s:u:e:' \ --longoptions 'callback_query_id:, text:, show_alert:, url:, cache_time:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--callback_query_id) callback_query_id=$2 shift 2 ;; -t|--text) text=$(echo -e "$2") shift 2 ;; -s|--show_alert) # boolean CheckArgType bool "$1" "$2" show_alert=$2 shift 2 ;; -u|--url) url=$2 shift 2 ;; -e|--cache_time) # inteiro CheckArgType int "$1" "$2" cache_time=$2 shift 2 ;; --) shift break ;; esac done [[ $callback_query_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --callback_query_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${callback_query_id:+-d callback_query_id="$callback_query_id"} \ ${text:+-d text="$text"} \ ${show_alert:+-d show_alert="$show_alert"} \ ${url:+-d url="$url"} \ ${cache_time:+-d cache_time="$cache_time"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } # Cria objeto que representa um teclado personalizado com opções de resposta ShellBot.ReplyKeyboardMarkup() { # Variáveis locais local __button __resize_keyboard __on_time_keyboard __selective __keyboard # Lê os parâmetros da função. local __param=$(getopt --name "$FUNCNAME" \ --options 'b:r:t:s:' \ --longoptions 'button:, resize_keyboard:, one_time_keyboard:, selective:' \ -- "$@") # Transforma os parâmetros da função em parâmetros posicionais # # Exemplo: # --param1 arg1 --param2 arg2 --param3 arg3 ... # $1 $2 $3 eval set -- "$__param" # Aguarda leitura dos parâmetros while : do # Lê o parâmetro da primeira posição "$1"; Se for um parâmetro válido, # salva o valor do argumento na posição '$2' e desloca duas posições a esquerda (shift 2); Repete o processo # até que o valor de '$1' seja igual '--' e finaliza o loop. case $1 in -b|--button) CheckArgType var "$1" "$2" __button=$2 shift 2 ;; -r|--resize_keyboard) # Tipo: boolean CheckArgType bool "$1" "$2" __resize_keyboard=$2 shift 2 ;; -t|--one_time_keyboard) # Tipo: boolean CheckArgType bool "$1" "$2" __on_time_keyboard=$2 shift 2 ;; -s|--selective) # Tipo: boolean CheckArgType bool "$1" "$2" __selective=$2 shift 2 ;; --) shift break ;; esac done # Imprime mensagem de erro se o parâmetro obrigatório for omitido. [[ $__button ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-b, --button]" __button=$__button[@] printf -v __keyboard '%s,' "${!__button}" printf -v __keyboard '%s' "${__keyboard%,}" # Constroi a estrutura dos objetos + array keyboard, define os valores e salva as configurações. # Por padrão todos os valores são 'false' até que seja definido. printf '{"keyboard": [%s], "resize_keyboard": %s, "one_time_keyboard": %s, "selective": %s}' \ "${__keyboard}" \ "${__resize_keyboard:-false}" \ "${__on_time_keyboard:-false}" \ "${__selective:-false}" # status return $? } ShellBot.KeyboardButton() { local __text __contact __location __button __line __request_poll local __param=$(getopt --name "$FUNCNAME" \ --options 'b:l:t:c:o:r:' \ --longoptions 'button:, line:, text:, request_contact:, request_location:, request_poll:' \ -- "$@") eval set -- "$__param" while : do case $1 in -b|--button) CheckArgType var "$1" "$2" __button=$2 shift 2 ;; -l|--line) CheckArgType int "$1" "$2" __line=$(($2-1)) shift 2 ;; -t|--text) __text=$(echo -e "$2") shift 2 ;; -c|--request_contact) CheckArgType bool "$1" "$2" __contact=$2 shift 2 ;; -o|--request_location) CheckArgType bool "$1" "$2" __location=$2 shift 2 ;; -r|--request_poll) __request_poll=$2 shift 2 ;; --) shift break ;; esac done [[ $__button ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-b, --button]" [[ $__text ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --text]" [[ $__line ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-l, --line]" __button=$__button[$__line] printf -v $__button '%s' "${!__button#[}" printf -v $__button '%s' "${!__button%]}" printf -v $__button '%s {"text": "%s", "request_contact": %s, "request_location": %s, "request_poll": %s}' \ "${!__button:+${!__button},}" \ "${__text}" \ "${__contact:-false}" \ "${__location:-false}" \ "${__request_poll:-\"\"}" printf -v $__button '%s' "[${!__button}]" return $? } ShellBot.ForceReply() { local selective local param=$(getopt --name "$FUNCNAME" \ --options 's:' \ --longoptions 'selective:' \ -- "$@") eval set -- "$param" while : do case $1 in -s|--selective) CheckArgType bool "$1" "$2" selective=$2 shift 2 ;; --) shift break ;; esac done printf '{"force_reply": true, "selective": %s}' ${selective:-false} return $? } ShellBot.ReplyKeyboardRemove() { local selective local param=$(getopt --name "$FUNCNAME" \ --options 's:' \ --longoptions 'selective:' \ -- "$@") eval set -- "$param" while : do case $1 in -s|--selective) CheckArgType bool "$1" "$2" selective=$2 shift 2 ;; --) shift break ;; esac done printf '{"remove_keyboard": true, "selective": %s}' ${selective:-false} return $? } # Envia mensagens ShellBot.sendMessage() { # Variáveis locais local chat_id text parse_mode disable_web_page_preview local disable_notification reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:t:p:w:n:r:k:' \ --longoptions 'chat_id:, text:, parse_mode:, disable_web_page_preview:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -t|--text) text=$(echo -e "$2") shift 2 ;; -p|--parse_mode) # Tipo: "markdown" ou "html" parse_mode=$2 shift 2 ;; -w|--disable_web_page_preview) # Tipo: boolean CheckArgType bool "$1" "$2" disable_web_page_preview=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $text ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --text]" # Chama o método da API, utilizando o comando request especificado; Os parâmetros # e valores são passados no form e lidos pelo método. O retorno do método é redirecionado para o arquivo 'update.Json'. # Variáveis com valores nulos são ignoradas e consequentemente os respectivos parâmetros omitidos. jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${text:+-d text="$text"} \ ${parse_mode:+-d parse_mode="$parse_mode"} \ ${disable_web_page_preview:+-d disable_web_page_preview="$disable_web_page_preview"} \ ${disable_notification:+-d disable_notification="$disable_notification"} \ ${reply_to_message_id:+-d reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-d reply_markup="$reply_markup"}) # Testa o retorno do método. MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Função para reencaminhar mensagens de qualquer tipo. ShellBot.forwardMessage() { # Variáveis locais local chat_id form_chat_id disable_notification message_id jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:f:n:m:' \ --longoptions 'chat_id:, from_chat_id:, disable_notification:, message_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id="$2" shift 2 ;; -f|--from_chat_id) from_chat_id="$2" shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification="$2" shift 2 ;; -m|--message_id) # Tipo: inteiro CheckArgType int "$1" "$2" message_id="$2" shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $from_chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-f, --from_chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${from_chat_id:+-d from_chat_id="$from_chat_id"} \ ${disable_notification:+-d disable_notification="$disable_notification"} \ ${message_id:+-d message_id="$message_id"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # status return $? } # Utilize essa função para enviar fotos. ShellBot.sendPhoto() { # Variáveis locais local chat_id photo caption disable_notification local parse_mode reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:p:t:m:n:r:k:' \ --longoptions 'chat_id:, photo:, caption:, parse_mode:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -p|--photo) CheckArgType file "$1" "$2" photo=$2 shift 2 ;; -t|--caption) # Limite máximo de caracteres: 200 caption=$(echo -e "$2") shift 2 ;; -m|--parse_mode) parse_mode=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $photo ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-p, --photo]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${photo:+-F photo="$photo"} \ ${caption:+-F caption="$caption"} \ ${parse_mode:+-F parse_mode="$parse_mode"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Utilize essa função para enviar arquivos de audio. ShellBot.sendAudio() { # Variáveis locais local chat_id audio caption duration performer title local parse_mode disable_notification reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:a:t:m:d:e:i:n:r:k' \ --longoptions 'chat_id:, audio:, caption:, parse_mode:, duration:, performer:, title:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -a|--audio) CheckArgType file "$1" "$2" audio=$2 shift 2 ;; -t|--caption) caption=$(echo -e "$2") shift 2 ;; -m|--parse_mode) parse_mode=$2 shift 2 ;; -d|--duration) # Tipo: inteiro CheckArgType int "$1" "$2" duration=$2 shift 2 ;; -e|--performer) performer=$2 shift 2 ;; -i|--title) title=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $audio ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-a, --audio]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${audio:+-F audio="$audio"} \ ${caption:+-F caption="$caption"} \ ${parse_mode:+-F parse_mode="$parse_mode"} \ ${duration:+-F duration="$duration"} \ ${performer:+-F performer="$performer"} \ ${title:+-F title="$title"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Utilize essa função para enviar documentos. ShellBot.sendDocument() { # Variáveis locais local chat_id document caption disable_notification local parse_mode reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:d:t:m:n:r:k:' \ --longoptions 'chat_id:, document:, caption:, parse_mode:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -d|--document) CheckArgType file "$1" "$2" document=$2 shift 2 ;; -t|--caption) caption=$(echo -e "$2") shift 2 ;; -m|--parse_mode) parse_mode=$2 shift 2 ;; -n|--disable_notification) CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $document ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-d, --document]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${document:+-F document="$document"} \ ${caption:+-F caption="$caption"} \ ${parse_mode:+-F parse_mode="$parse_mode"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Utilize essa função para enviat stickers ShellBot.sendSticker() { # Variáveis locais local chat_id sticker disable_notification reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:s:n:r:k:' \ --longoptions 'chat_id:, sticker:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -s|--sticker) CheckArgType file "$1" "$2" sticker=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $sticker ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --sticker]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${sticker:+-F sticker="$sticker"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.getStickerSet() { local name jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'n:' \ --longoptions 'name:' \ -- "$@") # parâmetros posicionais eval set -- "$param" while : do case $1 in -n|--name) name=$2 shift 2 ;; --) shift break ;; esac done [[ $name ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-n, --name]" jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} ${name:+-d name="$name"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.uploadStickerFile() { local user_id png_sticker jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'u:s:' \ --longoptions 'user_id:, png_sticker:' \ -- "$@") eval set -- "$param" while : do case $1 in -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; -s|--png_sticker) CheckArgType file "$1" "$2" png_sticker=$2 shift 2 ;; --) shift break ;; esac done [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" [[ $png_sticker ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --png_sticker]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${user_id:+-F user_id="$user_id"} \ ${png_sticker:+-F png_sticker="$png_sticker"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.setStickerPositionInSet() { local sticker position jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 's:p:' \ --longoptions 'sticker:, position:' \ -- "$@") eval set -- "$param" while : do case $1 in -s|--sticker) sticker=$2 shift 2 ;; -p|--position) CheckArgType int "$1" "$2" position=$2 shift 2 ;; --) shift break ;; esac done [[ $sticker ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --sticker]" [[ $position ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-p, --position]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${sticker:+-d sticker="$sticker"} \ ${position:+-d position="$position"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.deleteStickerFromSet() { local sticker jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 's:' \ --longoptions 'sticker:' \ -- "$@") eval set -- "$param" while : do case $1 in -s|--sticker) sticker=$2 shift 2 ;; --) shift break ;; esac done [[ $sticker ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --sticker]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} ${sticker:+-d sticker="$sticker"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.stickerMaskPosition() { local point x_shift y_shift scale zoom local param=$(getopt --name "$FUNCNAME" \ --options 'p:x:y:s:z:' \ --longoptions 'point:, x_shift:, y_shift:, scale:, zoom:' \ -- "$@") eval set -- "$param" while : do case $1 in -p|--point) point=$2 shift 2 ;; -x|--x_shift) CheckArgType float "$1" "$2" x_shift=$2 shift 2 ;; -y|--y_shift) CheckArgType float "$1" "$2" y_shift=$2 shift 2 ;; -s|--scale) CheckArgType float "$1" "$2" scale=$2 shift 2 ;; -z|--zoom) CheckArgType float "$1" "$2" zoom=$2 shift 2 ;; --) shift break ;; esac done [[ $point ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-p, --point]" [[ $x_shift ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-x, --x_shift]" [[ $y_shift ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-y, --y_shift]" [[ $scale ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --scale]" [[ $zoom ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-z, --zoom]" cat << _EOF { "point": "$point", "x_shift": $x_shift, "y_shift": $y_shift, "scale": $scale, "zoom": $zoom } _EOF return 0 } ShellBot.createNewStickerSet() { local user_id name title png_sticker emojis contains_masks mask_position jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'u:n:t:s:e:c:m:' \ --longoptions 'user_id:, name:, title:, png_sticker:, emojis:, contains_mask:, mask_position:' \ -- "$@") eval set -- "$param" while : do case $1 in -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; -n|--name) name=$2 shift 2 ;; -t|--title) title=$2 shift 2 ;; -s|--png_sticker) CheckArgType file "$1" "$2" png_sticker=$2 shift 2 ;; -e|--emojis) emojis=$2 shift 2 ;; -c|--contains_masks) CheckArgType bool "$1" "$2" contains_masks=$2 shift 2 ;; -m|--mask_position) mask_position=$2 shift 2 ;; --) shift break ;; esac done [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" [[ $name ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-n, --name]" [[ $title ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --title]" [[ $png_sticker ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --png_sticker]" [[ $emojis ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-e, --emojis]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${user_id:+-F user_id="$user_id"} \ ${name:+-F name="$name"} \ ${title:+-F title="$title"} \ ${png_sticker:+-F png_sticker="$png_sticker"} \ ${emojis:+-F emojis="$emojis"} \ ${contains_masks:+-F contains_masks="$contains_masks"} \ ${mask_position:+-F mask_position="$mask_position"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.addStickerToSet() { local user_id name png_sticker emojis mask_position jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'u:n:s:e:m:' \ --longoptions 'user_id:, name:, png_sticker:, emojis:, mask_position:' \ -- "$@") eval set -- "$param" while : do case $1 in -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; -n|--name) name=$2 shift 2 ;; -s|--png_sticker) CheckArgType file "$1" "$2" png_sticker=$2 shift 2 ;; -e|--emojis) emojis=$2 shift 2 ;; -m|--mask_position) mask_position=$2 shift 2 ;; --) shift break ;; esac done [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" [[ $name ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-n, --name]" [[ $png_sticker ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --png_sticker]" [[ $emojis ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-e, --emojis]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${user_id:+-F user_id="$user_id"} \ ${name:+-F name="$name"} \ ${png_sticker:+-F png_sticker="$png_sticker"} \ ${emojis:+-F emojis="$emojis"} \ ${mask_position:+-F mask_position="$mask_position"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Função para enviar arquivos de vídeo. ShellBot.sendVideo() { # Variáveis locais local chat_id video duration width height caption disable_notification local parse_mode reply_to_message_id reply_markup jq_obj supports_streaming # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:v:d:w:h:t:m:n:r:k:s:' \ --longoptions 'chat_id:, video:, duration:, width:, height:, caption:, parse_mode:, disable_notification:, reply_to_message_id:, reply_markup:, supports_streaming:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -v|--video) CheckArgType file "$1" "$2" video=$2 shift 2 ;; -d|--duration) # Tipo: inteiro CheckArgType int "$1" "$2" duration=$2 shift 2 ;; -w|--width) # Tipo: inteiro CheckArgType int "$1" "$2" width=$2 shift 2 ;; -h|--height) # Tipo: inteiro CheckArgType int "$1" "$2" height=$2 shift 2 ;; -t|--caption) caption=$(echo -e "$2") shift 2 ;; -m|--parse_mode) parse_mode=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; -s|--supports_streaming) CheckArgType bool "$1" "$2" supports_streaming=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $video ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-v, --video]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${video:+-F video="$video"} \ ${duration:+-F duration="$duration"} \ ${width:+-F width="$width"} \ ${height:+-F height="$height"} \ ${caption:+-F caption="$caption"} \ ${parse_mode:+-F parse_mode="$parse_mode"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"} \ ${supports_streaming:+-F supports_streaming="$supports_streaming"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Função para enviar audio. ShellBot.sendVoice() { # Variáveis locais local chat_id voice caption duration disable_notification local parse_mode reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:v:t:m:d:n:r:k:' \ --longoptions 'chat_id:, voice:, caption:, parse_mode:, duration:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -v|--voice) CheckArgType file "$1" "$2" voice=$2 shift 2 ;; -t|--caption) caption=$(echo -e "$2") shift 2 ;; -m|--parse_mode) parse_mode=$2 shift 2 ;; -d|--duration) # Tipo: inteiro CheckArgType int "$1" "$2" duration=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $voice ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-v, --voice]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${voice:+-F voice="$voice"} \ ${caption:+-F caption="$caption"} \ ${parse_mode:+-F parse_mode="$parse_mode"} \ ${duration:+-F duration="$duration"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Função utilizada para enviar uma localidade utilizando coordenadas de latitude e longitude. ShellBot.sendLocation() { # Variáveis locais local chat_id latitude longitude live_period local disable_notification reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:l:g:p:n:r:k:' \ --longoptions 'chat_id:, latitude:, longitude:, live_period:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -l|--latitude) # Tipo: float CheckArgType float "$1" "$2" latitude=$2 shift 2 ;; -g|--longitude) # Tipo: float CheckArgType float "$1" "$2" longitude=$2 shift 2 ;; -p|--live_period) CheckArgType int "$1" "$2" live_period=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $latitude ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-l, --latitude]" [[ $longitude ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-g, --longitude]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${latitude:+-F latitude="$latitude"} \ ${longitude:+-F longitude="$longitude"} \ ${live_period:+-F live_period="$live_period"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } # Função utlizada para enviar detalhes de um local. ShellBot.sendVenue() { # Variáveis locais local chat_id latitude longitude title address foursquare_id disable_notification reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:l:g:i:a:f:n:r:k:' \ --longoptions 'chat_id:, latitude:, longitude:, title:, address:, foursquare_id:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -l|--latitude) # Tipo: float CheckArgType float "$1" "$2" latitude=$2 shift 2 ;; -g|--longitude) # Tipo: float CheckArgType float "$1" "$2" longitude=$2 shift 2 ;; -i|--title) title=$2 shift 2 ;; -a|--address) address=$2 shift 2 ;; -f|--foursquare_id) foursquare_id=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $latitude ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-l, --latitude]" [[ $longitude ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-g, --longitude]" [[ $title ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-i, --title]" [[ $address ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-a, --address]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${latitude:+-F latitude="$latitude"} \ ${longitude:+-F longitude="$longitude"} \ ${title:+-F title="$title"} \ ${address:+-F address="$address"} \ ${foursquare_id:+-F foursquare_id="$foursquare_id"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Utilize essa função para enviar um contato + numero ShellBot.sendContact() { # Variáveis locais local chat_id phone_number first_name last_name disable_notification reply_to_message_id reply_markup jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:p:f:l:n:r:k:' \ --longoptions 'chat_id:, phone_number:, first_name:, last_name:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -p|--phone_number) phone_number=$2 shift 2 ;; -f|--first_name) first_name=$2 shift 2 ;; -l|--last_name) last_name=$2 shift 2 ;; -n|--disable_notification) # Tipo: boolean CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) # Tipo: inteiro CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $phone_number ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-p, --phone_number]" [[ $first_name ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-f, --first_name]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${phone_number:+-F phone_number="$phone_number"} \ ${first_name:+-F first_name="$first_name"} \ ${last_name:+-F last_name="$last_name"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Envia uma ação para bot. ShellBot.sendChatAction() { # Variáveis locais local chat_id action jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:a:' \ --longoptions 'chat_id:, action:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -a|--action) action=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $action ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-a, --action]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${action:+-d action="$action"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Utilize essa função para obter as fotos de um determinado usuário. ShellBot.getUserProfilePhotos() { # Variáveis locais local user_id offset limit ind last index max item total jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'u:o:l:' \ --longoptions 'user_id:, offset:, limit:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; -o|--offset) CheckArgType int "$1" "$2" offset=$2 shift 2 ;; -l|--limit) CheckArgType int "$1" "$2" limit=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" # Chama o método jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} \ ${user_id:+-d user_id="$user_id"} \ ${offset:+-d offset="$offset"} \ ${limit:+-d limit="$limit"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Função para listar informações do arquivo especificado. ShellBot.getFile() { # Variáveis locais local file_id jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'f:' \ --longoptions 'file_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -f|--file_id) file_id=$2 shift 2 ;; --) shift break ;; esac done # Parâmetros obrigatórios. [[ $file_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-f, --file_id]" # Chama o método. jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} ${file_id:+-d file_id="$file_id"}) # Testa o retorno do método. MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Essa função kicka o usuário do chat ou canal. (somente administradores) ShellBot.kickChatMember() { # Variáveis locais local chat_id user_id until_date jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:u:d:' \ --longoptions 'chat_id:, user_id:, until_date:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" # Trata os parâmetros while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; -d|--until_date) CheckArgType int "$1" "$2" until_date=$2 shift 2 ;; --) shift break ;; esac done # Parametros obrigatórios. [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" # Chama o método jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${user_id:+-d user_id="$user_id"} \ ${until_date:+-d until_date="$until_date"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } # Utilize essa função para remove o bot do grupo ou canal. ShellBot.leaveChat() { # Variáveis locais local chat_id jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.unbanChatMember() { local chat_id user_id jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:u:' \ --longoptions 'chat_id:, user_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${user_id:+-d user_id="$user_id"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.getChat() { # Variáveis locais local chat_id jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.getChatAdministrators() { local chat_id total key index jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.getChatMembersCount() { local chat_id jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.getChatMember() { # Variáveis locais local chat_id user_id jq_obj # Lê os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'c:u:' \ --longoptions 'chat_id:, user_id:' \ -- "$@") # Define os parâmetros posicionais eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -u|--user_id) CheckArgType int "$1" "$2" user_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" jq_obj=$(curl $_CURL_OPT_ GET $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${user_id:+-d user_id="$user_id"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.editMessageText() { local chat_id message_id inline_message_id text parse_mode disable_web_page_preview reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:i:t:p:w:r:' \ --longoptions 'chat_id:, message_id:, inline_message_id:, text:, parse_mode:, disable_web_page_preview:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; -i|--inline_message_id) CheckArgType int "$1" "$2" inline_message_id=$2 shift 2 ;; -t|--text) text=$(echo -e "$2") shift 2 ;; -p|--parse_mode) parse_mode=$2 shift 2 ;; -w|--disable_web_page_preview) CheckArgType bool "$1" "$2" disable_web_page_preview=$2 shift 2 ;; -r|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $text ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --text]" [[ $inline_message_id ]] && unset chat_id message_id || { [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" } jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${message_id:+-d message_id="$message_id"} \ ${inline_message_id:+-d inline_message_id="$inline_message_id"} \ ${text:+-d text="$text"} \ ${parse_mode:+-d parse_mode="$parse_mode"} \ ${disable_web_page_preview:+-d disable_web_page_preview="$disable_web_page_preview"} \ ${reply_markup:+-d reply_markup="$reply_markup"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.editMessageCaption() { local chat_id message_id inline_message_id local parse_mode caption reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:i:t:p:r:' \ --longoptions 'chat_id:, message_id:, inline_message_id:, caption:, parse_mode:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; -i|--inline_message_id) CheckArgType int "$1" "$2" inline_message_id=$2 shift 2 ;; -t|--caption) caption=$(echo -e "$2") shift 2 ;; -p|--parse_mode) parse_mode=$2 shift 2 ;; -r|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${message_id:+-d message_id="$message_id"} \ ${inline_message_id:+-d inline_message_id="$inline_message_id"} \ ${caption:+-d caption="$caption"} \ ${parse_mode:+-d parse_mode="$parse_mode"} \ ${reply_markup:+-d reply_markup="$reply_markup"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.editMessageReplyMarkup() { local chat_id message_id inline_message_id reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:i:r:' \ --longoptions 'chat_id:, message_id:, inline_message_id:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; -i|--inline_message_id) CheckArgType int "$1" "$2" inline_message_id=$2 shift 2 ;; -r|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $inline_message_id ]] && unset chat_id message_id || { [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" } jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${message_id:+-d message_id="$message_id"} \ ${inline_message_id:+-d inline_message_id="$inline_message_id"} \ ${reply_markup:+-d reply_markup="$reply_markup"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.deleteMessage() { local chat_id message_id jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:' \ --longoptions 'chat_id:, message_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${message_id:+-d message_id="$message_id"}) # Verifica se ocorreu erros durante a chamada do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.downloadFile() { local file_path dir ext file jq_obj local uri="https://api.telegram.org/file/bot$_TOKEN_" local param=$(getopt --name "$FUNCNAME" \ --options 'f:d:' \ --longoptions 'file_path:, dir:' \ -- "$@") eval set -- "$param" while : do case $1 in -f|--file_path) [[ $2 =~ \.[^.]+$ ]] ext=$BASH_REMATCH file_path=$2 shift 2 ;; -d|--dir) [[ -d $2 ]] || MessageError API "$_ERR_DIR_NOT_FOUND_" "$1" "$2" [[ -w $2 ]] || MessageError API "$_ERR_DIR_WRITE_DENIED_" "$1" "$2" dir=${2%/} shift 2 ;; --) shift break ;; esac done [[ $file_path ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-f, --file_path]" [[ $dir ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-d, --dir]" # Gera o nome do arquivo anexando o horário de criação. file=file$(date +%d%m%Y%H%M%S%N)${ext:-.dat} # Executa o download da uri especificada e retorna um objeto json # com as informações do processo. Se tiver sucesso o diretório de # destino é retornado, caso contrário uma mensagem de erro é apresentada. if wget -qO "$dir/$file" "$uri/$file_path"; then # Sucesso printf -v jq_obj '{"ok":true,"result":{"file_path":"%s"}}' "$dir/$file" else # Falha printf -v jq_obj '{"ok":false,"error_code":404,"description":"Bad Request: file not found"}' rm -f "$dir/$file" 2>/dev/null # Remove arquivo inválido. fi MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.editMessageLiveLocation() { local chat_id message_id inline_message_id local latitude longitude reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:i:l:g:r:' \ --longoptions 'chat_id:, message_id:, inline_message_id:, latitude:, longitude:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; -i|--inline_message_id) CheckArgType int "$1" "$2" inline_message_id=$2 shift 2 ;; -l|--latitude) # Tipo: float CheckArgType float "$1" "$2" latitude=$2 shift 2 ;; -g|--longitude) # Tipo: float CheckArgType float "$1" "$2" longitude=$2 shift 2 ;; -r|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $inline_message_id ]] && unset chat_id message_id || { [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" } jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${message_id:+-d message_id="$message_id"} \ ${inline_message_id:+-d inline_message_id="$inline_message_id"} \ ${latitude:+-d latitude="$latitude"} \ ${longitude:+-d longitude="$longitude"} \ ${reply_markup:+-d reply_markup="$reply_markup"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.stopMessageLiveLocation() { local chat_id message_id inline_message_id reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:i:r:' \ --longoptions 'chat_id:, message_id:, inline_message_id:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; -i|--inline_message_id) CheckArgType int "$1" "$2" inline_message_id=$2 shift 2 ;; -r|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $inline_message_id ]] && unset chat_id message_id || { [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --message_id]" } jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${message_id:+-d message_id="$message_id"} \ ${inline_message_id:+-d inline_message_id="$inline_message_id"} \ ${reply_markup:+-d reply_markup="$reply_markup"}) # Testa o retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.setChatStickerSet() { local chat_id sticker_set_name jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:s:' \ --longoptions 'chat_id:, sticker_set_name:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -s|--sticker_set_name) sticker_set_name=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $sticker_set_name ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --sticker_set_name]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${sticker_set_name:+-d sticker_set_name="$sticker_set_name"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.deleteChatStickerSet() { local chat_id jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'chat_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} ${chat_id:+-d chat_id="$chat_id"}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.inputMedia() { local __type __input __media __caption __parse_mode __thumb __width local __height __duration __supports_streaming __performer __title local __param=$(getopt --name "$FUNCNAME" \ --options 't:i:m:c:p:b:w:h:d:s:f:e:' \ --longoptions 'type:, input:, media:, caption:, parse_mode:, thumb:, witdh:, height:, duration:, supports_streaming:, performer:, title:' \ -- "$@") eval set -- "$__param" while : do case $1 in -t|--type) __type=$2 shift 2 ;; -i|--input) CheckArgType var "$1" "$2" __input=$2 shift 2 ;; -m|--media) CheckArgType file "$1" "$2" __media=$2 shift 2 ;; -c|--caption) __caption=$(echo -e "$2") shift 2 ;; -p|--parse_mode) __parse_mode=$2 shift 2 ;; -b|--thumb) CheckArgType file "$1" "$2" __thumb=$2 shift 2 ;; -w|--width) CheckArgType int "$1" "$2" __width=$2 shift 2 ;; -h|--height) CheckArgType int "$1" "$2" __height=$2 shift 2 ;; -d|--duration) CheckArgType int "$1" "$2" __duration=$2 shift 2 ;; -s|--supports_streaming) CheckArgType bool "$1" "$2" __supports_streaming=$2 shift 2 ;; -f|--performer) __performer=$2 shift 2 ;; -e|--title) __title=$2 shift 2 ;; --) shift break ;; esac done [[ $__type ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --type]" [[ $__input ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-i, --input]" [[ $__media ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --media]" local -n __input=$__input __input=${__input:+$__input,}{\"type\":\"$__type\", __input+=\"media\":\"$__media\" __input+=${__caption:+,\"caption\":\"$__caption\"} __input+=${__parse_mode:+,\"parse_mode\":\"$__parse_mode\"} __input+=${__thumb:+,\"thumb\":\"$__thumb\"} __input+=${__width:+,\"width\":$__width} __input+=${__height:+,\"height\":$__height} __input+=${__duration:+,\"duration\":$__duration} __input+=${__supports_streaming:+,\"supports_streaming\":$__supports_streaming} __input+=${__performer:+,\"performer\":\"$__performer\"} __input+=${__title:+,\"title\":\"$__title\"}} return $? } ShellBot.sendMediaGroup() { local chat_id media disable_notification reply_to_message_id jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:m:n:r:' \ --longoptions 'chat_id:, media:, disable_notification:, reply_to_message_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -m|--media) media=[$2] shift 2 ;; -n|--disable_notification) CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $media ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --media]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${media:+-F media="$media"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.editMessageMedia() { local chat_id message_id inline_message_id media reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:i:n:m:k:' \ --longoptions 'chat_id:, message_id:, inline_message_id:, media:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -i|--message_id) CheckArgType int "$1" "$2" message_id=$2 shift 2 ;; -n|--inline_message_id) CheckArgType int "$1" "$2" inline_message_id=$2 shift 2 ;; -m|--media) media=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $inline_message_id ]] || { [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $message_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-i, --message_id]" } [[ $media ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-m, --media]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${message_id:+-F message_id="$message_id"} \ ${inline_message_id:+-F inline_message_id="$inline_message_id"} \ ${media:+-F media="$media"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.sendAnimation() { local chat_id animation duration width height local thumb caption parse_mode disable_notification local reply_to_message_id reply_markup jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:a:d:w:h:b:o:p:n:r:k:' \ --longoptions 'chat_id:, animation:, duration:, width:, height:, thumb:, caption:, parse_mode:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2 shift 2 ;; -a|--animation) CheckArgType file "$1" "$2" animation=$2 shift 2 ;; -d|--duration) CheckArgType int "$1" "$2" duartion=$2 shift 2 ;; -w|--width) CheckArgType int "$1" "$2" width=$2 shift 2 ;; -h|--height) CheckArgType int "$1" "$2" height=$2 shift 2 ;; -b|--thumb) CheckArgType file "$1" "$2" thumb=$2 shift 2 ;; -o|--caption) caption=$(echo -e "$2") shift 2 ;; -p|--parse_mode) parse_mode=$2 shift 2 ;; -n|--disable_notification) CheckArgType bool "$1" "$2" disable_notification=$2 shift 2 ;; -r|--reply_to_message_id) CheckArgType int "$1" "$2" reply_to_message_id=$2 shift 2 ;; -k|--reply_markup) reply_markup=$2 shift 2 ;; --) shift break ;; esac done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $animation ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-a, --animation]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-F chat_id="$chat_id"} \ ${animation:+-F animation="$animation"} \ ${duration:+-F duration="$duration"} \ ${width:+-F width="$width"} \ ${height:+-F height="$height"} \ ${thumb:+-F thumb="$thumb"} \ ${caption:+-F caption="$caption"} \ ${parse_mode:+-F parse_mode="$parse_mode"} \ ${disable_notification:+-F disable_notification="$disable_notification"} \ ${reply_to_message_id:+-F reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-F reply_markup="$reply_markup"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.answerInlineQuery() { local inline_query_id results cache_time is_personal local next_offset switch_pm_text switch_pm_parameter local jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'i:r:c:p:o:s:m:' \ --longoptions 'inline_query_id:, results:, cache_time:, is_personal:, next_offset:, switch_pm_text:, switch_pm_parameter:' \ -- "$@") eval set -- "$param" while : do case $1 in -i|--inline_query_id) inline_query_id=$2; shift 2;; -r|--results) results=[$2]; shift 2;; -c|--cache_time) cache_time=$2; shift 2;; -p|--is_personal) cache_time=$2; shift 2;; -o|--next_offset) next_offset=$2; shift 2;; -s|--switch_pm_text) switch_pm_text=$2; shift 2;; -m|--switch_pm_parameter) switch_pm_parameter=$2; shift 2;; --) shift; break;; esac done [[ $inline_query_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-i, --inline_query_id]" [[ $results ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-r, --results]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${inline_query_id:+-F inline_query_id="$inline_query_id"} \ ${results:+-F results="$results"} \ ${cache_time:+-F cache_time="$cache_time"} \ ${is_personal:+-F is_personal="$is_personal"} \ ${next_offset:+-F next_offset="$next_offset"} \ ${switch_pm_text:+-F switch_pm_text="$switch_pm_text"} \ ${switch_pm_parameter:+-F switch_pm_parameter="$switch_pm_parameter"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.InlineQueryResult() { local __input __type __title __caption __reply_markup __parse_mode local __description __input_message_content __address __audio_duration local __audio_file_id __audio_url __document_file_id __document_url local __first_name __foursquare_id __foursquare_type __gif_duration local __gif_file_id __gif_height __gif_url __gif_width __hide_url local __last_name __latitude __live_period __longitude __mime_type local __mpeg4_duration __mpeg4_file_id __mpeg4_height __mpeg4_url local __mpeg4_width __performer __photo_file_id __photo_height local __photo_url __photo_width __sticker_file_id __vcard __phone_number local __thumb_height __thumb_url __thumb_width __url __id local __video_duration __video_file_id __video_height __video_url local __video_width __voice_duration __voice_file_id __voice_url local __param=$(getopt --name "$FUNCNAME" \ --options 'i:t:l:c:k:p:r:d:m:b:s:x:w:v:z:y:q:a:f:u:g:o:n:h:j:e: N:R:D:A:X:G:C:Q:L:Y:E:V:H:Z:T:F:U:M:S:O:I:K:B:P:J:W:' \ --longoptions 'input:, type:, title:, caption:, reply_markup:, parse_mode:, id:, description:, input_message_content:, address:, audio_duration:, audio_file_id:, audio_url:, document_file_id:, document_url:, first_name:, foursquare_id:, foursquare_type:, gif_duration:, gif_file_id:, gif_height:, gif_url:, gif_width:, hide_url:, last_name:, latitude:, live_period:, longitude:, mime_type:, mpeg4_duration:, mpeg4_file_id:, mpeg4_height:, mpeg4_url:, mpeg4_width:, performer:, photo_file_id:, photo_height:, photo_url:, photo_width:, sticker_file_id:, thumb_height:, thumb_url:, thumb_width:, url:, vcard:, video_duration:, video_file_id:, video_height:, video_url:, video_width:, voice_duration:, voice_file_id:, voice_url:, phone_number:' \ -- "$@") eval set -- "$__param" while : do case $1 in -i|--input) CheckArgType var "$1" "$2" __input=$2; shift 2;; -t|--type) __type=$2; shift 2;; -l|--title) __title=$2; shift 2;; -c|--caption) __caption=$2; shift 2;; -k|--reply_markup) __reply_markup=$2; shift 2;; -p|--parse_mode) __parse_mode=$2; shift 2;; -r|--id) __id=$2; shift 2;; -d|--description) __description=$2; shift 2;; -m|--input_message_content) __input_message_content=$2; shift 2;; -b|--address) __address=$2; shift 2;; -s|--audio_duration) __audio_duration=$2; shift 2;; -x|--audio_file_id) __audio_file_id=$2; shift 2;; -w|--audio_url) __audio_url=$2; shift 2;; -v|--document_file_id) __document_file_id=$2; shift 2;; -z|--document_url) __document_url=$2; shift 2;; -y|--first_name) __first_name=$2; shift 2;; -q|--foursquare_id) __foursquare_id=$2; shift 2;; -a|--foursquare_type) __foursquare_type=$2; shift 2;; -f|--gif_duration) __gif_duration=$2; shift 2;; -u|--gif_file_id) __gif_file_id=$2 shift 2;; -g|--gif_height) __gif_height=$2; shift 2;; -o|--gif_url) __gif_url=$2; shift 2;; -n|--gif_width) __gif_width=$2; shift 2;; -h|--hide_url) __hide_url=$2; shift 2;; -j|--last_name) __last_name=$2; shift 2;; -e|--latitude) __latitude=$2; shift 2;; -N|--live_period) __live_period=$2; shift 2;; -R|--longitude) __longitude=$2; shift 2;; -D|--mime_type) __mime_type=$2; shift 2;; -A|--mpeg4_duration) __mpeg4_duration=$2; shift 2;; -X|--mpeg4_file_id) __mpeg4_file_id=$2; shift 2;; -G|--mpeg4_height) __mpeg4_height=$2; shift 2;; -C|--mpeg4_url) __mpeg4_url=$2; shift 2;; -Q|--mpeg4_width) __mpeg4_width=$2; shift 2;; -L|--performer) __performer=$2; shift 2;; -Y|--photo_file_id) __photo_file_id=$2; shift 2;; -E|--photo_height) __photo_height=$2; shift 2;; -V|--photo_url) __photo_url=$2; shift 2;; -H|--photo_width) __photo_width=$2; shift 2;; -Z|--sticker_file_id) __sticker_file_id=$2; shift 2;; -T|--thumb_height) __thumb_height=$2; shift 2;; -F|--thumb_url) __thumb_url=$2; shift 2;; -U|--thumb_width) __thumb_width=$2; shift 2;; -M|--url) __url=$2; shift 2;; -S|--vcard) __vcard=$2; shift 2;; -O|--video_duration) __video_duration=$2; shift 2;; -I|--video_file_id) __video_file_id=$2; shift 2;; -K|--video_height) __video_height=$2; shift 2;; -B|--video_url) __video_url=$2; shift 2;; -P|--video_width) __video_width=$2; shift 2;; -J|--voice_duration) __voice_duration=$2; shift 2;; -W|--voice_file_id) __voice_file_id=$2; shift 2;; --phone_number) __phone_number=$2; shift 2;; --voice_url) __voice_url=$2; shift 2;; --) shift; break;; esac done [[ $__input ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-i, --input]" local -n __input=$__input __input=${__input:+$__input,}{\"type\":\"$__type\" __input+=${__title:+,\"title\":\"$__title\"} __input+=${__caption:+,\"caption\":\"$__caption\"} __input+=${__reply_markup:+,\"reply_markup\":\"$__reply_markup\"} __input+=${__parse_mode:+,\"parse_mode\":\"$__parse_mode\"} __input+=${__id:+,\"id\":\"$__id\"} __input+=${__description:+,\"description\":\"$__description\"} __input+=${__input_message_content:+,\"input_message_content\":$__input_message_content} __input+=${__address:+,\"address\":\"$__address\"} __input+=${__audio_duration:+,\"audio_duration\":$__audio_duration} __input+=${__audio_file_id:+,\"audio_file_id\":\"$__audio_file_id\"} __input+=${__audio_url:+,\"audio_url\":\"$__audio_url\"} __input+=${__document_file_id:+,\"document_file_id\":\"$__document_file_id\"} __input+=${__document_url:+,\"document_url\":\"$__document_url\"} __input+=${__first_name:+,\"first_name\":\"$__first_name\"} __input+=${__foursquare_id:+,\"foursquare_id\":\"$__foursquare_id\"} __input+=${__foursquare_type:+,\"foursquare_type\":\"$__foursquare_type\"} __input+=${__gif_duration:+,\"gif_duration\":$__gif_duration} __input+=${__gif_file_id:+,\"gif_file_id\":\"$__gif_file_id\"} __input+=${__gif_height:+,\"gif_height\":$__gif_height} __input+=${__gif_url:+,\"gif_url\":\"$__gif_url\"} __input+=${__gif_width:+,\"gif_width\":$__gif_width} __input+=${__hide_url:+,\"hide_url\":\"$__hide_url\"} __input+=${__last_name:+,\"last_name\":\"$__last_name\"} __input+=${__latitude:+,\"latitude\":$__latitude} __input+=${__live_period:+,\"live_period\":$__live_period} __input+=${__longitude:+,\"longitude\":$__longitude} __input+=${__mime_type:+,\"mime_type\":\"$__mime_type\"} __input+=${__mpeg4_duration:+,\"mpeg4_duration\":$__mpeg4_duration} __input+=${__mpeg4_file_id:+,\"mpeg4_file_id\":\"$__mpeg4_file_id\"} __input+=${__mpeg4_height:+,\"mpeg4_height\":$__mpeg4_height} __input+=${__mpeg4_url:+,\"mpeg4_url\":\"$__mpeg4_url\"} __input+=${__mpeg4_width:+,\"mpeg4_width\":$__mpeg4_width} __input+=${__performer:+,\"performer\":\"$__performer\"} __input+=${__photo_file_id:+,\"photo_file_id\":\"$__photo_file_id\"} __input+=${__photo_height:+,\"photo_height\":$__photo_height} __input+=${__photo_url:+,\"photo_url\":\"$__photo_url\"} __input+=${__photo_width:+,\"photo_width\":$__photo_width} __input+=${__sticker_file_id:+,\"sticker_file_id\":\"$__sticker_file_id\"} __input+=${__thumb_height:+,\"thumb_height\":$__thumb_height} __input+=${__thumb_url:+,\"thumb_url\":\"$__thumb_url\"} __input+=${__thumb_width:+,\"thumb_width\":$__thumb_width} __input+=${__url:+,\"url\":\"$__url\"} __input+=${__vcard:+,\"vcard\":\"$__vcard\"} __input+=${__video_duration:+,\"video_duration\":$__video_duration} __input+=${__video_file_id:+,\"video_file_id\":\"$__video_file_id\"} __input+=${__video_height:+,\"video_height\":$__video_height} __input+=${__video_url:+,\"video_url\":\"$__video_url\"} __input+=${__video_width:+,\"video_width\":$__video_width} __input+=${__voice_duration:+,\"voice_duration\":$__voice_duration} __input+=${__voice_file_id:+,\"voice_file_id\":\"$__voice_file_id\"} __input+=${__voice_url:+,\"voice_url\":\"$__voice_url\"} __input+=${__phone_number:+,\"phone_number\":\"$__phone_number\"}} return $? } ShellBot.InputMessageContent() { local message_text parse_mode disable_web_page_preview json local latitude longitude live_period title address foursquare_id local foursquare_type phone_number first_name last_name vcard local param=$(getopt --name "$FUNCNAME" \ --options 't:p:w:l:v:e:a:f:q:n:m:s:d:' \ --longoptions 'message_text:, parse_mode:, disable_web_page_preview:, latitude:, longitude:, live_period:, title:, address:, foursquare_id:, foursquare_type:, phone_number:, first_name:, last_name:, vcard:' \ -- "$@") eval set -- "$param" while : do case $1 in -t|--message_text) message_text=$(echo -e "$2"); shift 2;; -p|--parse_mode) parse_mode=$2; shift 2;; -w|--disable_web_page_preview) disable_web_page_preview=$2; shift 2;; -l|--latitude) latitude=$2; shift 2;; -g|--longitude) longitude=$2; shift 2;; -v|--live_period) live_period=$2; shift 2;; -e|--title) title=$2; shift 2;; -a|--address) address=$2; shift 2;; -f|--foursquare_id) foursquare_id=$2; shift 2;; -q|--foursquare_type) foursquare_type=$2; shift 2;; -n|--phone_number) phone_number=$2; shift 2;; -m|--first_name) first_name=$2; shift 2;; -s|--last_name) last_name=$2; shift 2;; -d|--vcard) vcard=$2; shift 2;; --) shift; break;; esac done json=${message_text:+\"message_text\":\"$message_text\"} json+=${parse_mode:+,\"parse_mode\":\"$parse_mode\"} json+=${disable_web_page_preview:+,\"disable_web_page_preview\":$disable_web_page_preview} json+=${latitude:+,\"latitude\":$latitude} json+=${longitude:+,\"longtitude\":$longitude} json+=${live_period:+,\"live_period\":$live_period} json+=${title:+,\"title\":\"$title\"} json+=${address:+,\"address\":\"$address\"} json+=${foursquare_id:+,\"foursquare_id\":\"$foursquare_id\"} json+=${foursquare_type:+,\"foursquare_type\":\"$foursquare_type\"} json+=${phone_number:+,\"phone_number\":\"$phone_number\"} json+=${first_name:+,\"first_name\":\"$first_name\"} json+=${last_name:+,\"last_name\":\"$last_name\"} json+=${vcard:+,\"vcard\":\"$vcard\"} echo "{${json#,}}" return $? } ShellBot.ChatPermissions() { local can_send_messages can_send_media_messages can_send_polls local can_send_other_messages can_add_web_page_previews json local can_change_info can_invite_users can_pin_messages local param=$(getopt --name "$FUNCNAME" \ --options 'm:d:l:o:w:c:i:p:' \ --longoptions 'can_send_messages:, can_send_media_messages:, can_send_polls:, can_send_other_messages:, can_add_web_page_previews:, can_change_info:, can_invite_users:, can_pin_messages:' \ -- "$@") eval set -- "$param" while : do case $1 in -m|--can_send_messages) can_send_messages=$2;; -d|--can_send_media_messages) can_send_media_messages=$2;; -l|--can_send_polls) can_send_polls=$2;; -o|--can_send_other_messages) can_send_other_messages=$2;; -w|--can_add_web_page_previews) can_add_web_page_previews=$2;; -c|--can_change_info) can_change_info=$2;; -i|--can_invite_users) can_invite_users=$2;; -p|--can_pin_messages) can_pin_messages=$2;; --) shift; break;; esac shift 2 done json=${can_send_messages:+\"can_send_messages\":$can_send_messages,} json+=${can_send_media_messages:+\"can_send_media_messages\":$can_send_media_messages,} json+=${can_send_polls:+\"can_send_polls\":$can_send_polls,} json+=${can_send_other_messages:+\"can_send_other_messages\":$can_send_other_messages,} json+=${can_add_web_page_previews:+\"can_add_web_page_previews\":$can_add_web_page_previews,} json+=${can_change_info:+\"can_change_info\":$can_change_info,} json+=${can_invite_users:+\"can_invite_users\":$can_invite_users,} json+=${can_pin_messages:+\"can_pin_messages\":$can_pin_messages,} # Retorna o objeto de permissões. echo "{${json%,}}" # Status return $? } ShellBot.setChatPermissions() { local chat_id permissions jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:p:' \ --longoptions 'chat_id:,permissions:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2;; -p|--permissions) permissions=$2;; --) shift; break;; esac shift 2 done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $permissions ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-p, --permissions]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${permissions:+-d permissions="$permissions"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.setChatAdministratorCustomTitle() { local chat_id user_id custom_title jq_obj local param=$(getopt --name "$FUNCNAME" \ --options 'c:u:t:' \ --longoptions 'chat_id:, user_id:, custom_title:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2;; -u|--user_id) user_id=$2;; -t|--custom_title) custom_title=$2;; --) shift; break;; esac shift 2 done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $user_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --user_id]" [[ $custom_title ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --custom_title]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${user_id:+-d user_id="$user_id"} \ ${custom_tilte:+-d custom_title="$custom_title"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.sendPoll() { local chat_id question options is_anonymous reply_markup local type allows_multiple_answers correct_option_id jq_obj local is_closed disable_notification reply_to_message_id local explanation explanation_parse_mode open_period close_date local param=$(getopt --name "$FUNCNAME" \ --options 'c:q:o:a:k:t:m:i:x:z:p:d:l:n:r:' \ --longoptions 'chat_id:, question:, options:, is_anonymous:, reply_markup:, type:, allows_multiple_answers:, correct_option_id:, explanation:, explanation_parse_mode:, open_period:, close_date:, is_closed:, disable_notification:, reply_to_message_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2;; -q|--question) question=$(echo -e "$2");; -o|--options) options=$(echo -e "$2");; -a|--is_anonymous) is_anonymous=$2;; -k|--reply_markup) reply_markup=$2;; -t|--type) type=$2;; -m|--allows_multiple_answers) allows_multiple_answers=$2;; -i|--correct_option_id) correct_option_id=$2;; -x|--explanation) explanation=$2;; -z|--explanation_parse_mode) explanation_parse_mode=$2;; -p|--open_period) open_period=$2;; -d|--close_date) close_date=$2;; -l|--is_closed) is_closed=$2;; -n|--disable_notification) disable_notification=$2;; -r|--reply_to_message_id) reply_to_message_id=$2;; --) shift; break;; esac shift 2 done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" [[ $question ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-q, --question]" [[ $options ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-o, --options]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${question:+-d question="$question"} \ ${options:+-d options="$options"} \ ${is_anonymous:+-d is_anonymous="$is_anonymous"} \ ${reply_markup:+-d reply_markup="$reply_markup"} \ ${type:+-d type="$type"} \ ${allows_multiple_answers:+-d allows_multiple_answers="$allows_multiple_answers"} \ ${correct_option_id:+-d correct_option_id="$correct_option_id"} \ ${explanation:+-d explanation="$explanation"} \ ${explanation_parse_mode:+-d explanation_parse_mode="$explanation_parse_mode"} \ ${open_period:+-d open_period="$open_period"} \ ${close_date:+-d close_date="$close_date"} \ ${is_closed:+-d is_closed="$is_closed"} \ ${disable_notification:+-d disable_notification="$disable_notification"} \ ${reply_to_message_id:+-d reply_to_message_id="$reply_to_message_id"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.KeyboardButtonPollType() { local type local param=$(getopt --name "$FUNCNAME" --options 't:' --longoptions 'type:' -- "$@") eval set -- "$param" while : do case $1 in -t|--type) type=$2;; --) shift; break;; esac shift 2 done [[ $type ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-t, --type]" printf '{"type": "%s"}' "$type" return 0 } ShellBot.sendDice() { local chat_id disable_notification reply_to_message_id local reply_markup jq_obj emoji local param=$(getopt --name "$FUNCNAME" \ --options 'c:e:n:r:k:' \ --longoptions 'chat_id:, emoji:, disable_notification:, reply_to_message_id:, reply_markup:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--chat_id) chat_id=$2;; -e|--emoji) emoji=$2;; -n|--disable_notification) disable_notification=$2;; -r|--reply_to_message_id) reply_to_message_id=$2;; -k|--reply_markup) reply_markup=$2;; --) shift; break;; esac shift 2 done [[ $chat_id ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --chat_id]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${chat_id:+-d chat_id="$chat_id"} \ ${emoji:+-d emoji="$emoji"} \ ${disable_notification:+-d disable_notification="$disable_notification"} \ ${reply_to_message_id:+-d reply_to_message_id="$reply_to_message_id"} \ ${reply_markup:+-d reply_markup="$reply_markup"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.getMyCommands() { local jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.}) MethodReturn "$jq_obj" || MessageError TG "$jq_obj" return $? } ShellBot.setMyCommands() { local jq_obj commands local param=$(getopt --name "$FUNCNAME" \ --options 'c:' \ --longoptions 'commands:' \ -- "$@") eval set -- "$param" while : do case $1 in -c|--commands) commands=$2;; --) break;; esac shift 2 done [[ $commands ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --commands]" jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} ${commands:+-d commands="$commands"}) # Retorno do método MethodReturn "$jq_obj" || MessageError TG "$jq_obj" # Status return $? } ShellBot.BotCommand() { local __command __description __list local __param=$(getopt --name "$FUNCNAME" \ --options 'l:c:d:' \ --longoptions 'list:, command:, description:' \ -- "$@") eval set -- "$__param" while : do case $1 in -l|--list) CheckArgType var "$1" "$2"; __list=$2;; -c|--command) __command=$2;; -d|--description) __description=$2;; --) break;; esac shift 2 done [[ $__list ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-l, --list]" [[ $__command ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-c, --command]" [[ $__description ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-d, --description]" printf -v $__list '%s' "${!__list#[}" printf -v $__list '%s' "${!__list%]}" printf -v $__list '%s{"command": "%s", "description": "%s"}' \ "${!__list:+${!__list},}" \ "$__command" \ "$__description" printf -v $__list '%s' "[${!__list}]" return $? } ShellBot.setMessageRules() { local action command user_id username chat_id local chat_type time date language message_id local is_bot text entities_type file_type name local query_data query_id query_text send_message local chat_member mime_type num_args exec rule local action_args weekday user_status chat_name local message_status reply_message parse_mode local forward_message reply_markup continue i local author_signature bot_action auth_file local param=$(getopt --name "$FUNCNAME" \ --options 's:a:z:c:i:u:h:v:y:l:m:b:t:n:f:p:q:r:g:o:e:d:w:j:x:R:S:F:K:P:E:A:C:B:T:' \ --longoptions 'name:, action:, action_args:, command:, user_id:, username:, chat_id:, chat_name:, chat_type:, language_code:, message_id:, is_bot:, text:, entitie_type:, file_type:, mime_type:, query_data:, query_id:, chat_member:, num_args:, time:, date:, weekday:, user_status:, message_status:, exec:, auth_file:, bot_reply_message:, bot_send_message:, bot_forward_message:, bot_reply_markup:, bot_parse_mode:, bot_action:, author_signature:, continue' \ -- "$@") eval set -- "$param" while : do case $1 in -s|--name) CheckArgType flag "$1" "$2" name=$2 shift 2 ;; -a|--action) CheckArgType func "$1" "$2" action=$2 shift 2 ;; -z|--action_args) action_args=$2 shift 2 ;; -c|--command) CheckArgType cmd "$1" "$2" command=$2 shift 2 ;; -i|--user_id) user_id=${user_id:+$user_id|}${2//[,$'\n']/|} shift 2 ;; -u|--username) username=${username:+$username|}${2//[,$'\n']/|} shift 2 ;; -h|--chat_id) chat_id=${chat_id:+$chat_id|}${2//[,$'\n']/|} shift 2 ;; -v|--chat_name) chat_name=${chat_name:+$chat_name|}${2//[,$'\n']/|} shift 2 ;; -y|--chat_type) chat_type=${chat_type:+$chat_type|}${2//[,$'\n']/|} shift 2 ;; -e|--time) time=${time:+$time|}${2//[,$'\n']/|} shift 2 ;; -d|--date) date=${date:+$date|}${2//[,$'\n']/|} shift 2 ;; -l|--laguage_code) language=${language:+$language|}${2//[,$'\n']/|} shift 2 ;; -m|--message_id) message_id=${message_id:+$message_id|}${2//[,$'\n']/|} shift 2 ;; -b|--is_bot) is_bot=${is_bot:+$is_bot|}${2//[,$'\n']/|} shift 2 ;; -t|--text) text=${2//$'\n'/|} shift 2 ;; -n|--entitie_type) entities_type=${entities_type:+$entities_type|}${2//[,$'\n']/|} shift 2 ;; -f|--file_type) file_type=${file_type:+$file_type|}${2//[,$'\n']/|} shift 2 ;; -p|--mime_type) mime_type=${mime_type:+$mime_type|}${2//[,$'\n']/|} shift 2 ;; -q|--query_data) query_data=${query_data:+$query_data|}${2//[,$'\n']/|} shift 2 ;; -r|--query_id) query_id=${query_id:+$query_id|}${2//[,$'\n']/|} shift 2 ;; -g|--chat_member) chat_member=${chat_member:+$chat_member|}${2//[,$'\n']/|} shift 2 ;; -o|--num_args) num_args=${num_args:+$num_args|}${2//[,$'\n']/|} shift 2 ;; -w|--weekday) weekday=${weekday:+$weekday|}${2//[,$'\n']/|} shift 2 ;; -j|--user_status) user_status=${user_status:+$user_status|}${2//[,$'\n']/|} shift 2 ;; -x|--message_status) message_status=${message_status:+$message_status|}${2//[,$'\n']/|} shift 2 ;; -T|--auth_file) auth_file=${auth_file:+$auth_file|}${2//[,$'\n']/|} shift 2 ;; -R|--bot_reply_message) reply_message=$2 shift 2 ;; -S|--bot_send_message) send_message=$2 shift 2 ;; -F|--bot_forward_message) forward_message=${forward_message:+$forward_message|}${2//[,$'\n']/|} shift 2 ;; -K|--bot_reply_markup) reply_markup=$2 shift 2 ;; -P|--bot_parse_mode) parse_mode=$2 shift 2 ;; -B|--bot_action) bot_action=$2 shift 2 ;; -E|--exec) exec=$2 shift 2 ;; -A|--author_signature) author_signature=${author_signature:+$author_signature|}${2//[,$'\n']/|} shift 2 ;; -C|--continue) continue=true shift ;; --) shift break ;; esac done [[ $name ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-s, --name]" [[ ${_BOT_RULES_[$name]} ]] && MessageError API "$_ERR_RULE_ALREADY_EXISTS_" "[-s, --name]" "$name" i=${_BOT_RULES_INDEX_:=0} _BOT_RULES_[$i:source]=${BASH_SOURCE[1]##*/} _BOT_RULES_[$i:line]=${BASH_LINENO} _BOT_RULES_[$i:name]=${name} _BOT_RULES_[$i:action]=${action} _BOT_RULES_[$i:action_args]=${action_args} _BOT_RULES_[$i:user_id]=${user_id} _BOT_RULES_[$i:username]=${username} _BOT_RULES_[$i:chat_id]=${chat_id} _BOT_RULES_[$i:chat_name]=${chat_name} _BOT_RULES_[$i:chat_type]=${chat_type} _BOT_RULES_[$i:language_code]=${language} _BOT_RULES_[$i:message_id]=${message_id} _BOT_RULES_[$i:is_bot]=${is_bot} _BOT_RULES_[$i:command]=${command} _BOT_RULES_[$i:text]=${text} _BOT_RULES_[$i:entities_type]=${entities_type} _BOT_RULES_[$i:file_type]=${file_type} _BOT_RULES_[$i:mime_type]=${mime_type} _BOT_RULES_[$i:query_data]=${query_data} _BOT_RULES_[$i:query_id]=${query_id} _BOT_RULES_[$i:chat_member]=${chat_member} _BOT_RULES_[$i:num_args]=${num_args} _BOT_RULES_[$i:time]=${time} _BOT_RULES_[$i:date]=${date} _BOT_RULES_[$i:weekday]=${weekday} _BOT_RULES_[$i:user_status]=${user_status} _BOT_RULES_[$i:message_status]=${message_status} _BOT_RULES_[$i:author_signature]=${author_signature} _BOT_RULES_[$i:auth_file]=${auth_file} _BOT_RULES_[$i:bot_reply_message]=${reply_message} _BOT_RULES_[$i:bot_send_message]=${send_message} _BOT_RULES_[$i:bot_forward_message]=${forward_message} _BOT_RULES_[$i:bot_reply_markup]=${reply_markup} _BOT_RULES_[$i:bot_parse_mode]=${parse_mode} _BOT_RULES_[$i:bot_action]=${bot_action} _BOT_RULES_[$i:exec]=${exec} _BOT_RULES_[$i:continue]=${continue} _BOT_RULES_[$name]=true # Incrementa índice. ((_BOT_RULES_INDEX_++)) return $? } ShellBot.manageRules() { local uid rule botcmd err tm stime etime ctime mime_type weekday local dt sdate edate cdate mem ent type args status out fwid local stdout i re match file user line local u_message_text u_message_id u_message_from_is_bot local u_message_from_id u_message_from_username msgstatus argpos local u_message_from_language_code u_message_chat_id message_status local u_message_chat_type u_message_date u_message_entities_type local u_message_mime_type u_message_author_signature local param=$(getopt --name "$FUNCNAME" \ --options 'u:' \ --longoptions 'update_id:' \ -- "$@") eval set -- "$param" while : do case $1 in -u|--update_id) CheckArgType int "$1" "$2" uid=$2 shift 2 ;; --) shift break ;; esac done [[ $uid ]] || MessageError API "$_ERR_PARAM_REQUIRED_" "[-u, --update_id]" # Regras (somente-leitura) readonly _BOT_RULES_ _BOT_RULES_INDEX_ [[ ${u_message_text:=${message_text[$uid]}} ]] || [[ ${u_message_text:=${edited_message_text[$uid]}} ]] || [[ ${u_message_text:=${callback_query_message_text[$uid]}} ]] || [[ ${u_message_text:=${inline_query_query[$uid]}} ]] || [[ ${u_message_text:=${chosen_inline_result_query[$uid]}} ]] || [[ ${u_message_text:=${channel_post_text[$uid]}} ]] || [[ ${u_message_text:=${edited_channel_post_text[$uid]}} ]] [[ ${u_message_id:=${message_message_id[$uid]}} ]] || [[ ${u_message_id:=${edited_message_message_id[$uid]}} ]] || [[ ${u_message_id:=${callback_query_message_message_id[$uid]}} ]] || [[ ${u_message_id:=${inline_query_id[$uid]}} ]] || [[ ${u_message_id:=${chosen_inline_result_result_id[$uid]}} ]] || [[ ${u_message_id:=${channel_post_message_id[$uid]}} ]] || [[ ${u_message_id:=${edited_channel_post_message_id[$uid]}} ]] || [[ ${u_message_id:=${poll_answer_poll_id[$uid]}} ]] [[ ${u_message_from_is_bot:=${message_from_is_bot[$uid]}} ]] || [[ ${u_message_from_is_bot:=${edited_message_from_is_bot[$uid]}} ]] || [[ ${u_message_from_is_bot:=${callback_query_from_is_bot[$uid]}} ]] || [[ ${u_message_from_is_bot:=${inline_query_from_is_bot[$uid]}} ]] || [[ ${u_message_from_is_bot:=${chosen_inline_result_from_is_bot[$uid]}} ]] || [[ ${u_message_from_is_bot:=${poll_answer_user_is_bot[$uid]}} ]] [[ ${u_message_from_id:=${message_from_id[$uid]}} ]] || [[ ${u_message_from_id:=${edited_message_from_id[$uid]}} ]] || [[ ${u_message_from_id:=${callback_query_from_id[$uid]}} ]] || [[ ${u_message_from_id:=${inline_query_from_id[$uid]}} ]] || [[ ${u_message_from_id:=${chosen_inline_result_from_id[$uid]}} ]] || [[ ${u_message_from_id:=${poll_answer_user_id[$uid]}} ]] [[ ${u_message_from_username:=${message_from_username[$uid]}} ]] || [[ ${u_message_from_username:=${edited_message_from_username[$uid]}} ]] || [[ ${u_message_from_username:=${callback_query_from_username[$uid]}} ]] || [[ ${u_message_from_username:=${inline_query_from_username[$uid]}} ]] || [[ ${u_message_from_username:=${chosen_inline_result_from_username[$uid]}} ]] || [[ ${u_message_from_username:=${poll_answer_user_username[$uid]}} ]] [[ ${u_message_from_language_code:=${message_from_language_code[$uid]}} ]] || [[ ${u_message_from_language_code:=${edited_message_from_language_code[$uid]}} ]] || [[ ${u_message_from_language_code:=${callback_query_from_language_code[$uid]}} ]] || [[ ${u_message_from_language_code:=${inline_query_from_language_code[$uid]}} ]] || [[ ${u_message_from_language_code:=${chosen_inline_result_from_language_code[$uid]}} ]] [[ ${u_message_chat_id:=${message_chat_id[$uid]}} ]] || [[ ${u_message_chat_id:=${edited_message_chat_id[$uid]}} ]] || [[ ${u_message_chat_id:=${callback_query_message_chat_id[$uid]}} ]] || [[ ${u_message_chat_id:=${channel_post_chat_id[$uid]}} ]] || [[ ${u_message_chat_id:=${edited_channel_post_chat_id[$uid]}} ]] [[ ${u_message_chat_username:=${message_chat_username[$uid]}} ]] || [[ ${u_message_chat_username:=${edited_message_chat_username[$uid]}} ]] || [[ ${u_message_chat_username:=${callback_query_message_chat_username[$uid]}} ]] [[ ${u_message_chat_type:=${message_chat_type[$uid]}} ]] || [[ ${u_message_chat_type:=${edited_message_chat_type[$uid]}} ]] || [[ ${u_message_chat_type:=${callback_query_message_chat_type[$uid]}} ]] || [[ ${u_message_chat_type:=${channel_post_chat_type[$uid]}} ]] || [[ ${u_message_chat_type:=${edited_channel_post_chat_type[$uid]}} ]] [[ ${u_message_date:=${message_date[$uid]}} ]] || [[ ${u_message_date:=${edited_message_edit_date[$uid]}} ]] || [[ ${u_message_date:=${callback_query_message_date[$uid]}} ]] || [[ ${u_message_date:=${channel_post_date[$uid]}} ]] || [[ ${u_message_date:=${edited_channel_post_date[$uid]}} ]] [[ ${u_message_entities_type:=${message_entities_type[$uid]}} ]] || [[ ${u_message_entities_type:=${edited_message_entities_type[$uid]}} ]] || [[ ${u_message_entities_type:=${callback_query_message_entities_type[$uid]}} ]] || [[ ${u_message_entities_type:=${channel_post_entities_type[$uid]}} ]] || [[ ${u_message_entities_type:=${edited_channel_post_entities_type[$uid]}} ]] [[ ${u_message_mime_type:=${message_document_mime_type[$uid]}} ]] || [[ ${u_message_mime_type:=${message_video_mime_type[$uid]}} ]] || [[ ${u_message_mime_type:=${message_audio_mime_type[$uid]}} ]] || [[ ${u_message_mime_type:=${message_voice_mime_type[$uid]}} ]] || [[ ${u_message_mime_type:=${channel_post_document_mime_type[$uid]}} ]] [[ ${u_message_author_signature:=${channel_post_author_signature[$uid]}} ]] || [[ ${u_message_author_signature:=${edited_channel_post_author_signature[$uid]}} ]] # Regras for ((i=0; i < _BOT_RULES_INDEX_; i++)); do IFS=' ' read -ra args <<< $u_message_text [[ ! ${_BOT_RULES_[$i:num_args]} || ${#args[@]} == @(${_BOT_RULES_[$i:num_args]}) ]] && [[ ! ${_BOT_RULES_[$i:command]} || ${u_message_text%% *} == @(${_BOT_RULES_[$i:command]})?(@${_BOT_INFO_[3]}) ]] && [[ ! ${_BOT_RULES_[$i:message_id]} || $u_message_id == @(${_BOT_RULES_[$i:message_id]}) ]] && [[ ! ${_BOT_RULES_[$i:is_bot]} || $u_message_from_is_bot == @(${_BOT_RULES_[$i:is_bot]}) ]] && [[ ! ${_BOT_RULES_[$i:user_id]} || $u_message_from_id == @(${_BOT_RULES_[$i:user_id]}) ]] && [[ ! ${_BOT_RULES_[$i:username]} || $u_message_from_username == @(${_BOT_RULES_[$i:username]}) ]] && [[ ! ${_BOT_RULES_[$i:language]} || $u_message_from_language_code == @(${_BOT_RULES_[$i:language]}) ]] && [[ ! ${_BOT_RULES_[$i:chat_id]} || $u_message_chat_id == @(${_BOT_RULES_[$i:chat_id]}) ]] && [[ ! ${_BOT_RULES_[$i:chat_name]} || $u_message_chat_username == @(${_BOT_RULES_[$i:chat_name]}) ]] && [[ ! ${_BOT_RULES_[$i:chat_type]} || $u_message_chat_type == @(${_BOT_RULES_[$i:chat_type]}) ]] && [[ ! ${_BOT_RULES_[$i:author_signature]} || $u_message_author_signature == @(${_BOT_RULES_[$i:author_signature]}) ]] && [[ ! ${_BOT_RULES_[$i:mime_type]} || $u_message_mime_type == @(${_BOT_RULES_[$i:mime_type]}) ]] && [[ ! ${_BOT_RULES_[$i:query_id]} || ${callback_query_id[$uid]} == @(${_BOT_RULES_[$i:query_id]}) ]] && [[ ! ${_BOT_RULES_[$i:query_data]} || ${callback_query_data[$uid]} == @(${_BOT_RULES_[$i:query_data]}) ]] && [[ ! ${_BOT_RULES_[$i:weekday]} || $(printf '%(%u)T' $u_message_date) == @(${_BOT_RULES_[$i:weekday]}) ]] && [[ ! ${_BOT_RULES_[$i:text]} || $u_message_text =~ ${_BOT_RULES_[$i:text]} ]] || continue # Extrai os arquivos do conjunto negado. Caso esteja ausente # define a expressão padrão. # Captura os grupos contidos no padrão, separando o # operador de negação '!' (se presente) para determinar o # tratamento de valição do intervalo. # # Exemplo 1: # # BASH_REMATCH[2] # __________|__________ # | | # !(12:00-13:00,15:00-17:00) # | # |_ BASH_REMATCH[1] # re='^(!)\(([^)]+)\)$' [[ ${_BOT_RULES_[$i:auth_file]} =~ $re ]] match=${BASH_REMATCH[2]:-${_BOT_RULES_[$i:auth_file]}} for file in ${match//|/ }; do # Testa acesso ao arquivo. if ! [[ -f "$file" && -r "$file" ]]; then MessageError API "'$file' $_ERR_FILE_NOT_FOUND_" "${_BOT_RULES_[$i:name]}" '[-T, --auth_file]' fi # Lê os usuários removendo os comentários complementares # e ignora a linha prefixada com hashtag '#'. while read -r line; do user=${line%%*( )#*} [[ $user != *( )#* ]] && [[ $user == $u_message_from_id || $user == $u_message_from_username ]] && break 2 done < "$file" done ((${BASH_REMATCH[1]} $?)) && continue for msgstatus in ${_BOT_RULES_[$i:message_status]//|/ }; do [[ $msgstatus == pinned && ${message_pinned_message_message_id[$uid]:-${channel_post_pinned_message_message_id[$uid]}} ]] || [[ $msgstatus == edited && ${edited_message_message_id[$uid]:-${edited_channel_post_message_id[$uid]}} ]] || [[ $msgstatus == forwarded && ${message_forward_from_id[$uid]:-${channel_post_forward_from_chat_id[$uid]}} ]] || [[ $msgstatus == reply && ${message_reply_to_message_message_id[$uid]:-${channel_post_reply_to_message_message_id[$uid]}} ]] || [[ $msgstatus == callback && ${callback_query_message_message_id[$uid]} ]] || [[ $msgstatus == inline && ${inline_query_id[$uid]} ]] || [[ $msgstatus == chosen && ${chosen_inline_result_result_id[$uid]} ]] || [[ $msgstatus == poll && ${poll_answer_poll_id[$uid]} ]] && break done (($?)) && continue for ent in ${_BOT_RULES_[$i:entities_type]//|/ }; do [[ $ent == @(${u_message_entities_type//$_BOT_DELM_/|}) ]] && break done (($?)) && continue for mem in ${_BOT_RULES_[$i:chat_member]//|/ }; do [[ $mem == new && ${message_new_chat_member_id[$uid]} ]] || [[ $mem == left && ${message_left_chat_member_id[$uid]} ]] && break done (($?)) && continue for type in ${_BOT_RULES_[$i:file_type]//|/ }; do [[ $type == document && ${message_document_file_id[$uid]:-${channel_post_document_file_id[$uid]}} && ! ${message_document_thumb_file_id[$uid]:-${channel_post_document_thumb_file_id[$uid]}} ]] || [[ $type == gif && ${message_document_file_id[$uid]:-${channel_post_document_file_id[$uid]}} && ${message_document_thumb_file_id[$uid]:-${channel_post_document_thumb_file_id[$uid]}} ]] || [[ $type == photo && ${message_photo_file_id[$uid]:-${channel_post_photo_file_id[$uid]}} ]] || [[ $type == sticker && ${message_sticker_file_id[$uid]:-${channel_post_sticker_file_id[$uid]}} ]] || [[ $type == video && ${message_video_file_id[$uid]:-${channel_post_video_file_id[$uid]}} ]] || [[ $type == audio && ${message_audio_file_id[$uid]:-${channel_post_audio_file_id[$uid]}} ]] || [[ $type == voice && ${message_voice_file_id[$uid]:-${channel_post_voice_file_id[$uid]}} ]] || [[ $type == contact && ${message_contact_user_id[$uid]:-${channel_post_contact_user_id[$uid]}} ]] || [[ $type == location && ${message_location_latitude[$uid]:-${channel_post_location_latitude[$uid]}} ]] && break done (($?)) && continue [[ ${_BOT_RULES_[$i:time]} =~ $re ]] match=${BASH_REMATCH[2]:-${_BOT_RULES_[$i:time]}} for tm in ${match//|/ }; do IFS='-' read stime etime <<< $tm printf -v ctime '%(%H:%M)T' $u_message_date [[ $ctime == @($stime|$etime) ]] || [[ $ctime > $stime && $ctime < $etime ]] && break done ((${BASH_REMATCH[1]} $?)) && continue [[ ${_BOT_RULES_[$i:date]} =~ $re ]] match=${BASH_REMATCH[2]:-${_BOT_RULES_[$i:date]}} for dt in ${match//|/ }; do IFS='-' read sdate edate <<< $dt IFS='/' read -a sdate <<< $sdate IFS='/' read -a edate <<< $edate sdate=${sdate[2]}/${sdate[1]}/${sdate[0]} edate=${edate[2]}/${edate[1]}/${edate[0]} printf -v cdate '%(%Y/%m/%d)T' $u_message_date [[ $cdate == @($sdate|$edate) ]] || [[ $cdate > $sdate && $cdate < $edate ]] && break done ((${BASH_REMATCH[1]} $?)) && continue if [[ ${_BOT_RULES_[$i:user_status]} ]]; then case $_BOT_TYPE_RETURN_ in value) out=$(ShellBot.getChatMember --chat_id $u_message_chat_id \ --user_id $u_message_from_id 2>/dev/null) IFS=$_BOT_DELM_ read -a out <<< $out [[ ${out[2]} == true ]] status=${out[$(($? ? 6 : 5))]} ;; json) out=$(ShellBot.getChatMember --chat_id $u_message_chat_id \ --user_id $u_message_from_id 2>/dev/null) status=$(Json '.result.status' $out) ;; map) ShellBot.getChatMember --chat_id $u_message_chat_id \ --user_id $u_message_from_id &>/dev/null status=${return[status]} ;; esac [[ $status == @(${_BOT_RULES_[$i:user_status]}) ]] || continue fi # Monitor [[ $_BOT_MONITOR_ ]] && printf '[%s]: %s: %s: %s: %s: %s: %s: %s: %s: %s: %s\n' \ "${FUNCNAME}" \ "$((uid+1))" \ "$(printf '%(%d/%m/%Y %H:%M:%S)T' ${u_message_date})" \ "${u_message_chat_type}" \ "${u_message_chat_username:--}" \ "${u_message_from_username:--}" \ "${_BOT_RULES_[$i:source]}" \ "${_BOT_RULES_[$i:line]}" \ "${_BOT_RULES_[$i:name]}" \ "${_BOT_RULES_[$i:action]:--}" \ "${_BOT_RULES_[$i:exec]:--}" # Log [[ $_BOT_LOG_FILE_ ]] && printf '%s: %s: %s: %s: %s: %s: %s\n' \ "$(printf '%(%d/%m/%Y %H:%M:%S)T')" \ "${FUNCNAME}" \ "${_BOT_RULES_[$i:source]}" \ "${_BOT_RULES_[$i:line]}" \ "${_BOT_RULES_[$i:name]}" \ "${_BOT_RULES_[$i:action]:--}" \ "${_BOT_RULES_[$i:exec]:--}" >> "$_BOT_LOG_FILE_" # Anexa tipo da ação. (se presente) if [[ ${_BOT_RULES_[$i:bot_action]} ]]; then ShellBot.sendChatAction --chat_id $u_message_chat_id --action ${_BOT_RULES_[$i:bot_action]} &>/dev/null fi if [[ ${_BOT_RULES_[$i:bot_reply_message]} ]]; then ShellBot.sendMessage --chat_id $u_message_chat_id \ --reply_to_message_id $u_message_id \ --text "$(FlagConv $uid "${_BOT_RULES_[$i:bot_reply_message]}")" \ ${_BOT_RULES_[$i:bot_reply_markup]:+--reply_markup "${_BOT_RULES_[$i:bot_reply_markup]}"} \ ${_BOT_RULES_[$i:bot_parse_mode]:+--parse_mode ${_BOT_RULES_[$i:bot_parse_mode]}} &>/dev/null fi if [[ ${_BOT_RULES_[$i:bot_send_message]} ]]; then ShellBot.sendMessage --chat_id $u_message_chat_id \ --text "$(FlagConv $uid "${_BOT_RULES_[$i:bot_send_message]}")" \ ${_BOT_RULES_[$i:bot_reply_markup]:+--reply_markup "${_BOT_RULES_[$i:bot_reply_markup]}"} \ ${_BOT_RULES_[$i:bot_parse_mode]:+--parse_mode ${_BOT_RULES_[$i:bot_parse_mode]}} &>/dev/null fi for fwid in ${_BOT_RULES_[$i:bot_forward_message]//|/ }; do ShellBot.forwardMessage --chat_id $fwid \ --from_chat_id $u_message_chat_id \ --message_id $u_message_id &>/dev/null done # Chama a função passando os argumentos posicionais. (se existir) ${_BOT_RULES_[$i:action]:+${_BOT_RULES_[$i:action]} ${_BOT_RULES_[$i:action_args]:-${args[*]}}} # Executa a linha de comando e salva o retorno. stdout=${_BOT_RULES_[$i:exec]:+$(set -- ${args[*]}; eval $(FlagConv $uid "${_BOT_RULES_[$i:exec]}") 2>&1)} while [[ $stdout ]]; do ShellBot.sendMessage --chat_id $u_message_chat_id \ --reply_to_message_id $u_message_id \ --text "${stdout:0:4096}" &>/dev/null # Atualiza o buffer de saída. stdout=${stdout:4096} # Reenvia ação se ainda houver dados. if [[ ${_BOT_RULES_[$i:bot_action]} && $stdout ]]; then ShellBot.sendChatAction --chat_id $u_message_chat_id --action ${_BOT_RULES_[$i:bot_action]} &>/dev/null fi done [[ ${_BOT_RULES_[$i:continue]} ]] || return 0 done return 1 } ShellBot.getUpdates() { local total_keys offset limit timeout allowed_updates jq_obj local vet val var obj oldv bar vars vals i # Define os parâmetros da função local param=$(getopt --name "$FUNCNAME" \ --options 'o:l:t:a:' \ --longoptions 'offset:, limit:, timeout:, allowed_updates:' \ -- "$@") eval set -- "$param" while : do case $1 in -o|--offset) CheckArgType int "$1" "$2" offset=$2 shift 2 ;; -l|--limit) CheckArgType int "$1" "$2" limit=$2 shift 2 ;; -t|--timeout) CheckArgType int "$1" "$2" timeout=$2 shift 2 ;; -a|--allowed_updates) allowed_updates=$2 shift 2 ;; --) # Se não houver mais parâmetros shift break ;; esac done # Seta os parâmetros jq_obj=$(curl $_CURL_OPT_ POST $_API_TELEGRAM_/${FUNCNAME#*.} \ ${offset:+-d offset="$offset"} \ ${limit:+-d limit="$limit"} \ ${timeout:+-d timeout="$timeout"} \ ${allowed_updates:+-d allowed_updates="$allowed_updates"}) # Limpa as variáveis inicializadas. unset $_VAR_INIT_; _VAR_INIT_= # Se há atualizações. [[ $(jq -r '.result|length' <<< $jq_obj) -eq 0 ]] && return 0 # Se o método 'ShellBot.getUpdates' for invocado a partir de um subshell, # as atualizações são retornadas em um estrutura de dados json, o método # é finalizado e variáveis não são inicializadas. [[ $BASH_SUBSHELL -gt 0 ]] && { echo "$jq_obj"; return 0; } if [[ $_BOT_MONITOR_ ]]; then printf -v bar '=%.s' {1..50} printf "$bar\nData: %(%d/%m/%Y %T)T\n" printf 'Script: %s\nBot (nome): %s\nBot (usuario): %s\nBot (id): %s\n' \ "${_BOT_SCRIPT_}" \ "${_BOT_INFO_[2]}" \ "${_BOT_INFO_[3]}" \ "${_BOT_INFO_[1]}" fi mapfile -t vars <<< $(GetAllKeys "$jq_obj") mapfile -t vals <<< $(GetAllValues "$jq_obj") for i in ${!vars[@]}; do [[ ${vars[$i]} =~ [0-9]+ ]] vet=${BASH_REMATCH:-0} var=${vars[$i]//[0-9\[\]]/} var=${var#result.} var=${var//./_} declare -g $var local -n byref=$var # ponteiro val=${vals[$i]} val=${val#\"} val=${val%\"} byref[$vet]+=${byref[$vet]:+$_BOT_DELM_}${val} if [[ $_BOT_MONITOR_ ]]; then [[ $vet -ne ${oldv:--1} ]] && printf "$bar\nMensagem: %d\n$bar\n" $((vet+1)) printf "[%s]: %s = '%s'\n" "$FUNCNAME" "$var" "$val" oldv=$vet fi unset -n byref [[ $var != @(${_VAR_INIT_// /|}) ]] && _VAR_INIT_=${_VAR_INIT_:+$_VAR_INIT_ }${var} done # Log (thread) [[ $_BOT_LOG_FILE_ ]] && CreateLog "${#update_id[@]}" "$jq_obj" # Status return $? } # Bot métodos (somente leitura) readonly -f ShellBot.token \ ShellBot.id \ ShellBot.username \ ShellBot.first_name \ ShellBot.getConfig \ ShellBot.regHandleFunction \ ShellBot.regHandleExec \ ShellBot.watchHandle \ ShellBot.ListUpdates \ ShellBot.TotalUpdates \ ShellBot.OffsetEnd \ ShellBot.OffsetNext \ ShellBot.getMe \ ShellBot.getWebhookInfo \ ShellBot.deleteWebhook \ ShellBot.setWebhook \ ShellBot.init \ ShellBot.ReplyKeyboardMarkup \ ShellBot.ForceReply \ ShellBot.ReplyKeyboardRemove \ ShellBot.KeyboardButton \ ShellBot.sendMessage \ ShellBot.forwardMessage \ ShellBot.sendPhoto \ ShellBot.sendAudio \ ShellBot.sendDocument \ ShellBot.sendSticker \ ShellBot.sendVideo \ ShellBot.sendVideoNote \ ShellBot.sendVoice \ ShellBot.sendLocation \ ShellBot.sendVenue \ ShellBot.sendContact \ ShellBot.sendChatAction \ ShellBot.getUserProfilePhotos \ ShellBot.getFile \ ShellBot.kickChatMember \ ShellBot.leaveChat \ ShellBot.unbanChatMember \ ShellBot.getChat \ ShellBot.getChatAdministrators \ ShellBot.getChatMembersCount \ ShellBot.getChatMember \ ShellBot.editMessageText \ ShellBot.editMessageCaption \ ShellBot.editMessageReplyMarkup \ ShellBot.InlineKeyboardMarkup \ ShellBot.InlineKeyboardButton \ ShellBot.answerCallbackQuery \ ShellBot.deleteMessage \ ShellBot.exportChatInviteLink \ ShellBot.setChatPhoto \ ShellBot.deleteChatPhoto \ ShellBot.setChatTitle \ ShellBot.setChatDescription \ ShellBot.pinChatMessage \ ShellBot.unpinChatMessage \ ShellBot.promoteChatMember \ ShellBot.restrictChatMember \ ShellBot.getStickerSet \ ShellBot.uploadStickerFile \ ShellBot.createNewStickerSet \ ShellBot.addStickerToSet \ ShellBot.setStickerPositionInSet \ ShellBot.deleteStickerFromSet \ ShellBot.stickerMaskPosition \ ShellBot.downloadFile \ ShellBot.editMessageLiveLocation \ ShellBot.stopMessageLiveLocation \ ShellBot.setChatStickerSet \ ShellBot.deleteChatStickerSet \ ShellBot.sendMediaGroup \ ShellBot.editMessageMedia \ ShellBot.inputMedia \ ShellBot.sendAnimation \ ShellBot.answerInlineQuery \ ShellBot.InlineQueryResult \ ShellBot.InputMessageContent \ ShellBot.ChatPermissions \ ShellBot.setChatPermissions \ ShellBot.setChatAdministratorCustomTitle \ ShellBot.sendPoll \ ShellBot.KeyboardButtonPollType \ ShellBot.sendDice \ ShellBot.getMyCommands \ ShellBot.setMyCommands \ ShellBot.BotCommand \ ShellBot.setMessageRules \ ShellBot.manageRules \ ShellBot.getUpdates offset=${_BOT_FLUSH_:+$(FlushOffset)} # flush printf -v jq_obj '{"token":"%s","id":%d,"first_name":"%s","username":"%s","offset_start":%d,"offset_end":%d}' \ "${_BOT_INFO_[0]}" \ "${_BOT_INFO_[1]}" \ "${_BOT_INFO_[2]}" \ "${_BOT_INFO_[3]}" \ "${offset%|*}" \ "${offset#*|}" # Retorna informações do bot. MethodReturn "$jq_obj" return $? } # Funções (somente leitura) readonly -f MessageError \ Json \ FlushOffset \ CreateUnitService \ GetAllKeys \ GetAllValues \ SetDelmValues \ MethodReturn \ CheckArgType \ CreateLog \ FlagConv # /* SHELLBOT */ ================================================ FILE: Install/Url ================================================ ________________________ Resource Locator: https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/hehe https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/versao https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Modulos/$_arq https://raw.githubusercontent.com/shellscriptx/shellbot/master/ShellBot.sh https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 https://raw.githubusercontent.com/fabricio94b/SQUID3/main/squid3 https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/stunnel.pem https://github.com/OpenVPN/easy-rsa/releases/download/3.0.1/EasyRSA-3.0.1.tgz https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/sshd_config __________________ IP locator: ipv4.icanhazip.com http://whatismyip.akamai.com/ ================================================ FILE: Install/instsqd ================================================ clear op=$1 [[ ! -d /usr/share/.plus ]] && exit 0 fun_sqd01() { [[ -e /etc/apt/sources.list.d/trusty_sources.list ]] && { rm /etc/apt/sources.list.d/trusty_sources.list >/dev/null 2>&1 [[ $(grep -wc 'Debian' /etc/issue.net) != '0' ]] && { apt-key del 3B4FE6ACC0B21F32 >/dev/null 2>&1 } apt remove squid3=3.3.8-1ubuntu6 squid=3.3.8-1ubuntu6 squid3-common=3.3.8-1ubuntu6 -y >/dev/null 2>&1 apt update -y >/dev/null 2>&1 apt autoremove -y >/dev/null 2>&1 } apt install squid3 -y >/dev/null 2>&1 } fun_sqd02() { [[ ! -e /etc/apt/sources.list.d/trusty_sources.list ]] && { touch /etc/apt/sources.list.d/trusty_sources.list >/dev/null 2>&1 echo "deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe" | tee --append /etc/apt/sources.list.d/trusty_sources.list >/dev/null 2>&1 } [[ $(grep -wc 'Debian' /etc/issue.net) != '0' ]] && { apt install dirmngr -y >/dev/null 2>&1 [[ $(apt-key list 2>/dev/null | grep -c 'Ubuntu') == '0' ]] && { apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 >/dev/null 2>&1 } } apt update -y >/dev/null 2>&1 apt install squid3=3.3.8-1ubuntu6 squid=3.3.8-1ubuntu6 squid3-common=3.3.8-1ubuntu6 -y >/dev/null 2>&1 wget -qO- https://raw.githubusercontent.com/fabricio94b/SQUID3/main/squid3 >/etc/init.d/squid3 chmod +x /etc/init.d/squid3 >/dev/null 2>&1 update-rc.d squid3 defaults >/dev/null 2>&1 } [[ $op == '1' ]] && { fun_sqd02 } || { fun_sqd01 } ================================================ FILE: Install/list ================================================ #!/bin/bash _lvk=$(wget -qO- https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Sistema/versao) IP=$(wget -qO- ipv4.icanhazip.com) IP2=$(wget -qO- http://whatismyip.akamai.com/) [[ "$IP" != "$IP2" ]] && ipdovps="$IP2" || ipdovps="$IP" echo -e "$ipdovps" >/etc/IP lst=$1 && lst1=$2 && lst2=$3 && key1=$4 && key2=crz echo -e "America/Sao_Paulo" >/etc/timezone ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime >/dev/null 2>&1 dpkg-reconfigure --frontend noninteractive tzdata >/dev/null 2>&1 [[ -z $lst1 ]] && { rm -rf $_Ink/list >/dev/null 2>&1 && cat /dev/null >~/.bash_history && history -c && exit 0 } [[ ! -d /etc/VPSManager ]] && mkdir /etc/VPSManager [[ ! -d /etc/VPSManager/senha ]] && mkdir /etc/VPSManager/senha [[ ! -e /etc/VPSManager/Exp ]] && touch /etc/VPSManager/Exp [[ ! -d /etc/VPSManager/userteste ]] && mkdir /etc/VPSManager/userteste [[ ! -d /etc/VPSManager/.tmp ]] && mkdir /etc/VPSManager/.tmp [[ ! -d /etc/bot ]] && mkdir /etc/bot [[ ! -d /etc/bot/info-users ]] && mkdir /etc/bot/info-users [[ ! -d /etc/bot/arquivos ]] && mkdir /etc/bot/arquivos [[ ! -d /etc/bot/revenda ]] && mkdir /etc/bot/revenda [[ ! -d /etc/bot/suspensos ]] && mkdir /etc/bot/suspensos [[ ! -e /etc/bot/lista_ativos ]] && touch /etc/bot/lista_ativos [[ ! -e /etc/bot/lista_suspensos ]] && touch /etc/bot/lista_suspensos echo -e 'by: @DRAGON_VPS_MANAGER' >/usr/lib/vpsmanager && cat /usr/lib/vpsmanager >$lst2/licence && cat /usr/lib/vpsmanager > /etc/VPSManager/.tmp/vps netstat -nplt | grep -w 'apache2' | grep -w '80' && sed -i "s/Listen 80/Listen 8888/g" /etc/apache2/ports.conf && service apache2 restart [[ "$(grep -o '#Port 22' /etc/ssh/sshd_config)" == "#Port 22" ]] && sed -i "s;#Port 22;Port 22;" /etc/ssh/sshd_config && service ssh restart grep -v "^PasswordAuthentication" /etc/ssh/sshd_config >/tmp/passlogin && mv /tmp/passlogin /etc/ssh/sshd_config echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config _dir1='/bin' _dir2='/etc/VPSManager' _dir3='/root' rm $_dir2/ShellBot.sh $_dir2/cabecalho $_dir2/open.py $_dir2/proxy.py $_dir2/wsproxy.py >/dev/null 2>&1 _mdls=("addhost" "delhost" "alterarsenha" "criarusuario" "expcleaner" "mudardata" "remover" "criarteste" "verifbot" "droplimiter" "alterarlimite" "ajuda" "sshmonitor" "badvpn" "userbackup" "instsqd" "blockt" "otimizar" "menu" "speedtest" "banner" "senharoot" "reiniciarservicos" "reiniciarsistema" "attscript" "conexao" "delscript" "detalhes" "botssh" "botteste" "botgen" "infousers" "verifatt" "limiter" "uexpired" "cabecalho" "bot" "botsshteste" "botgerador" "open.py" "slow_dns" "proxy.py" "wsproxy.py") _mdls2=("onlineapp.sh") for _arq in ${_mdls[@]}; do [[ -e $_dir1/$_arq ]] && rm $_dir1/$_arq >/dev/null 2>&1 wget -c -P $_dir1 https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Modulos/$_arq chmod +x $_dir1/$_arq done for _arq in ${_mdls2[@]}; do [[ -e $_dir3/$_arq ]] && rm $_dir3/$_arq >/dev/null 2>&1 wget -c -P $_dir3 https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Modulos/$_arq chmod +x $_dir3/$_arq done cd /var/www/html && mkdir server cd /root && ./onlineapp.sh mv $_dir1/cabecalho $_dir1/bot $_dir1/botsshteste $_dir1/botgerador $_dir1/open.py $_dir1/proxy.py $_dir1/wsproxy.py $_dir2 _arq_host="/etc/hosts" _host[0]="d1n212ccp6ldpw.cloudfront.net" _host[1]="dns.whatsapp.net" _host[2]="portalrecarga.vivo.com.br/recarga" _host[3]="navegue.vivo.com.br/controle/" _host[4]="navegue.vivo.com.br/pre/" _host[5]="www.whatsapp.net" _host[6]="/VPSMANAGER?" for host in ${_host[@]}; do if [[ "$(grep -w "$host" $_arq_host | wc -l)" = "0" ]]; then sed -i "3i\127.0.0.1 $host" $_arq_host fi done [[ ! -e /etc/autostart ]] && { echo '#!/bin/bash clear #AUTOMATIC START' >/etc/autostart chmod +x /etc/autostart } || { [[ $(ps x | grep "bot_plus" | grep -v grep | wc -l) != '0' ]] && wget -qO- https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/ShellBot.sh for proc in $(ps x | grep 'dmS' | grep -v 'grep' | awk {'print $1'}); do screen -r -S "$proc" -X quit done screen -wipe >/dev/null echo '#!/bin/bash clear #AUTOMATIC START' >/etc/autostart chmod +x /etc/autostart } || { [[ $(ps x | grep "bot_teste" | grep -v grep | wc -l) != '0' ]] && wget -qO- https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/ShellBot.sh for proc in $(ps x | grep 'dmS' | grep -v 'grep' | awk {'print $1'}); do screen -r -S "$proc" -X quit done screen -wipe >/dev/null echo '#!/bin/bash clear #AUTOMATIC START' >/etc/autostart chmod +x /etc/autostart } || { [[ $(ps x | grep "bot_gen" | grep -v grep | wc -l) != '0' ]] && wget -qO- https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/ShellBot.sh for proc in $(ps x | grep 'dmS' | grep -v 'grep' | awk {'print $1'}); do screen -r -S "$proc" -X quit done screen -wipe >/dev/null echo '#!/bin/bash clear #AUTOMATIC START' >/etc/autostart chmod +x /etc/autostart } crontab -r >/dev/null 2>&1 ( crontab -l 2>/dev/null echo "@daily /bin/verifatt" echo "@reboot /etc/autostart" echo "* * * * * /etc/autostart" echo "0 */6 * * * /bin/uexpired" echo "*/1 * * * * cd /root/ && ./onlineapp.sh" ) | crontab - echo "$_lvk" | sed -n '1 p' | cut -d' ' -f2 >/bin/versao && cat /bin/versao >/home/vpsmanager wget https://github.com/januda-ui/DRAGON-VPS-MANAGER/raw/main/Install/jq-linux64 >/dev/null 2>&1 chmod +x jq-linux64 && mv jq-linux64 $(which jq) service cron restart >/dev/null 2>&1 service ssh restart >/dev/null 2>&1 [[ -d /var/www/html/openvpn ]] && service apache2 restart >/dev/null 2>&1 rm -rf $lst1/list >/dev/null 2>&1 ================================================ FILE: Install/squid3 ================================================ #! /bin/sh NAME=squid3 DESC="Squid HTTP Proxy" DAEMON=/usr/sbin/squid3 PIDFILE=/var/run/$NAME.pid CONFIG=/etc/squid3/squid.conf SQUID_ARGS="-YC -f $CONFIG" [ ! -f /etc/default/squid ] || . /etc/default/squid . /lib/lsb/init-functions PATH=/bin:/usr/bin:/sbin:/usr/sbin [ -x $DAEMON ] || exit 0 ulimit -n 65535 find_cache_dir () { w=" " res=`$DAEMON -k parse -f $CONFIG 2>&1 | grep "Processing:" | sed s/.*Processing:\ // | sed -ne ' s/^['"$w"']*'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p; t end; d; :end q'` [ -n "$res" ] || res=$2 echo "$res" } grepconf () { w=" " res=`$DAEMON -k parse -f $CONFIG 2>&1 | grep "Processing:" | sed s/.*Processing:\ // | sed -ne ' s/^['"$w"']*'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p; t end; d; :end q'` [ -n "$res" ] || res=$2 echo "$res" } create_run_dir () { run_dir=/var/run/squid3 usr=`grepconf cache_effective_user proxy` grp=`grepconf cache_effective_group proxy` if [ "$(dpkg-statoverride --list $run_dir)" = "" ] && [ ! -e $run_dir ] ; then mkdir -p $run_dir chown $usr:$grp $run_dir [ -x /sbin/restorecon ] && restorecon $run_dir fi } start () { cache_dir=`find_cache_dir cache_dir` cache_type=`grepconf cache_dir` run_dir=/var/run/squid3 create_run_dir if test -d "$cache_dir" -a ! -d "$cache_dir/00" then log_warning_msg "Creating $DESC cache structure" $DAEMON -z -f $CONFIG [ -x /sbin/restorecon ] && restorecon -R $cache_dir fi umask 027 ulimit -n 65535 cd $run_dir start-stop-daemon --quiet --start \ --pidfile $PIDFILE \ --exec $DAEMON -- $SQUID_ARGS < /dev/null return $? } stop () { PID=`cat $PIDFILE 2>/dev/null` start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON sleep 2 if test -n "$PID" && kill -0 $PID 2>/dev/null then log_action_begin_msg " Waiting" cnt=0 while kill -0 $PID 2>/dev/null do cnt=`expr $cnt + 1` if [ $cnt -gt 24 ] then log_action_end_msg 1 return 1 fi sleep 5 log_action_cont_msg "" done log_action_end_msg 0 return 0 else return 0 fi } cfg_pidfile=`grepconf pid_filename` if test "${cfg_pidfile:-none}" != "none" -a "$cfg_pidfile" != "$PIDFILE" then log_warning_msg "squid.conf pid_filename overrides init script" PIDFILE="$cfg_pidfile" fi case "$1" in start) res=`$DAEMON -k parse -f $CONFIG 2>&1 | grep -o "FATAL: .*"` if test -n "$res"; then log_failure_msg "$res" exit 3 else log_daemon_msg "Starting $DESC" "$NAME" if start ; then log_end_msg $? else log_end_msg $? fi fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if stop ; then log_end_msg $? else log_end_msg $? fi ;; reload|force-reload) res=`$DAEMON -k parse -f $CONFIG 2>&1 | grep -o "FATAL: .*"` if test -n "$res"; then log_failure_msg "$res" exit 3 else log_action_msg "Reloading $DESC configuration files" start-stop-daemon --stop --signal 1 \ --pidfile $PIDFILE --quiet --exec $DAEMON log_action_end_msg 0 fi ;; restart) res=`$DAEMON -k parse -f $CONFIG 2>&1 | grep -o "FATAL: .*"` if test -n "$res"; then log_failure_msg "$res" exit 3 else log_daemon_msg "Restarting $DESC" "$NAME" stop if start ; then log_end_msg $? else log_end_msg $? fi fi ;; status) status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit 3 ;; *) echo "Utilize: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}" exit 3 ;; esac exit 0 ================================================ FILE: Install/sshd_config ================================================ Port 22 Protocol 2 KeyRegenerationInterval 3600 ServerKeyBits 1024 SyslogFacility AUTH LogLevel INFO LoginGraceTime 120 PermitRootLogin yes StrictModes yes RSAAuthentication yes PubkeyAuthentication yes IgnoreRhosts yes RhostsRSAAuthentication no HostbasedAuthentication no PermitEmptyPasswords no PermitTunnel yes ChallengeResponseAuthentication no PasswordAuthentication yes X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes #UseLogin no AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server UsePAM yes ================================================ FILE: Install/stunnel.pem ================================================ -----BEGIN CERTIFICATE REQUEST----- MIICcDCCAVgCAQIwADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPE7 0yix+NYRCA60guoa7MzxBLhJfLNA+FQ5V1L671a0BvqA60f6MkiyKd0KVinFP7Ox fDd1FdUz2kSyeKvUhL1H84zAeDOZOgkyka3/wDBvzsM5Ju25fjjU8hA8jltP+JMR KaTv9r0tHIPH1ymmXs6AHQoLSvTvFwIz+6sAPSGqxy8c1hzM1vsz3ArUjm90mRkE fHuPQMQPEwN3wpmcs0YMwOJQcYW6PXbznvYtbDGJzjSFZ9ez/yNO9RbY9N/T5CEq tLA/l9F/XBv3imBZwsMHEv6Ok10WxswxWU3Ij2rHvqDixE4e+lD/IpFz4IKSV0jG qYfIEwaMYj834MwxtbkCAwEAAaArMCkGCSqGSIb3DQEJDjEcMBowGAYDVR0RBBEw D4INYnIyLmpydnBzLnh5ejANBgkqhkiG9w0BAQsFAAOCAQEAfpPr7cpsIZGVrbmx /meRVaQgIVagOOSFzAbUcqtHZKkxOUGOpsNL4YBJaRhcLR9b8xuQ9MphbxzXqncm pP+318P5heCtvlo2nx5wKnLD9FZmyKmadKcMMiGs9OxZH/GJ6k2BA3T5WDELVTS+ wN9j3yXkoANpBCuIDUXRSqTl11oNcVVHeqH35zHDzZxzM2/wJSfvK8+Z75amiTAj jC+L5mpGRysSCQOvJsFLldAl/n8ltWAEGn/SfBBqlfP8Vcjk3w2UyMpzRnalVGiZ de7UmIGcBhNLFiN6E8ZKahJkWvxcF8D0CVt3xE5CWrFAoharnrlGnnGx/UGTGCyK PcKa+A== -----END CERTIFICATE REQUEST----- -----BEGIN CERTIFICATE----- MIIFLzCCBBegAwIBAgISBJgB15+Qh/t+3Iou1tXmuYdcMA0GCSqGSIb3DQEBCwUA MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD EwJSMzAeFw0yMTA4MDQyMjI5MjdaFw0yMTExMDIyMjI5MjVaMCAxHjAcBgNVBAMT FWJyYXNpbC0wMS5uZXh0c3NoLnh5ejCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC AQoCggEBAKARP0WX1UFQzoY3gCVAZKICepD4SfGM2H4rvJRGCAgGrTRq3NKHzGoK k+eWoakjKAjAVr5GTXNLEXENPwuW3S0kPhC890Bxetvjln/a/l4o5NuAPFacvyNE UfxLTlMvvghyHHg+f/Y74KdjYa/aOf0d3+4yd6FYLvHskIUiP1lV9r0o/V0uNEry uwnJsVjA7tOChKLqGmFsLrE+DYuCZO4G9dAqjxOBgfuTXRYCNJx1QkD2IoIRw05L Y5ipHrVLU107XeuxnJT4GJEbT/qsKE7cs8T4j8XcsVQqu/4F1RmZ47IqOPfsUWzX SvT9Vu5Q4W13xDNgeVLjGUujJxuZz28CAwEAAaOCAk8wggJLMA4GA1UdDwEB/wQE AwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIw ADAdBgNVHQ4EFgQUIFnyEuwmiz0jNdH/T0SNRChxuygwHwYDVR0jBBgwFoAUFC6z F7dYVsuuUAlA5h+vnYsUwsYwVQYIKwYBBQUHAQEESTBHMCEGCCsGAQUFBzABhhVo dHRwOi8vcjMuby5sZW5jci5vcmcwIgYIKwYBBQUHMAKGFmh0dHA6Ly9yMy5pLmxl bmNyLm9yZy8wIAYDVR0RBBkwF4IVYnJhc2lsLTAxLm5leHRzc2gueHl6MEwGA1Ud IARFMEMwCAYGZ4EMAQIBMDcGCysGAQQBgt8TAQEBMCgwJgYIKwYBBQUHAgEWGmh0 dHA6Ly9jcHMubGV0c2VuY3J5cHQub3JnMIIBAwYKKwYBBAHWeQIEAgSB9ASB8QDv AHYAb1N2rDHwMRnYmQCkURX/dxUcEdkCwQApBo2yCJo32RMAAAF7E4AZTAAABAMA RzBFAiA4UnUT5iXXb5SihfdvMuL7DyPHLnokKhRMxh3O/33+ZAIhAKC2R3WGRxic OLxvWDDptfqu0SHaL89y1wTAZjCbi+t4AHUAfT7y+I//iFVoJMLAyp5SiXkrxQ54 CX8uapdomX4i8NcAAAF7E4AZSQAABAMARjBEAiAeah3CaKe7jUJXsB3FOE7nxvD4 fDGk71Tx2eVth9B1QQIgC+LJHKIP3m4DLVipA+5koGs0Iva3TUc8WDcgS5EdNYkw DQYJKoZIhvcNAQELBQADggEBACFlqYeooJwsprV66XRWYiLCQkn/nJRBqLiyWlP5 MY3KlGdd/7ucvAjrUqBOaRTVu5UmABa12op+Wlb5jBiOnkF2g4xqgtMa+DJ/TUzj xQQa5R8NQm1f3GeXSxPCxP7ohzkZRVCpyZr4s/wW3jBzjKUGKQW18ty8pFxVsfDZ KiWtViQMW6AcUdsRNZBBrlPYTD6OszCo0B9NaxVM1hgsSOXttTLKCmeCUKo17F97 AEPSSFiFTP9YF/fQAEM6LotMYFrnbQTtdgxhTjxPWUeWtR9g3pNRbncqd708YZlR M2ertwgWFBSivfXUPR8dKBfPfLH/J7xjEo5x5NoNjx/JleY= -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP R5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdx sxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8Zutm NHz6a4uPVymZ+DAXXbpyb/uBxa3Shlg9F8fnCbvxK/eG3MHacV3URuPMrSXBiLxg Z3Vms/EY96Jc5lP/Ooi2R6X/ExjqmAl3P51T+c8B5fWmcBcUr2Ok/5mzk53cU6cG /kiFHaFpriV1uxPMUgP17VGhi9sVAgMBAAGjggEIMIIBBDAOBgNVHQ8BAf8EBAMC AYYwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMBIGA1UdEwEB/wQIMAYB Af8CAQAwHQYDVR0OBBYEFBQusxe3WFbLrlAJQOYfr52LFMLGMB8GA1UdIwQYMBaA FHm0WeZ7tuXkAXOACIjIGlj26ZtuMDIGCCsGAQUFBwEBBCYwJDAiBggrBgEFBQcw AoYWaHR0cDovL3gxLmkubGVuY3Iub3JnLzAnBgNVHR8EIDAeMBygGqAYhhZodHRw Oi8veDEuYy5sZW5jci5vcmcvMCIGA1UdIAQbMBkwCAYGZ4EMAQIBMA0GCysGAQQB gt8TAQEBMA0GCSqGSIb3DQEBCwUAA4ICAQCFyk5HPqP3hUSFvNVneLKYY611TR6W PTNlclQtgaDqw+34IL9fzLdwALduO/ZelN7kIJ+m74uyA+eitRY8kc607TkC53wl ikfmZW4/RvTZ8M6UK+5UzhK8jCdLuMGYL6KvzXGRSgi3yLgjewQtCPkIVz6D2QQz CkcheAmCJ8MqyJu5zlzyZMjAvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4 avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2 yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+ HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX nLRbwHOoq7hHwg== -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- MIIFYDCCBEigAwIBAgIQQAF3ITfU6UK47naqPGQKtzANBgkqhkiG9w0BAQsFADA/ MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT DkRTVCBSb290IENBIFgzMB4XDTIxMDEyMDE5MTQwM1oXDTI0MDkzMDE4MTQwM1ow TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwggIiMA0GCSqGSIb3DQEB AQUAA4ICDwAwggIKAoICAQCt6CRz9BQ385ueK1coHIe+3LffOJCMbjzmV6B493XC ov71am72AE8o295ohmxEk7axY/0UEmu/H9LqMZshftEzPLpI9d1537O4/xLxIZpL wYqGcWlKZmZsj348cL+tKSIG8+TA5oCu4kuPt5l+lAOf00eXfJlII1PoOK5PCm+D LtFJV4yAdLbaL9A4jXsDcCEbdfIwPPqPrt3aY6vrFk/CjhFLfs8L6P+1dy70sntK 4EwSJQxwjQMpoOFTJOwT2e4ZvxCzSow/iaNhUd6shweU9GNx7C7ib1uYgeGJXDR5 bHbvO5BieebbpJovJsXQEOEO3tkQjhb7t/eo98flAgeYjzYIlefiN5YNNnWe+w5y sR2bvAP5SQXYgd0FtCrWQemsAXaVCg/Y39W9Eh81LygXbNKYwagJZHduRze6zqxZ Xmidf3LWicUGQSk+WT7dJvUkyRGnWqNMQB9GoZm1pzpRboY7nn1ypxIFeFntPlF4 FQsDj43QLwWyPntKHEtzBRL8xurgUBN8Q5N0s8p0544fAQjQMNRbcTa0B7rBMDBc SLeCO5imfWCKoqMpgsy6vYMEG6KDA0Gh1gXxG8K28Kh8hjtGqEgqiNx2mna/H2ql PRmP6zjzZN7IKw0KKP/32+IVQtQi0Cdd4Xn+GOdwiK1O5tmLOsbdJ1Fu/7xk9TND TwIDAQABo4IBRjCCAUIwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw SwYIKwYBBQUHAQEEPzA9MDsGCCsGAQUFBzAChi9odHRwOi8vYXBwcy5pZGVudHJ1 c3QuY29tL3Jvb3RzL2RzdHJvb3RjYXgzLnA3YzAfBgNVHSMEGDAWgBTEp7Gkeyxx +tvhS5B1/8QVYIWJEDBUBgNVHSAETTBLMAgGBmeBDAECATA/BgsrBgEEAYLfEwEB ATAwMC4GCCsGAQUFBwIBFiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQu b3JnMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6Ly9jcmwuaWRlbnRydXN0LmNvbS9E U1RST09UQ0FYM0NSTC5jcmwwHQYDVR0OBBYEFHm0WeZ7tuXkAXOACIjIGlj26Ztu MA0GCSqGSIb3DQEBCwUAA4IBAQAKcwBslm7/DlLQrt2M51oGrS+o44+/yQoDFVDC 5WxCu2+b9LRPwkSICHXM6webFGJueN7sJ7o5XPWioW5WlHAQU7G75K/QosMrAdSW 9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuG WCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5 -----END CERTIFICATE----- -----BEGIN PRIVATE KEY----- MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCgET9Fl9VBUM6G N4AlQGSiAnqQ+EnxjNh+K7yURggIBq00atzSh8xqCpPnlqGpIygIwFa+Rk1zSxFx DT8Llt0tJD4QvPdAcXrb45Z/2v5eKOTbgDxWnL8jRFH8S05TL74Ichx4Pn/2O+Cn Y2Gv2jn9Hd/uMnehWC7x7JCFIj9ZVfa9KP1dLjRK8rsJybFYwO7TgoSi6hphbC6x Pg2LgmTuBvXQKo8TgYH7k10WAjScdUJA9iKCEcNOS2OYqR61S1NdO13rsZyU+BiR G0/6rChO3LPE+I/F3LFUKrv+BdUZmeOyKjj37FFs10r0/VbuUOFtd8QzYHlS4xlL oycbmc9vAgMBAAECggEADvjOBEJpbgyS5Lb4Q4O8ZfL5Z+nxcKiN729D2lKambWW Kdr9AKw3EIwgvX63bEyfiAIFmxKUV/5jiUGF7h2UXo6PR52FOv/iUAL/psHjHQeS MH3UJv3OWwwe5wxcLSfADKYvx4eBDJUZNE71ai9tUSGkOnF6AxtueK557hn/9ukP nX2VmcmYRvLLw9e73Z82kdD8C+lxD+gOMV23/XwZBlIwNpUp0JI45WhgYWIXUF3e TIcr50AHrgFE/1V4IdKe7mWJUnAhUqz9QyF55MYpIec62Nvyb9wS+k21hjvgrj/G XckkkBmPJQoBQRrj5t+4suFADlx0MysQ8r3eNQjDcQKBgQDTeaUAZA0alGzAv15o X803ckFVoxDnu45ni7Xqf+rKDWV7243ZYeOapgcJ5zi0OCOPlhcUFO8XC+SaSO64 kFseOyRfVm53B5xc724qBHe7zTmmIBdw7n79K9N+gSVgxp+4AYCDz9n3aYufvRuO /zx8Xf3ts9nsHxS44QtJpxzgzQKBgQDBxMKV2QGb/LjQVcyaLzKEo1cn8iwDO9QA YmyZ2WQMs+UbtWkot4uiW+0jQA6L5iYngCEbBVF9ptdAOVME3mmz9o3xo1EwSwcK 4/abN++FT2yQhZu94N3LRyHgMbr/Yr6CUo1g6aymvwI9QTsGliSIXaf8xKlw51RC m0Dgl1xBKwKBgAYKY3wvX3By7OhUjw3MLsB2swcPMVxtLxQmGXwpSzuaRlvTWanr 8eRo+ap+wE/lip5/Wwlnz6yI2m7NxoPfG7sxVUij32PnA8Bj1nG8zu6+Xfcw03qW VWpF5jSm27p38ff/kvww47j9es+FR1Q+Viv3Q1mW2ZK1EJJ3WysvatPBAoGBAK4X nESJ3ppJq7ry+4skEJ1/LBVlzglxvX5C8BQib3PCRXxpt3uvvTM4qIzdRrSHKYyf 4B6o3pioSAkZ9+8N7aaVRN7vv0hGgKNWQgEfdoIt4/rNMCqfWGcFF/iYdcxy6Xup tAB4snh2cQqcCu5WA6jJjN7byuj3zoqxds7S7z5VAoGBAJHk6hs20mb01Oz29orS aTfeEpOTagPpj+hk92+2FNq+MOs7ph4l4o0ADKRh4DjFPTm6bOGT9Z9TlcvQWKXL D7fw+cASvEZpPte1sAHfa4lJ8TwLhSdpliYC9U5SCGhdnpwb8kzhyciKhxiD9ukv G5lPlY/W1LzY6Mu2uatNhByF -----END PRIVATE KEY----- ================================================ FILE: Install/tcptweaker.sh ================================================ #!/bin/bash tput setaf 7 ; tput setab 4 ; tput bold ; printf '%35s%s%-20s\n' "TCP Tweaker 1.0" ; tput sgr0 if [[ `grep -c "^#PH56" /etc/sysctl.conf` -eq 1 ]] then echo "" echo "TCP Tweaker network settings have already been added to the system!" echo "" read -p "Do you want to remove TCP Tweaker settings? [s/n]: " -e -i n resposta0 if [[ "$resposta0" = 's' ]]; then grep -v "^#PH56 net.ipv4.tcp_window_scaling = 1 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 16384 16777216 net.ipv4.tcp_low_latency = 1 net.ipv4.tcp_slow_start_after_idle = 0" /etc/sysctl.conf > /tmp/syscl && mv /tmp/syscl /etc/sysctl.conf sysctl -p /etc/sysctl.conf > /dev/null echo "" echo "TCP Tweaker network settings were successfully removed." echo "" exit else echo "" exit fi else echo "" echo "This is an experimental script. Use at your own risk!" echo "This script will change some network settings" echo "to reduce latency and improve speed." echo "" read -p "Proceed with installation? [s/n]: " -e -i n resposta if [[ "$resposta" = 's' ]]; then echo "" echo "Modifying the following settings:" echo " " >> /etc/sysctl.conf echo "#PH56" >> /etc/sysctl.conf echo "net.ipv4.tcp_window_scaling = 1 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 16384 16777216 net.ipv4.tcp_low_latency = 1 net.ipv4.tcp_slow_start_after_idle = 0" >> /etc/sysctl.conf echo "" sysctl -p /etc/sysctl.conf echo "" echo "TCP Tweaker network settings have been added successfully." echo "" else echo "" echo "Installation was canceled by the user!" echo "" fi fi exit ================================================ FILE: Install/versao ================================================ VERSION: 01 ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: Modulos/addhost ================================================ #!/bin/bash if [ -d "/etc/squid/" ]; then payload="/etc/squid/payload.txt" elif [ -d "/etc/squid3/" ]; then payload="/etc/squid3/payload.txt" fi tput setaf 7 ; tput setab 4 ; tput bold ; printf '%35s%s%-10s\n' "Add Host to Squid Proxy" ; tput sgr0 if [ ! -f "$payload" ] then tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "File $payload Not Found" ; tput sgr0 exit 1 else tput setaf 2 ; tput bold ; echo ""; echo "Current domains in file $payload:" ; tput sgr0 tput setaf 3 ; tput bold ; echo "" ; cat $payload ; echo "" ; tput sgr0 read -p "Enter the domain you want to add to the list: " host if [[ -z $host ]] then tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "You have entered an empty or non-existent domain!" ; echo "" ; tput sgr0 exit 1 else if [[ `grep -c "^$host" $payload` -eq 1 ]] then tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "the domain $host already exists in the file $payload" ; echo "" ; tput sgr0 exit 1 else if [[ $host != \.* ]] then tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "You must add a domain by starting it with a dot!" ; echo "For example: .phreaker56.xyz" ; echo "It is not necessary to add subdomains for domains that are already in the file." ; echo "In other words, it is not necessary to add recargawap .claro .com .br" ; echo "if the domain .claro .com .br is already in the file." ; echo ""; tput sgr0 exit 1 else echo "$host" >> $payload && grep -v "^$" $payload > /tmp/a && mv /tmp/a $payload tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "File $payload updated, the domain was successfully added.:" ; tput sgr0 tput setaf 3 ; tput bold ; echo "" ; cat $payload ; echo "" ; tput sgr0 if [ ! -f "/etc/init.d/squid3" ] then service squid3 reload elif [ ! -f "/etc/init.d/squid" ] then service squid reload fi tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Proxy,Squid Proxy reloaded successfully! ◇ Proxy,Squid Proxy සාර්ථකව නැවත පූරණය කරන ලදී!" ; echo "" ; tput sgr0 exit 1 fi fi fi fi ================================================ FILE: Modulos/ajuda ================================================ #!/bin/bash clear echo -e " \033[1;31mByㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ\033[1;36m" echo " ㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ" | figlet echo -e "\033[1;32m MENU INFORMATION AND OPTIONS \033[0m\n\n" echo -e " \033[1;37m[\033[1;31m01\033[1;37m] - \033[1;33m Create ssh user" echo -e " \033[1;37m[\033[1;31m02\033[1;37m] - \033[1;33m Create test ssh user" echo -e " \033[1;37m[\033[1;31m03\033[1;37m] - \033[1;33m Remove ssh user" echo -e " \033[1;37m[\033[1;31m04\033[1;37m] - \033[1;33m Monitor ssh and dropbear users" echo -e " \033[1;37m[\033[1;31m05\033[1;37m] - \033[1;33m Change ssh user date" echo -e " \033[1;37m[\033[1;31m06\033[1;37m] - \033[1;33m Change limit for connections" echo -e " \033[1;37m[\033[1;31m07\033[1;37m] - \033[1;33m Change ssh user password" echo -e " \033[1;37m[\033[1;31m08\033[1;37m] - \033[1;33m Remove all expired users" echo -e " \033[1;37m[\033[1;31m09\033[1;37m] - \033[1;33m Activate the connection limiter" echo -e " \033[1;37m[\033[1;31m10\033[1;37m] - \033[1;33m connection mode. squid, dropbear, etc. \033[1;32mNEW" echo -e " \033[1;37m[\033[1;31m11\033[1;37m] - \033[1;33m Performs server speed test \033[1;32mNEW" echo -e " \033[1;37m[\033[1;31m12\033[1;37m] - \033[1;33m Set a banner for vps" echo -e " \033[1;37m[\033[1;31m13\033[1;37m] - \033[1;33m Displays the traffic consumed" echo -e " \033[1;37m[\033[1;31m14\033[1;37m] - \033[1;33m Performs cleaning and error repairs \033[1;32mNEW" echo -e " \033[1;37m[\033[1;31m15\033[1;37m] - \033[1;33m Install OpenVPN " echo -e " \033[1;37m[\033[1;31m16\033[1;37m] - \033[1;33m Create users backup" echo -e " \033[1;37m[\033[1;31m17\033[1;37m] - \033[1;33m Install Bad Udp for VoIP calls" echo -e " \033[1;37m[\033[1;31m18\033[1;37m] - \033[1;33m Improves latency 'Experimental'" echo -e " \033[1;37m[\033[1;31m19\033[1;37m] - \033[1;33m Display the second Menu" echo -e " \033[1;37m[\033[1;31m20\033[1;37m] - \033[1;33m Add host on vps for squid connection" echo -e " \033[1;37m[\033[1;31m21\033[1;37m] - \033[1;33m Remove host from vps " echo -e " \033[1;37m[\033[1;31m22\033[1;37m] - \033[1;33m restart system" echo -e " \033[1;37m[\033[1;31m23\033[1;37m] - \033[1;33m Restart services 'squid' 'dropbear' and etc." echo -e " \033[1;37m[\033[1;31m24\033[1;37m] - \033[1;33m Option to manage vps by telegram \033[1;32mNEW" echo -e " \033[1;37m[\033[1;31m25\033[1;37m] - \033[1;33m Displays vps information" echo -e " \033[1;37m[\033[1;31m26\033[1;37m] - \033[1;33m Change vps password" echo -e " \033[1;37m[\033[1;31m27\033[1;37m] - \033[1;33m Update theㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤscript" echo -e " \033[1;37m[\033[1;31m28\033[1;37m] - \033[1;33m Remove theㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤscript" echo -e " \033[1;37m[\033[1;31m29\033[1;37m] - \033[1;33m Display information about the script" echo -e " \033[1;37m[\033[1;31m30\033[1;37m] - \033[1;33m Return to previous menu\033[0m" ================================================ FILE: Modulos/alterarlimite ================================================ #!/bin/bash tput setaf 7 ; tput setab 4 ; tput bold ; printf '%20s%s\n' "ㅤ🐉ㅤChange limit on simultaneous connectionsㅤ🐉ㅤ" ; tput sgr0 database="/root/usuarios.db" if [ ! -f "$database" ]; then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "File $database not found!" ; echo "" ; tput sgr0 exit 1 else tput setaf 3 ; tput bold ; echo ""; echo "◇ LIST OF USERS AND THEIR LIMITS:" ; tput sgr0 echo "" _userT=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody) i=0 unset _userPass while read _user; do i=$(expr $i + 1) _oP=$i [[ $i == [1-9] ]] && i=0$i && oP+=" 0$i" if [[ "$(grep -wc "$_user" $database)" != "0" ]]; then limit=$(grep -w "$_user" $database |cut -d' ' -f2) else limit='1' fi l_user=$(echo -e "\033[1;31m[\033[1;36m$i\033[1;31m] \033[1;37m- \033[1;32m$_user\033[0m") lim=$(echo -e "\033[1;33m◇ㅤLimit\033[1;37m: $limit") printf '%-65s%s\n' "$l_user" "$lim" _userPass+="\n${_oP}:${_user}" done <<< "${_userT}" echo "" num_user=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) echo -ne "\033[1;32m◇ Enter or select a user \033[1;33m[\033[1;36m1\033[1;31m-\033[1;36m$num_user\033[1;33m]\033[1;37m: " ; read option usuario=$(echo -e "${_userPass}" | grep -E "\b$option\b" | cut -d: -f2) if [[ -z $option ]]; then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "◇ Empty or non-existent user" ; echo "" ; tput sgr0 exit elif [[ -z $usuario ]]; then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "◇ Empty or non-existent user" ; echo "" ; tput sgr0 exit 1 else if cat /etc/passwd |grep -w $usuario > /dev/null; then echo -ne "\n\033[1;32m◇ New limit for the user \033[1;33m$usuario\033[1;37m: "; read sshnum if [[ -z $sshnum ]] then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "◇ You entered an invalid number!" ; echo "" ; tput sgr0 exit 1 else if (echo $sshnum | egrep [^0-9] &> /dev/null) then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "◇ You entered an invalid number!" ; echo "" ; tput sgr0 exit 1 else if [[ $sshnum -lt 1 ]] then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "◇ You must enter a number greater than zero!" ; echo "" ; tput sgr0 exit 1 else grep -v ^$usuario[[:space:]] /root/usuarios.db > /tmp/a sleep 1 mv /tmp/a /root/usuarios.db echo $usuario $sshnum >> /root/usuarios.db tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "◇ Limit applied to the user $usuario foi $sshnum " ; tput sgr0 sleep 2 exit fi fi fi else tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "◇ The user $usuario was not found" ; echo "" ; tput sgr0 exit 1 fi fi fi ================================================ FILE: Modulos/alterarsenha ================================================ #!/bin/bash tput setaf 7 ; tput setab 4 ; tput bold ; printf '%35s%s%-10s\n' "🐉ㅤChange User Passwordㅤ🐉" ; tput sgr0 echo "" echo -e "\033[1;33mLIST OF USERS AND THEIR PASSWORDS: \033[0m" echo"" _userT=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody) i=0 unset _userPass while read _user; do i=$(expr $i + 1) _oP=$i [[ $i == [1-9] ]] && i=0$i && oP+=" 0$i" if [[ -e "/etc/VPSManager/senha/$_user" ]]; then _senha="$(cat /etc/VPSManager/senha/$_user)" else _senha='Null' fi suser=$(echo -e "\033[1;31m[\033[1;36m$i\033[1;31m] \033[1;37m- \033[1;32m$_user\033[0m") ssenha=$(echo -e "\033[1;33mPassword\033[1;37m: $_senha") printf '%-60s%s\n' "$suser" "$ssenha" _userPass+="\n${_oP}:${_user}" done <<< "${_userT}" num_user=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) echo "" echo -ne "\033[1;32mEnter or select a user \033[1;33m[\033[1;36m1\033[1;31m-\033[1;36m$num_user\033[1;33m]\033[1;37m: " ; read option user=$(echo -e "${_userPass}" | grep -E "\b$option\b" | cut -d: -f2) if [[ -z $option ]] then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Empty or invalid field!" ; echo "" ; tput sgr0 exit 1 elif [[ -z $user ]] then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "You entered an empty or invalid name!" ; echo "" ; tput sgr0 exit 1 else if [[ `grep -c /$user: /etc/passwd` -ne 0 ]] then echo -ne "\n\033[1;32mNew password for user \033[1;33m$user\033[1;37m: "; read password sizepass=$(echo ${#password}) if [[ $sizepass -lt 4 ]] then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Empty or invalid password! use at least 4 characters" ; echo "" ; tput sgr0 exit 1 else ps x | grep $user | grep -v grep | grep -v pt > /tmp/rem if [[ `grep -c $user /tmp/rem` -eq 0 ]] then echo "$user:$password" | chpasswd tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "User password $user has been changed to: $password" ; echo "" ; tput sgr0 echo "$password" > /etc/VPSManager/senha/$user exit 1 else echo "" tput setaf 7 ; tput setab 4 ; tput bold ; echo "User logged in. Disconnecting..." ; tput sgr0 pkill -f $user echo "$user:$password" | chpasswd tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "User password $user has been changed to: $password" ; echo "" ; tput sgr0 echo "$password" > /etc/VPSManager/senha/$user exit 1 fi fi else tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "The user $user does not exist!" ; echo "" ; tput sgr0 fi fi ================================================ FILE: Modulos/attscript ================================================ #!/bin/bash clear fun_bar () { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim ${comando[0]} > /dev/null 2>&1 ${comando[1]} > /dev/null 2>&1 touch $HOME/fim ) > /dev/null 2>&1 & tput civis echo -ne " \033[1;33mPLEASE WAIT ... \033[1;37m- \033[1;33m[" while true; do for((i=0; i<18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne " \033[1;33mPLEASE WAIT ... \033[1;37m- \033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m" tput cnorm } echo " " fun_atts () { [[ -e /home/versao ]] && rm /home/versao [[ -e /tmp/att ]] && rm /tmp/att wget -c -P /home https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Sistema/versao [[ -f "/home/versao" ]] && mv /home/versao /tmp/att [[ ! -e /bin/versao ]] && rm -rf /bin/menu } > /dev/null 2>&1 echo -e "ㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ" | figlet echo " " echo -e " \033[1;32m◇ CHECKING FOR AVAILABLE UPDATES\033[0m\n" fun_bar 'fun_atts' [[ ! -f "/tmp/att" ]] && { echo -e "\n\033[1;31m◇ ERROR CONNECTING TO SERVER\n" echo -ne "\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read menu } echo " " vrs1=$(sed -n '1 p' /bin/versao| sed -e 's/[^0-9]//ig') vrs2=$(sed -n '1 p' /tmp/att | sed -e 's/[^0-9]//ig') [[ "$vrs1" == "$vrs2" ]] && { echo -e " \033[1;36m ◇ THE SCRIPT IS NOW UPDATED!\033[1;32m\n" rm /tmp/att > /dev/null 2>&1 echo -ne " \033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read menu } || { echo -e " \033[1;36m◇ THERE IS A NEW UPDATE AVAILABLE!\033[1;33m\n" echo -e " \033[1;32m◇ UPDATE DETAILS:\033[0m\n" while read linha; do echo -e " \033[1;37m- \033[1;33m$linha" done < "/tmp/att" echo " " echo -ne " \033[1;32m◇ WISH TO UPDATE \033[1;31m? \033[1;33m[s/n]:\033[1;37m "; read res if [[ "$res" = s || "$res" = S ]];then echo -e "\n\033[1;32m◇ STARTING UPDATE..." sleep 3 wget https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/hehe > /dev/null 2>&1 chmod +x hehe ./hehe clear echo -e "\033[1;32m◇ SUCCESSFULLY UPDATED SCRIPT\033[0m\n" rm /tmp/att > /dev/null 2>&1 echo -ne "\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read menu else menu fi } ================================================ FILE: Modulos/badvpn ================================================ #!/bin/bash fun_badvpn() { clear echo -e "\E[44;1;37m ㅤ🐉ㅤBADVPN MANAGERㅤ🐉ㅤ \E[0m" echo "" if ps x | grep -w udpvpn | grep -v grep 1>/dev/null 2>/dev/null; then echo -e "\033[1;33m◇ PORTS\033[1;37m: \033[1;32m$(netstat -nplt | grep 'badvpn-ud' | awk {'print $4'} | cut -d: -f2 | xargs)" else sleep 0.1 fi var_sks1=$(ps x | grep "udpvpn"|grep -v grep > /dev/null && echo -e "\033[1;32m♦ " || echo -e "\033[1;31m○ ") echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mACTIVATE BADVPN(Port 7300) $var_sks1 \033[0m" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mOPEN THE PORT\033[0m" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32m◇ WHAT DO YOU WANT TO DO \033[1;33m?\033[1;37m " read resposta if [[ "$resposta" = '1' ]]; then if ps x | grep -w udpvpn | grep -v grep 1>/dev/null 2>/dev/null; then clear echo -e "\E[41;1;37m BADVPN \E[0m" echo "" fun_stopbad () { sleep 1 for pidudpvpn in $(screen -ls | grep ".udpvpn" | awk {'print $1'}); do screen -r -S "$pidudpvpn" -X quit done [[ $(grep -wc "udpvpn" /etc/autostart) != '0' ]] && { sed -i '/udpvpn/d' /etc/autostart } sleep 1 screen -wipe >/dev/null } echo -e "\033[1;32m◇ DISABLING BADVPN\033[1;33m" echo "" fun_stopbad echo "" echo -e "\033[1;32m◇ BADVPN SUCCESSFULLY DISABLED!\033[1;33m" sleep 3 fun_badvpn else clear echo -e "\033[1;32m◇ STARTING BADVPN... \033[0m\n" fun_udpon () { screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 10000 --max-connections-for-client 8 [[ $(grep -wc "udpvpn" /etc/autostart) = '0' ]] && { echo -e "ps x | grep 'udpvpn' | grep -v 'grep' || screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 10000 --max-connections-for-client 8 --client-socket-sndbuf 10000" >> /etc/autostart } || { sed -i '/udpvpn/d' /etc/autostart echo -e "ps x | grep 'udpvpn' | grep -v 'grep' || screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 10000 --max-connections-for-client 8 --client-socket-sndbuf 10000" >> /etc/autostart } sleep 1 } inst_udp () { [[ -e "/bin/badvpn-udpgw" ]] && { sleep 0.1 } || { cd $HOME wget https://github.com/januda-ui/DRAGON-VPS-MANAGER/raw/main/Modulos/badvpn-udpgw -o /dev/null mv -f $HOME/badvpn-udpgw /bin/badvpn-udpgw chmod 777 /bin/badvpn-udpgw } } echo "" inst_udp fun_udpon echo "" echo -e "\033[1;32m◇ SUCCESSFULLY ACTIVATED BADVPN\033[1;33m" sleep 3 fun_badvpn fi elif [[ "$resposta" = '2' ]]; then if ps x | grep -w udpvpn | grep -v grep 1>/dev/null 2>/dev/null; then clear echo -e "\E[44;1;37m BADVPN \E[0m" echo "" echo -ne "\033[1;32m◇ WHICH PORT YOU WANT TO USE \033[1;33m?\033[1;37m: " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31m◇ Invalid port!" sleep 2 clear menu } echo "" echo -e "\033[1;32m◇ STARTING BADVPN AT THE PORT \033[1;31m$porta\033[1;33m" echo "" fun_abrirptbad() { sleep 1 screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:$porta --max-clients 10000 --max-connections-for-client 8 sleep 1 } fun_abrirptbad echo "" echo -e "\033[1;32m◇ SUCCESSFULLY ACTIVATED BADVPN\033[1;33m" sleep 2 fun_badvpn else clear echo -e "\033[1;31m◇ UNAVAILABLE FUNCTION\n\n\033[1;33mACTIVATE BADVPN FIRST!\033[1;33m" sleep 2 fun_badvpn fi elif [[ "$resposta" = '0' ]]; then echo "" echo -e "\033[1;31m◇ Returning...\033[0m" sleep 1 menu else echo "" echo -e "\033[1;31m◇ Invalid option!\033[0m" sleep 1 fun_badvpn fi } fun_badvpn ================================================ FILE: Modulos/banner ================================================ #!/bin/bash clear chk=$(cat /etc/ssh/sshd_config | grep Banner) [[ $(netstat -nltp|grep 'dropbear' | wc -l) != '0' ]] && { local="/etc/bannerssh" [[ $(grep -wc $local /etc/default/dropbear) = '0' ]] && echo 'DROPBEAR_BANNER="/etc/bannerssh"' >> /etc/default/dropbear } [[ "$(echo "$chk" | grep -v '#Banner' | grep Banner)" != "" ]] && { local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}') } || { local="/etc/bannerssh" [[ $(grep -wc $local /etc/ssh/sshd_config) = '0' ]] && echo "Banner /etc/bannerssh" >> /etc/ssh/sshd_config } echo -e "\E[44;1;37m ㅤ🐉ㅤBANNER MANAGERㅤ🐉ㅤ \E[0m" echo "" echo -e "\033[1;32m◇───MANUAL BANNER ADDING METHOD───◇" echo -e "\033[1;37m◇ Step 1:- Press CTRL+C and sendㅤ👇ㅤ" echo -e "\033[1;31msudo nano /etc/bannerssh" echo -e "\033[1;37m◇ PASTE YOUR BANNER AS A HTML TEXT" echo -e "\033[1;37m◇ Step 2:- Press CTRL+O enter CTRL+X" echo "" echo -e "\033[1;32m Or" echo "" echo -e "\033[1;32m◇───EASY BANNER ADDING METHOD───◇" echo -e "\033[1;31m[\033[1;36m1\033[1;31m]\033[1;37m • \033[1;33mADD BANNER" echo -e "\033[1;31m[\033[1;36m2\033[1;31m]\033[1;37m • \033[1;33mREMOVE BANNER" echo -e "\033[1;31m[\033[1;36m3\033[1;31m]\033[1;37m • \033[1;33mCOME BACK" echo "" echo -ne "\033[1;32m◇ WHAT DO YOU WANT TO DO\033[1;31m ?\033[1;37m : "; read resp if [[ "$resp" = "1" ]]; then echo "" echo -ne "\033[1;32m◇ WHICH MESSAGE DO YOU WANT TO DISPLAY\033[1;31m ?\033[1;37m : "; read msg1 if [[ -z "$msg1" ]]; then echo -e "\n\033[1;31m◇ Empty or invalid field!\033[0m" sleep 2 banner fi echo -e "\n\033[1;31m[\033[1;36m01\033[1;31m]\033[1;33m SMALL FONT SIZE" echo -e "\033[1;31m[\033[1;36m02\033[1;31m]\033[1;33m AVERAGE FONT SIZE" echo -e "\033[1;31m[\033[1;36m03\033[1;31m]\033[1;33m LARGE FONT SIZE" echo -e "\033[1;31m[\033[1;36m04\033[1;31m]\033[1;33m GIANT FONT SIZE" echo "" echo -ne "\033[1;32m◇ WHAT IS THE FONT SIZE\033[1;31m ?\033[1;37m : "; read opc if [[ "$opc" = "1" ]] || [[ "$opc" = "01" ]]; then _size='6' elif [[ "$opc" = "2" ]] || [[ "$opc" = "02" ]]; then _size='4' elif [[ "$opc" = "3" ]] || [[ "$opc" = "03" ]]; then _size='3' elif [[ "$opc" = "4" ]] || [[ "$opc" = "04" ]]; then _size='1' fi echo -e "\n\033[1;31m[\033[1;36m01\033[1;31m]\033[1;33m BLUE" echo -e "\033[1;31m[\033[1;36m02\033[1;31m]\033[1;33m GREEN" echo -e "\033[1;31m[\033[1;36m03\033[1;31m]\033[1;33m RED" echo -e "\033[1;31m[\033[1;36m04\033[1;31m]\033[1;33m YELLOW" echo -e "\033[1;31m[\033[1;36m05\033[1;31m]\033[1;33m PINK" echo -e "\033[1;31m[\033[1;36m06\033[1;31m]\033[1;33m CYAN" echo -e "\033[1;31m[\033[1;36m07\033[1;31m]\033[1;33m ORANGE" echo -e "\033[1;31m[\033[1;36m08\033[1;31m]\033[1;33m PURPLE" echo -e "\033[1;31m[\033[1;36m09\033[1;31m]\033[1;33m BLACK" echo -e "\033[1;31m[\033[1;36m10\033[1;31m]\033[1;33m NO COLOR" echo "" echo -ne "\033[1;32m◇ WHAT'S THE COLOR\033[1;31m ?\033[1;37m : "; read ban_cor if [[ "$ban_cor" = "1" ]] || [[ "$ban_cor" = "01" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "2" ]] || [[ "$ban_cor" = "02" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "3" ]] || [[ "$ban_cor" = "03" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "4" ]] || [[ "$ban_cor" = "04" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "5" ]] || [[ "$ban_cor" = "05" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "6" ]] || [[ "$ban_cor" = "06" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "7" ]] || [[ "$ban_cor" = "07" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "8" ]] || [[ "$ban_cor" = "08" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "9" ]] || [[ "$ban_cor" = "09" ]]; then echo "$msg1" >> $local elif [[ "$ban_cor" = "10" ]]; then echo "$msg1" >> $local /etc/init.d/ssh restart > /dev/null 2>&1 echo -e "\n\033[1;32m◇ BANNER ADDED!\033[0m" sleep 2 menu else echo -e "\n\033[1;31m◇ Invalid option!\033[0m" sleep 2 banner fi echo "" >> $local service ssh restart > /dev/null 2>&1 && service dropbear restart > /dev/null 2>&1 echo -e "\n\033[1;32m◇ BANNER ADDED!\033[0m" unset ban_cor elif [[ "$resp" = "2" ]]; then echo " " > $local echo -e "\n\033[1;32m◇ BANNER DELETED!\033[0m" service ssh restart > /dev/null 2>&1 && service dropbear restart > /dev/null 2>&1 sleep 2 menu elif [[ "$resp" = "3" ]]; then menu else echo -e "\n\033[1;31m◇ Invalid option!\033[0m" sleep 2 banner fi ================================================ FILE: Modulos/blockt ================================================ #!/bin/bash clear IP=$(wget -qO- ipv4.icanhazip.com) arq="/etc/Plus-torrent" echo -e "\E[44;1;37m ㅤ🐉ㅤTORRENT BLOCK FIREWALLㅤ🐉ㅤ \E[0m" echo "" if [[ -e "$arq" ]]; then fun_fireoff () { iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT iptables -t mangle -F iptables -t mangle -X iptables -t nat -F iptables -t nat -X iptables -t filter -F iptables -t filter -X iptables -F iptables -X rm $arq sleep 3 } fun_spn1 () { helice () { fun_fireoff > /dev/null 2>&1 & tput civis while [ -d /proc/$! ] do for i in / - \\ \| do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo -ne "\033[1;31m◇ REMOVING FIREWALL\033[1;32m.\033[1;33m.\033[1;31m. \033[1;32m" helice echo -e "\e[1DOk" } read -p "$(echo -e "\033[1;32m◇ WANT TO REMOVE FIREWALL RULES? \033[1;33m[s/n]:\033[1;37m") " -e -i n resp if [[ "$resp" = 's' ]]; then echo "" fun_spn1 echo "" echo -e "\033[1;33m◇ TORRENT RELEASED!\033[0m" echo "" echo -e "\033[1;32m◇ SUCCESSFULLY REMOVED FIREWALL !" echo "" if [[ -e /etc/openvpn/openvpn-status.log ]]; then echo -e "\033[1;31m[\033[1;33m!\033[1;31m]\033[1;33m◇ RESTART THE SYSTEM TO COMPLETE" echo "" read -p "$(echo -e "\033[1;32m◇ RESTART NOW \033[1;31m? \033[1;33m[s/n]:\033[1;37m ")" -e -i s respost echo "" if [[ "$respost" = 's' ]]; then echo -ne "\033[1;31m◇ Restarting" for i in $(seq 1 1 5); do echo -n "." sleep 01 echo -ne "" done reboot fi fi sleep 2 menu else sleep 1 menu fi else echo -e "\033[1;31m[\033[1;33m!\033[1;31m]\033[1;33m BETA FUNCTION USE AT YOUR OWN RISK" echo "" read -p "$(echo -ne "\033[1;32m◇ WISH TO APPLY FIREWALL RULES ? \033[1;33m[s/n]:\033[1;37m") " -e -i n resp if [[ "$resp" = 's' ]]; then echo "" echo -ne "\033[1;33m◇ TO CONTINUE CONFIRM YOUR IP: \033[1;37m"; read -e -i $IP IP if [[ -z "$IP" ]];then echo "" echo -e "\033[1;31m◇ Invalid IP\033[1;32m" sleep 1 echo "" read -p "◇ Enter your IP: " IP fi echo "" sleep 1 fun_fireon () { mportas () { unset portas portas_var=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN") while read port; do var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}') [[ "$(echo -e $portas|grep "$var1 $var2")" ]] || portas+="$var1 $var2\n" done <<< "$portas_var" i=1 echo -e "$portas" } [[ $(iptables -h|wc -l) -lt 5 ]] && apt-get install iptables -y > /dev/null 2>-1 NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) echo 'iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT' > $arq echo 'iptables -A OUTPUT -p tcp --dport 53 -m state --state NEW -j ACCEPT iptables -A OUTPUT -p udp --dport 53 -m state --state NEW -j ACCEPT' >> $arq echo 'iptables -A OUTPUT -p tcp --dport 67 -m state --state NEW -j ACCEPT iptables -A OUTPUT -p udp --dport 67 -m state --state NEW -j ACCEPT' >> $arq list_ips=$(mportas|awk '{print $2}') while read PORT; do echo "iptables -A INPUT -p tcp --dport $PORT -j ACCEPT iptables -A INPUT -p udp --dport $PORT -j ACCEPT iptables -A OUTPUT -p tcp --dport $PORT -j ACCEPT iptables -A OUTPUT -p udp --dport $PORT -j ACCEPT iptables -A FORWARD -p tcp --dport $PORT -j ACCEPT iptables -A FORWARD -p udp --dport $PORT -j ACCEPT iptables -A OUTPUT -p tcp -d $IP --dport $PORT -m state --state NEW -j ACCEPT iptables -A OUTPUT -p udp -d $IP --dport $PORT -m state --state NEW -j ACCEPT" >> $arq done <<< "$list_ips" echo 'iptables -A INPUT -p icmp --icmp-type echo-request -j DROP' >> $arq echo 'iptables -A INPUT -p tcp --dport 10000 -j ACCEPT iptables -A OUTPUT -p tcp --dport 10000 -j ACCEPT' >> $arq echo "iptables -t nat -A PREROUTING -i $NIC -p tcp --dport 6881:6889 -j DNAT --to-dest $IP iptables -A FORWARD -p tcp -i $NIC --dport 6881:6889 -d $IP -j REJECT iptables -A OUTPUT -p tcp --dport 6881:6889 -j DROP iptables -A OUTPUT -p udp --dport 6881:6889 -j DROP" >> $arq echo 'iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROP iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROP iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP iptables -A FORWARD -m string --algo bm --string "torrent" -j DROP iptables -A FORWARD -m string --algo bm --string "announce" -j DROP iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROP iptables -A FORWARD -m string --string "get_peers" --algo bm -j DROP iptables -A FORWARD -m string --string "announce_peer" --algo bm -j DROP iptables -A FORWARD -m string --string "find_node" --algo bm -j DROP' >> $arq sleep 2 chmod +x $arq /etc/Plus-torrent > /dev/null } fun_spn2 () { helice () { fun_fireon > /dev/null 2>&1 & tput civis while [ -d /proc/$! ] do for i in / - \\ \| do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo -ne "\033[1;32m◇ APPLYING FIREWALL\033[1;32m.\033[1;33m.\033[1;31m. \033[1;32m" helice echo -e "\e[1D◇ DONE." } fun_spn2 echo "" echo -e "\033[1;33m◇ TORRENT\033[1;37m BLOCK \033[1;33mAPPLIED!\033[0m" echo "" echo -e "\033[1;32m◇ FIREWALL SUCCESSFULLY APPLIED!" sleep 3 menu else sleep 1 menu fi fi ================================================ FILE: Modulos/bot ================================================ #!/bin/bash [[ ! -d /etc/VPSManager ]] && exit 0 [[ ! -d /etc/bot ]] && exit 0 source ShellBot.sh api_bot=$1 id_admin=$2 [[ -z $api_bot ]] && exit 0 [[ -z $id_admin ]] && exit 0 [[ ! -e /usr/lib/licence ]] && exit 0 ativos='/etc/bot/lista_ativos' suspensos='/etc/bot/lista_suspensos' ShellBot.init --token "$api_bot" --monitor --return map --flush ShellBot.username fun_menu() { [[ "${message_from_id[$id]}" == "$id_admin" ]] && { local env_msg env_msg="◈──────────────────◈\n" env_msg+="🐉 DRAGON VPS MANAGER BOT 🐉\n" env_msg+="◈──────────────────◈\n\n" env_msg+="⚠️ SELECT AN OPTION BELOW!\n\n" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} --text "$env_msg" \ --reply_markup "$keyboard1" \ --parse_mode html return 0 } [[ -d /etc/bot/suspensos/${message_from_username} ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "🚫 YOU ARE SUSPENDED 🚫\n\nCONTACT THE ADMINISTRATOR")" return 0 } if [[ "$(grep -w "${message_from_username}" $ativos | grep -wc 'revenda')" != '0' ]]; then local env_msg env_msg="◈──────────────────◈\n" env_msg+="🐉 DRAGON VPS MANAGER BOT 🐉\n" env_msg+="◈──────────────────◈\n\n" env_msg+="⚠️ SELECT AN OPTION BELOW!\n\n" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} --text "$env_msg" \ --reply_markup "$keyboard1" \ --parse_mode html return 0 elif [[ "$(grep -w "${message_from_username}" $ativos | grep -wc 'subrevenda')" != '0' ]]; then local env_msg env_msg="◈──────────────────◈\n" env_msg+="🐉 DRAGON VPS MANAGER BOT 🐉\n" env_msg+="◈──────────────────◈\n\n" env_msg+="⚠️ SELECT AN OPTION BELOW!\n\n" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} --text "$env_msg" \ --reply_markup "$keyboard1" \ --parse_mode html return 0 else ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 fi } fun_ajuda() { [[ ${message_chat_id[$id]} == "" ]] && { id_chatuser="${callback_query_message_chat_id[$id]}" id_name="${callback_query_from_username}" } || { id_chatuser="${message_chat_id[$id]}" id_name="${message_from_username}" } if [[ "$id_chatuser" = "$id_admin" ]]; then local env_msg env_msg="◈──────────────────◈\n" env_msg+="🐉 DRAGON VPS MANAGER BOT 🐉\n" env_msg+="◈──────────────────◈\n\n" env_msg+="⚠️ Available Commands\n\n" env_msg+="[01] /menu = Display menu\n" env_msg+="[02] /info = Display information\n" env_msg+="[03] /help = Information about options\n\n" env_msg+="⚠️ Available Options\n\n" env_msg+="• CREATE USER = Create ssh user\n\n" env_msg+="• CREATE TEST = Create ssh test\n\n" env_msg+="• REMOVE = Remove ssh user\n\n" env_msg+="• USER INFO = User Information\n\n" env_msg+="• ONLINE USERS = Display Online Users\n\n" env_msg+="• VPS INFO = Server Information\n\n" env_msg+="• CHANGE PASSWORD = Change ssh password\n\n" env_msg+="• CHANGE LIMIT = Change ssh limit\n\n" env_msg+="• CHANGE DATE = Change date ssh\n\n" env_msg+="• EXPIRED = Remove expired ssh\n\n" env_msg+="• BACKUP = Create ssh Backup and resellers\n\n" env_msg+="• OPTIMIZE = Clear cache - ram\n\n" env_msg+="• SPEEDTEST = Connection test\n\n" env_msg+="• FILES = Host Files\n\n" env_msg+="• RESALE = Manage Resellers\n\n" env_msg+="• AUTOBACKUP = On/Off Automatic Backup\n\n" env_msg+="• REPORT = Information about resellers\n\n" env_msg+="• HELP = Information about options\n\n" ShellBot.sendMessage --chat_id $id_chatuser \ --text "$(echo -e $env_msg)" \ --parse_mode html ShellBot.sendMessage --chat_id $id_chatuser \ --text "$(echo -e ✅ All Tutorials , Updates : @DRAGON_VPS_MANAGER)" return 0 elif [[ -d /etc/bot/suspensos/$id_name ]]; then ShellBot.sendMessage --chat_id $id_chatuser \ --text "$(echo -e "🚫 YOU ARE SUSPENDED 🚫\n\nCONTACT THE ADMINISTRATOR")" ShellBot.sendSticker --chat_id $id_chatuser \ --sticker "CAACAgEAAxkBAAEDbIdhrlBIJ-fUNJHXn-g352lK26WtBQACYgEAAgkeUEUw-f8AAZo7VDciBA" return 0 elif [[ "$(grep -w "$id_name" $ativos | awk '{print $NF}')" == 'revenda' ]]; then local env_msg env_msg="◈──────────────────◈\n" env_msg+="🐉 DRAGON VPS MANAGER BOT 🐉\n" env_msg+="◈──────────────────◈\n\n" env_msg+="⚠️ Available Commands\n\n" env_msg+="[01] /menu = Display menu\n" env_msg+="[02] /info = Display information\n" env_msg+="[03] /help = Information about options\n\n" env_msg+="⚠️ Available Options\n\n" env_msg+="• CREATE USER = Create ssh user\n\n" env_msg+="• CREATE TEST = Create ssh test\n\n" env_msg+="• REMOVE = Remove ssh user\n\n" env_msg+="• USER INFO = User Information\n\n" env_msg+="• ONLINE USERS = Display Online Users\n\n" env_msg+="• CHANGE PASSWORD = Change ssh password\n\n" env_msg+="• CHANGE LIMIT = Change ssh limit\n\n" env_msg+="• CHANGE DATE = Change date ssh\n\n" env_msg+="• EXPIRED = Remove expired ssh\n\n" env_msg+="• RESALE = Manage Resellers\n\n" env_msg+="• REPORT = Information about resellers\n\n" env_msg+="• HELP = Information about options\n\n" ShellBot.sendMessage --chat_id $id_chatuser \ --text "$(echo -e $env_msg)" \ --parse_mode html ShellBot.sendMessage --chat_id $id_chatuser \ --text "$(echo -e ✅ All Tutorials , Updates : @DRAGON_VPS_MANAGER)" return 0 elif [[ "$(grep -w "$id_name" $ativos | awk '{print $NF}')" == 'subrevenda' ]]; then local env_msg env_msg="◈──────────────────◈\n" env_msg+="🐉 DRAGON VPS MANAGER BOT 🐉\n" env_msg+="◈──────────────────◈\n\n" env_msg+="⚠️ Available Commands\n\n" env_msg+="[01] /menu = display menu\n" env_msg+="[02] /info = Display information\n" env_msg+="[03] /help = Information about options\n\n" env_msg+="⚠️ Available Options\n\n" env_msg+="• CREATE USER = Create ssh user\n\n" env_msg+="• CREATE TEST = Create ssh test\n\n" env_msg+="• REMOVE = Remove ssh user\n\n" env_msg+="• USER INFO = User information\n\n" env_msg+="• ONLINE USERS = Display users online\n\n" env_msg+="• CHANGE PASSWORD = Change ssh password\n\n" env_msg+="• CHANGE LIMIT = Change ssh limit\n\n" env_msg+="• CHANGE DATE = Change ssh date\n\n" env_msg+="• EXPIRED = Remove expired ssh\n\n" env_msg+="• HELP = Information about options\n\n" ShellBot.sendMessage --chat_id $id_chatuser \ --text "$(echo -e $env_msg)" \ --parse_mode html ShellBot.sendMessage --chat_id $id_chatuser \ --text "✅ All Tutorials , Updates : @DRAGON_VPS_MANAGER" return 0 else ShellBot.sendMessage --chat_id $id_chatuser \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" ShellBot.sendSticker --chat_id $id_chatuser \ --sticker "CAACAgEAAxkBAAEDbIdhrlBIJ-fUNJHXn-g352lK26WtBQACYgEAAgkeUEUw-f8AAZo7VDciBA" return 0 fi } verifica_acesso() { [[ "${message_from_id[$id]}" != "$id_admin" ]] && { [[ "$(grep -wc ${message_from_username} $suspensos)" != '0' ]] || [[ "$(grep -wc ${message_from_username} $ativos)" == '0' ]] && { _erro="1" return 0 } } } fun_adduser() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "👤 CREATE USER 👤\n\nUsername:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } criar_user() { IP=$(cat /etc/IP) newclient() { cp /etc/openvpn/client-common.txt ~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/ca.crt >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/private/$1.key >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/ta.key >>~/$1.ovpn echo "" >>~/$1.ovpn } file_user=$1 usuario=$(sed -n '1 p' $file_user | cut -d' ' -f2) senha=$(sed -n '2 p' $file_user | cut -d' ' -f2) limite=$(sed -n '3 p' $file_user | cut -d' ' -f2) data=$(sed -n '4 p' $file_user | cut -d' ' -f2) validade=$(echo "$data" | awk -F'/' '{print $2FS$1FS$3}' | xargs -i date -d'{}' +%Y/%m/%d) useradd -M -N -s /bin/false $usuario -e $validade >/dev/null 2>&1 ( echo "${senha}" echo "${senha}" ) | passwd "${usuario}" >/dev/null 2>&1 [[ "${message_from_id[$id]}" != "$id_admin" ]] && { echo "$usuario:$senha:$info_data:$limite" >/etc/bot/revenda/${message_from_username}/usuarios/$usuario echo "$usuario:$senha:$info_data:$limite" >/etc/bot/info-users/$usuario } echo "$usuario $limite" >>/root/usuarios.db echo "$senha" >/etc/VPSManager/senha/$usuario [[ -e "/etc/openvpn/server.conf" ]] && { cd /etc/openvpn/easy-rsa/ ./easyrsa build-client-full $usuario nopass newclient "$usuario" } } fun_deluser() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "🗑 REMOVE USER 🗑\n\nUsername:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } fun_del_user() { usuario=$1 [[ "${message_from_id[$id]}" = "$id_admin" ]] && { piduser=$(ps -u "$usuario" | grep sshd | cut -d? -f1) kill -9 $piduser >/dev/null 2>&1 userdel --force "$usuario" 2>/dev/null grep -v ^$usuario[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db rm /etc/VPSManager/senha/$usuario >/dev/null 2>&1 } || { [[ ! -e /etc/bot/revenda/${message_from_username}/usuarios/$usuario ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ THE USER DOES NOT EXIST ❌")" \ --parse_mode html _erro='1' return 0 } piduser=$(ps -u "$usuario" | grep sshd | cut -d? -f1) kill -9 $piduser >/dev/null 2>&1 userdel --force "$usuario" 2>/dev/null grep -v ^$usuario[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db rm /etc/VPSManager/senha/$usuario >/dev/null 2>&1 rm /etc/bot/revenda/${message_from_username}/usuarios/$usuario rm /etc/bot/info-users/$usuario } [[ -e /etc/VPSManager/userteste/$usuario.sh ]] && rm /etc/VPSManager/userteste/$usuario.sh [[ -e "/etc/openvpn/easy-rsa/pki/private/$usuario.key" ]] && { [[ -e /etc/debian_version ]] && GROUPNAME=nogroup cd /etc/openvpn/easy-rsa/ ./easyrsa --batch revoke $usuario ./easyrsa gen-crl rm -rf pki/reqs/$usuario.req rm -rf pki/private/$usuario.key rm -rf pki/issued/$usuario.crt rm -rf /etc/openvpn/crl.pem cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem chown nobody:$GROUPNAME /etc/openvpn/crl.pem [[ -e $HOME/$usuario.ovpn ]] && rm $HOME/$usuario.ovpn >/dev/null 2>&1 } } alterar_senha() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "🔐 Change Password 🔐\n\nUsername:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } alterar_senha_user() { usuario=$1 senha=$2 echo "$usuario:$senha" | chpasswd echo "$senha" >/etc/VPSManager/senha/$usuario [[ -e /etc/bot/revenda/${message_from_username}/usuarios/$usuario ]] && { senha2=$(cat /etc/bot/revenda/${message_from_username}/usuarios/$usuario | awk -F : {'print $2'}) sed -i "/$usuario/ s/\b$senha2\b/$senha/g" /etc/bot/revenda/${message_from_username}/usuarios/$usuario sed -i "/$usuario/ s/\b$senha2\b/$senha/g" /etc/bot/info-users/$usuario } [[ $(ps -u $usuario | grep sshd | wc -l) != '0' ]] && pkill -u $usuario >/dev/null 2>&1 } alterar_limite() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "👥 Change Limit 👥\n\nUsername:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } alterar_limite_user() { usuario=$1 limite=$2 database="/root/usuarios.db" [[ "${message_from_id[$id]}" == "$id_admin" ]] && { grep -v ^$usuario[[:space:]] /root/usuarios.db >/tmp/a mv /tmp/a /root/usuarios.db echo $usuario $limite >>/root/usuarios.db return 0 } [[ -d /etc/bot/revenda/${message_from_username} ]] && { [[ ! -e /etc/bot/revenda/${message_from_username}/usuarios/$usuario ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ THE USER DOES NOT EXIST ❌")" \ --parse_mode html _erro='1' return 0 } _limTotal=$(grep -w 'LIMITE_REVENDA' /etc/bot/revenda/${message_from_username}/${message_from_username} | awk '{print $NF}') [[ "$limite" -gt "$_limTotal" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ YOU HAVE NO ENOUGH LIMIT ❌\n\nCurrent Limit: $_limTotal ")" \ --parse_mode html _erro='1' return 0 } _limTotal=$(grep -w "${message_from_username}" $ativos | awk '{print $4}') fun_verif_limite_rev ${message_from_username} _limsomarev2=$(echo "$_result + $limite" | bc) echo "Total $_limsomarev2" [[ "$_limsomarev2" -gt "$_limTotal" ]] && { [[ "$_limTotal" == "$(($_limTotal - $_result))" ]] && _restant1='0' || _restant1=$(($_limTotal - $_result)) ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ You don't have enough limit\n\nRemaining limit: $_restant1 ")" \ --parse_mode html _erro='1' return 0 } grep -v ^$usuario[[:space:]] /root/usuarios.db >/tmp/a mv /tmp/a /root/usuarios.db echo $usuario $limite >>/root/usuarios.db limite2=$(cat /etc/bot/revenda/${message_from_username}/usuarios/$usuario | awk -F : {'print $4'}) sed -i "/\b$usuario\b/ s/\b$limite2\b/$limite/" /etc/bot/revenda/${message_from_username}/usuarios/$usuario sed -i "/\b$usuario\b/ s/\b$limite2\b/$limite/" /etc/bot/info-users/$usuario } } alterar_data() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "⏳ Change Date ⏳\n\nUsername:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } alterar_data_user() { usuario=$1 inputdate=$2 database="/root/usuarios.db" [[ "$(echo -e "$inputdate" | sed -e 's/[^/]//ig')" != '//' ]] && { udata=$(date "+%d/%m/%Y" -d "+$inputdate days") sysdate="$(echo "$udata" | awk -v FS=/ -v OFS=- '{print $3,$2,$1}')" } || { udata=$(echo -e "$inputdate") sysdate="$(echo -e "$inputdate" | awk -v FS=/ -v OFS=- '{print $3,$2,$1}')" today="$(date -d today +"%Y%m%d")" timemachine="$(date -d "$sysdate" +"%Y%m%d")" [ $today -ge $timemachine ] && { verify='1' ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error! Invalid date")" \ --parse_mode html _erro='1' return 0 } } chage -E $sysdate $usuario [[ -e /etc/bot/revenda/${message_from_username}/usuarios/$usuario ]] && { data2=$(cat /etc/bot/info-users/$usuario | awk -F : {'print $3'}) sed -i "s;$data2;$udata;" /etc/bot/info-users/$usuario echo $usuario $udata ${message_from_username} sed -i "s;$data2;$udata;" /etc/bot/revenda/${message_from_username}/usuarios/$usuario } } ver_users() { if [[ "${callback_query_from_id[$id]}" == "$id_admin" ]]; then arq_info=/tmp/$(echo $RANDOM) local info_users info_users='◈──────────────────◈\n' info_users+='USER INFORMATION\n' info_users+='◈──────────────────◈\n\n' info_users+='⚠️ Displays in the format below:\n\n' info_users+='USER PASSWORD DATE LIMIT\n' ShellBot.sendMessage --chat_id $id_admin \ --text "$(echo -e $info_users)" \ --parse_mode html fun_infu() { local info for user in $(cat /etc/passwd | awk -F : '$3 >= 1000 {print $1}' | grep -v nobody); do info='◈──────────────────◈\n' [[ -e /etc/VPSManager/senha/$user ]] && senha=$(cat /etc/VPSManager/senha/$user) || senha='Null' [[ $(grep -wc $user $HOME/usuarios.db) != '0' ]] && limite=$(grep -w $user $HOME/usuarios.db | cut -d' ' -f2) || limite='Null' datauser=$(chage -l $user | grep -i co | awk -F : '{print $2}') [[ $datauser = ' never' ]] && { data="00/00/00" } || { databr="$(date -d "$datauser" +"%Y%m%d")" hoje="$(date -d today +"%Y%m%d")" [[ $hoje -ge $databr ]] && { data="Venceu" } || { dat="$(date -d"$datauser" '+%Y-%m-%d')" data=$(echo -e "$((($(date -ud $dat +%s) - $(date -ud $(date +%Y-%m-%d) +%s)) / 86400)) DIAS") } } info+="$user • $senha • $limite • $data" echo -e "$info" done } fun_infu >$arq_info while :; do ShellBot.sendMessage --chat_id $id_admin \ --text "$(while read linha; do echo $linha; done < <(sed '1,30!d' $arq_info))" \ --parse_mode html sed -i 1,30d $arq_info [[ $(cat $arq_info | wc -l) = '0' ]] && rm $arq_info && break done elif [[ "$(grep -wc "${callback_query_from_username}" $ativos)" != '0' ]]; then [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ $(ls /etc/bot/revenda/${callback_query_from_username}/usuarios | wc -l) == '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "YOU HASN'T CREATED USER YET!" return 0 } arq_info=/tmp/$(echo $RANDOM) local info_users info_users='◈──────────────────◈\n' info_users+='USER INFORMATION\n' info_users+='◈──────────────────◈\n\n' info_users+='⚠️ Displays in the format below:\n\n' info_users+='USER PASSWORD DATE LIMIT\n' ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e $info_users)" \ --parse_mode html fun_infu() { local info for user in $(ls /etc/bot/revenda/${callback_query_from_username}/usuarios); do info='◈──────────────────◈\n' [[ -e /etc/VPSManager/senha/$user ]] && senha=$(cat /etc/VPSManager/senha/$user) || senha='Null' [[ $(grep -wc $user $HOME/usuarios.db) != '0' ]] && limite=$(grep -w $user $HOME/usuarios.db | cut -d' ' -f2) || limite='Null' datauser=$(chage -l $user | grep -i co | awk -F : '{print $2}') [[ $datauser = ' never' ]] && { data="00/00/00" } || { databr="$(date -d "$datauser" +"%Y%m%d")" hoje="$(date -d today +"%Y%m%d")" [[ $hoje -ge $databr ]] && { data="Venceu" } || { dat="$(date -d"$datauser" '+%Y-%m-%d')" data=$(echo -e "$((($(date -ud $dat +%s) - $(date -ud $(date +%Y-%m-%d) +%s)) / 86400)) DIAS") } } info+="$user • $senha • $limite • $data" echo -e "$info" done } fun_infu >$arq_info while :; do ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(while read linha; do echo $linha; done < <(sed '1,30!d' $arq_info))" \ --parse_mode html sed -i 1,30d $arq_info [[ $(cat $arq_info | wc -l) = '0' ]] && rm $arq_info && break done else ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 fi } fun_drop() { port_dropbear=$(ps aux | grep dropbear | awk NR==1 | awk '{print $17;}') log=/var/log/auth.log loginsukses='Password auth succeeded' pids=$(ps ax | grep dropbear | grep " $port_dropbear" | awk -F" " '{print $1}') for pid in $pids; do pidlogs=$(grep $pid $log | grep "$loginsukses" | awk -F" " '{print $3}') i=0 for pidend in $pidlogs; do let i=i+1 done if [ $pidend ]; then login=$(grep $pid $log | grep "$pidend" | grep "$loginsukses") PID=$pid user=$(echo $login | awk -F" " '{print $10}' | sed -r "s/'/ /g") waktu=$(echo $login | awk -F" " '{print $2"-"$1,$3}') while [ ${#waktu} -lt 13 ]; do waktu=$waktu" " done while [ ${#user} -lt 16 ]; do user=$user" " done while [ ${#PID} -lt 8 ]; do PID=$PID" " done echo "$user $PID $waktu" fi done } monitor_ssh() { if [[ "${callback_query_from_id[$id]}" == "$id_admin" ]]; then database="/root/usuarios.db" cad_onli=/tmp/$(echo $RANDOM) local info_on info_on='◈──────────────────◈\n' info_on+='ONLINES USERS MONITOR\n' info_on+='◈──────────────────◈\n\n' info_on+='⚠️ Displays in the format below:\n\n' info_on+='ONLIN USERE/TIME LIMIT\n' ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e $info_on)" \ --parse_mode html fun_online() { local info2 for user in $(cat /etc/passwd | awk -F : '$3 >= 1000 {print $1}' | grep -v nobody); do [[ "$(grep -w $user $database)" != "0" ]] && lim="$(grep -w $user $database | cut -d' ' -f2)" || lim=0 [[ $(netstat -nltp | grep 'dropbear' | wc -l) != '0' ]] && drop="$(fun_drop | grep "$user" | wc -l)" || drop=0 [[ -e /etc/openvpn/openvpn-status.log ]] && ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$user", | wc -l)" || ovp=0 sqd="$(ps -u $user | grep sshd | wc -l)" _cont=$(($drop + $ovp)) conex=$(($_cont + $sqd)) [[ $conex -gt '0' ]] && { timerr="$(ps -o etime $(ps -u $user | grep sshd | awk 'NR==1 {print $1}') | awk 'NR==2 {print $1}')" info2+="◈──────────────────◈\n" info2+="🟢 $user $conex/$lim ⏳$timerr\n" } done echo -e "$info2" } fun_online >$cad_onli [[ $(cat $cad_onli | wc -w) != '0' ]] && { while :; do ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(while read linha; do echo $linha; done < <(sed '1,30!d' $cad_onli))" \ --parse_mode html sed -i 1,30d $cad_onli [[ "$(cat $cad_onli | wc -l)" = '0' ]] && { rm $cad_onli break } done } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "Nenhum usuario online" \ --parse_mode html return 0 } elif [[ "$(grep -wc "${callback_query_from_username}" $ativos)" != '0' ]]; then [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ $(ls /etc/bot/revenda/${callback_query_from_username}/usuarios | wc -l) == '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "YOU HASN'T CREATED USER YET!" return 0 } database="/root/usuarios.db" cad_onli=/tmp/$(echo $RANDOM) local info_on info_on='◈──────────────────◈\n' info_on+='ONLINES USERS MONITOR\n' info_on+='◈──────────────────◈\n\n' info_on+='⚠️ Displays in the format below:\n\n' info_on+='ONLINE USER/TIME LIMIT\n' ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e $info_on)" \ --parse_mode html fun_online() { local info2 for user in $(ls /etc/bot/revenda/${callback_query_from_username}/usuarios); do [[ "$(grep -w $user $database)" != "0" ]] && lim="$(grep -w $user $database | cut -d' ' -f2)" || lim=0 [[ $(netstat -nltp | grep 'dropbear' | wc -l) != '0' ]] && drop="$(fun_drop | grep "$user" | wc -l)" || drop=0 [[ -e /etc/openvpn/openvpn-status.log ]] && ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$user", | wc -l)" || ovp=0 sqd="$(ps -u $user | grep sshd | wc -l)" conex=$(($sqd + $ovp + $drop)) [[ $conex -gt '0' ]] && { timerr="$(ps -o etime $(ps -u $user | grep sshd | awk 'NR==1 {print $1}') | awk 'NR==2 {print $1}')" info2+="------------------------------\n" info2+="👤$user $conex/$lim ⏳$timerr\n" } done echo -e "$info2" } fun_online >$cad_onli [[ $(cat $cad_onli | wc -w) != '0' ]] && { while :; do ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(while read linha; do echo $linha; done < <(sed '1,30!d' $cad_onli))" \ --parse_mode html sed -i 1,30d $cad_onli [[ "$(cat $cad_onli | wc -l)" = '0' ]] && { rm $cad_onli break } done } || { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "No users online" \ --parse_mode html return 0 } else ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 fi } fun_verif_user() { user=$1 [[ -z "$user" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Error")" \ --parse_mode html return 0 } [[ "${message_from_id[$id]}" == "$id_admin" ]] && { [[ "$(awk -F : '$3 >= 1000 { print $1 }' /etc/passwd | grep -wc $user)" == '0' ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e ❌ THE USER $user DOES NOT EXIST !)" \ --parse_mode html _erro='1' return 0 } } [[ -d /etc/bot/revenda/${message_from_username} ]] && { [[ ! -e /etc/bot/revenda/${message_from_username}/usuarios/$user ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e ❌ THE USER $user DOES NOT EXIST !)" \ --parse_mode html _erro='1' return 0 } } } fun_down() { [[ "${callback_query_from_id[$id]}" != "$id_admin" ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } [[ ! -d /tmp/file ]] && mkdir /tmp/file ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "[1] - ADD FILE\n[2] - DELETE FILE\n\nInform the option [1-2]:" \ --reply_markup "$(ShellBot.ForceReply)" } infovps() { [[ "${callback_query_from_id[$id]}" != "$id_admin" ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 } PTs='/tmp/prts' _ons=$(ps -x | grep sshd | grep -v root | grep priv | wc -l) [[ -e /etc/openvpn/openvpn-status.log ]] && _onop=$(grep -c "10.8.0" /etc/openvpn/openvpn-status.log) || _onop="0" [[ -e /etc/default/dropbear ]] && _drp=$(ps aux | grep dropbear | grep -v grep | wc -l) _ondrp=$(($_drp - 1)) || _ondrp="0" _on=$(($_ons + $_onop + $_ondrp)) total=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) system=$(cat /etc/issue.net) uso=$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }') cpucores=$(grep -c cpu[0-9] /proc/stat) ram1=$(free -h | grep -i mem | awk {'print $2'}) usoram=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }') total=$(cat -n /root/usuarios.db | tail -n 1 | awk '{print $1}') echo -e "SSH: $(grep 'Port' /etc/ssh/sshd_config | cut -d' ' -f2 | grep -v 'no' | xargs)" >$PTs [[ -e "/etc/stunnel/stunnel.conf" ]] && echo -e "SSL Tunel: $(netstat -nplt | grep 'stunnel' | awk {'print $4'} | cut -d: -f2 | xargs)" >>$PTs [[ -e "/etc/openvpn/server.conf" ]] && echo -e "Openvpn: $(netstat -nplt | grep 'openvpn' | awk {'print $4'} | cut -d: -f2 | xargs)" >>$PTs [[ "$(netstat -nplt | grep 'sslh' | wc -l)" != '0' ]] && echo -e "SSlh: $(netstat -nplt | grep 'sslh' | awk {'print $4'} | cut -d: -f2 | xargs)" >>$PTs [[ "$(netstat -nplt | grep 'squid' | wc -l)" != '0' ]] && echo -e "Squid: $(netstat -nplt | grep 'squid' | awk -F ":" {'print $4'} | xargs)" >>$PTs [[ "$(netstat -nltp | grep 'dropbear' | wc -l)" != '0' ]] && echo -e "DropBear: $(netstat -nplt | grep 'dropbear' | awk -F ":" {'print $4'} | xargs)" >>$PTs [[ "$(netstat -nplt | grep 'python' | wc -l)" != '0' ]] && echo -e "Proxy Socks: $(netstat -nplt | grep 'python' | awk {'print $4'} | cut -d: -f2 | xargs)" >>$PTs local info info="◈──────────────────◈\n" info+="SERVER INFORMATION\n" info+="◈──────────────────◈\n\n" info+="OPERATING SYSTEM\n" info+="$system\n\n" info+="PROCESSOR\n" info+="cores: $cpucores\n" info+="use: $uso\n\n" info+="RAM MEMORY\n" info+="Total: $ram1\n" info+="use: $usoram\n\n" while read linha; do info+="$(echo -e "$linha")\n" done < <(cat $PTs) info+="\n$total USERS $_on ONLINE" ShellBot.sendMessage --chat_id $id_admin \ --text "$(echo -e $info)" \ --parse_mode html return 0 } fun_download() { Opc=$1 [[ -z "$Opc" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ error try again")" _erro='1' return 0 } _file2=$2 [[ -z "$_file2" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ error try again")" _erro='1' return 0 } _DirArq=$(ls /etc/bot/arquivos) i=0 unset _Pass while read _Arq; do i=$(expr $i + 1) _oP=$i [[ $i == [1-9] ]] && i=0$i && oP+=" 0$i" echo -e "[$i] - $_Arq" _Pass+="\n${_oP}:${_Arq}" done <<<"${_DirArq}" _file=$(echo -e "${_Pass}" | grep -E "\b$Opc\b" | cut -d: -f2) echo $_file2 ShellBot.sendDocument --chat_id ${message_from_id[$id]} \ --document "@/etc/bot/arquivos/$_file" \ --caption "$(echo -e "=====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n=====================================\n\n◈─────⪧ IMPORTANT ⪦──────◈\n\n◈⪧ 🚫 NO SPAM\n◈⪧ ⚠️ NO DDOS\n◈⪧ 🎭 NO Hacking\n◈⪧ ⛔️ NO Carding\n◈⪧ 🙅‍♂️ NO Torrent\n◈⪧ ❌ NO MultiLogin\n◈⪧ 🤷‍♂️ NO Illegal Activities\n\n◈─────⪧ SSH ACCOUNT ⪦─────◈\n\n◈ Username :⪧ $(awk -F " " '/Nome/ {print $2}' $_file2)\n◈ Password :⪧ $(awk -F " " '/Senha/ {print $2}' $_file2)\n◈ Login Limit :⪧ $(awk -F " " '/Limite/ {print $2}' $_file2)\n◈ Expire Date :⪧ $(awk -F " " '/Validade/ {print $2}' $_file2)\n\n◈──────⪧ PORTS ⪦ ───────◈\n\n◈ SSH ⌁ 22\n◈ SSL ⌁ 443\n◈ Squid ⌁ 8080\n◈ DropBear ⌁ 80\n◈ BadVPN ⌁ 7300\n\n◈───⪧ONLINE USER COUNT⪦────◈ \n\nhttp://$(cat /etc/IP):8888/server/online\n\n◈──────────────────◈\n\n©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉\n◈──────────────────◈")" \ --parse_mode html [[ -e "/root/$(awk -F " " '/Nome/ {print $2}' $_file2).ovpn" ]] && { ShellBot.sendDocument --chat_id ${message_from_id[$id]} \ --document "@/root/$(awk -F " " '/Nome/ {print $2}' $_file2).ovpn" } } otimizer() { [[ "${callback_query_from_id[$id]}" != "$id_admin" ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 } MEM1=$(free | awk '/Mem:/ {print int(100*$3/$2)}') ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🧹 LEARING SERVER CACHE" apt-get autoclean -y echo 3 >/proc/sys/vm/drop_caches sync && sysctl -w vm.drop_caches=3 1>/dev/null 2>/dev/null sysctl -w vm.drop_caches=0 1>/dev/null 2>/dev/null swapoff -a swapon -a ram1=$(free -h | grep -i mem | awk {'print $2'}) ram2=$(free -h | grep -i mem | awk {'print $3'}) ram3=$(free -h | grep -i mem | awk {'print $4'}) MEM2=$(free | awk '/Mem:/ {print int(100*$3/$2)}') res=$(expr $MEM1 - $MEM2) local sucess sucess="◈──────────────────◈\n" sucess+="SUCCESSFULLY OPTIMIZED!\n" sucess+="◈──────────────────◈\n\n" sucess+="Previous use $MEM1%\n\n" sucess+="Total Ram Memory $ram1\n" sucess+="free $ram3\n" sucess+="In use $ram2\n" sucess+="current use $MEM2%\n\n" sucess+="Saving: $res%" ShellBot.sendMessage --chat_id $id_admin \ --text "$(echo -e $sucess)" \ --parse_mode html return 0 } speed_test() { [[ "${callback_query_from_id[$id]}" != "$id_admin" ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 } rm -rf $HOME/speed >/dev/null 2>&1 ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚀 TESTING SERVER SPEED" speedtest --share >speed png=$(cat speed | sed -n '5 p' | awk -F : {'print $NF'}) down=$(cat speed | sed -n '7 p' | awk -F : {'print $NF'}) upl=$(cat speed | sed -n '9 p' | awk -F : {'print $NF'}) lnk=$(cat speed | sed -n '10 p' | awk {'print $NF'}) local msg msg="◈──────────────────◈\n" msg+="🚀 SERVER SPEED 🚀\n" msg+="◈──────────────────◈\n\n" msg+="PING/LATENCY:$png\n" msg+="DOWNLOAD:$down\n" msg+="UPLOAD:$upl\n" ShellBot.sendMessage --chat_id $id_admin \ --text "$(echo -e $msg)" \ --parse_mode html ShellBot.sendMessage --chat_id $id_admin \ --text "$(echo -e $lnk)" \ --parse_mode html rm -rf $HOME/speed >/dev/null 2>&1 return 0 } backup_users() { [[ "${callback_query_from_id[$id]}" != "$id_admin" ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 } rm /root/backup.vps 1>/dev/null 2>/dev/null ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "♻️ CREATING USER BACKUP" tar cvf /root/backup.vps /root/usuarios.db /etc/shadow /etc/passwd /etc/group /etc/gshadow /etc/bot /etc/VPSManager/senha 1>/dev/null 2>/dev/null ShellBot.sendDocument --chat_id ${id_admin} \ --document "@/root/backup.vps" \ --caption "$(echo -e "♻️ USER BACKUP ♻️")" return 0 } sobremim() { local msg msg="◈──────────────────◈\n" msg+="🐉 DRAGON VPS MANAGER 🐉\n" msg+="◈──────────────────◈\n\n" msg+="Developed by: @Dragon_vps_manager\n" msg+="Official channel: @Dragon_vps_manager\n\n" msg+="I was created with the purpose of providing information and tools for VPN management on 🐧 GNU/Linux 🐧 servers.\n\n" msg+="Menu: /menu\n" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e $msg)" \ --parse_mode html return 0 } fun_add_teste() { if [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]]; then ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 elif [[ "${callback_query_from_id[$id]}" == "$id_admin" ]]; then ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "👤 CREATE TEST 👤\n\nhow many hours should it last EX: 1:" \ --reply_markup "$(ShellBot.ForceReply)" elif [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]]; then _limTotal=$(grep -w "${callback_query_from_username}" $ativos | awk '{print $4}') fun_verif_limite_rev ${callback_query_from_username} _limsomarev2=$(echo "$_result + 1" | bc) [[ "$_limsomarev2" -gt "$_limTotal" ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "❌ You have NO LIMIT AVAILABLE!" return 0 } || { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "👤 CREATE TEST 👤\n\nhow many hours should it last EX: 1:" \ --reply_markup "$(ShellBot.ForceReply)" } else ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 fi } fun_teste() { usuario=$(echo TESTE$((RANDOM % +500))) senha='1234' limite='1' t_time=$1 ex_date=$(date '+%d/%m/%C%y' -d " +2 days") tuserdate=$(date '+%C%y/%m/%d' -d " +2 days") [[ -z $t_time ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ error try again")" \ --parse_mode html return 0 _erro='1' } useradd -M -N -s /bin/false $usuario -e $tuserdate >/dev/null 2>&1 ( echo "$senha" echo "$senha" ) | passwd $usuario >/dev/null 2>&1 echo "$senha" >/etc/VPSManager/senha/$usuario echo "$usuario $limite" >>/root/usuarios.db [[ "${message_from_id[$id]}" != "$id_admin" ]] && { echo "$usuario:$senha:$ex_date:$limite" >/etc/bot/revenda/${message_from_username}/usuarios/$usuario } dir_teste="/etc/bot/revenda/${message_from_username}/usuarios/$usuario" cat <<-EOF >/etc/VPSManager/userteste/$usuario.sh #!/bin/bash # USUARIO TESTE [[ \$(ps -u "$usuario" | grep -c sshd) != '0' ]] && pkill -u $usuario userdel --force $usuario grep -v ^$usuario[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db [[ -e $dir_teste ]] && rm $dir_teste rm /etc/VPSManager/senha/$usuario > /dev/null 2>&1 rm /etc/VPSManager/userteste/$usuario.sh EOF chmod +x /etc/VPSManager/userteste/$usuario.sh echo "/etc/VPSManager/userteste/$usuario.sh" | at now + $t_time hour >/dev/null 2>&1 [[ "$t_time" == '1' ]] && hrs="hora" || hrs="horas" [[ "$(ls /etc/bot/arquivos | wc -l)" != '0' ]] && { for arqv in $(ls /etc/bot/arquivos); do ShellBot.sendDocument --chat_id ${message_from_id[$id]} \ --document "@/etc/bot/arquivos/$arqv" \ --caption "$(echo -e "====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n====================================\n\n◈─────⪧ IMPORTANT ⪦──────◈\n\n◈⪧ 🚫 NO SPAM\n◈⪧ ⚠️ NO DDOS\n◈⪧ 🎭 NO Hacking\n◈⪧ ⛔️ NO Carding\n◈⪧ 🙅‍♂️ NO Torrent\n◈⪧ ❌ NO MultiLogin\n◈⪧ 🤷‍♂️ NO Illegal Activities\n\n◈─────⪧TEST SSH ACCOUNT ⪦─────◈\n\n◈ Username :⪧ $usuario\n◈ Password :⪧ 1234\n◈ Expire at :⪧ $t_time $hrs / Hours \n\n◈──────⪧ PORTS ⪦ ───────◈\n\n◈ SSH ⌁ 22\n◈ SSL ⌁ 443\n◈ Squid ⌁ 8080\n◈ DropBear ⌁ 80\n◈ BadVPN ⌁ 7300\n\n◈───⪧ONLINE USER COUNT⪦────◈ \n\nhttp://$(cat /etc/IP):8888/server/online\n\n◈──────────────────◈\n\n©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉\n◈──────────────────◈")" \ --parse_mode html done return 0 } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n====================================\n\n◈─────⪧ IMPORTANT ⪦──────◈\n\n◈⪧ 🚫 NO SPAM\n◈⪧ ⚠️ NO DDOS\n◈⪧ 🎭 NO Hacking\n◈⪧ ⛔️ NO Carding\n◈⪧ 🙅‍♂️ NO Torrent\n◈⪧ ❌ NO MultiLogin\n◈⪧ 🤷‍♂️ NO Illegal Activities\n\n◈────⪧TEST SSH ACCOUNT ⪦────◈\n\n◈ Host / IP :⪧ $(cat /etc/IP)\n◈ Username :⪧ $usuario\n◈ Password :⪧ 1234\n◈ Expire at :⪧ $t_time $hrs / Hours \n\n◈──────⪧ PORTS ⪦ ───────◈\n\n◈ SSH ⌁ 22\n◈ SSL ⌁ 443\n◈ Squid ⌁ 8080\n◈ DropBear ⌁ 80\n◈ BadVPN ⌁ 7300\n\n◈───⪧ONLINE USER COUNT⪦────◈ \n\nhttp://$(cat /etc/IP):8888/server/online\n\n◈──────────────────◈\n\n©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉\n◈──────────────────◈")" \ --parse_mode html return 0 } } fun_exp_user() { if [[ "${callback_query_from_id[$id]}" == "$id_admin" ]]; then [[ $(cat /root/usuarios.db | wc -l) == '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "YOU HASN'T CREATED USER YET!" return 0 } datenow=$(date +%s) for user in $(cat /etc/passwd | awk -F : '$3 >= 1000 {print $1}' | grep -v nobody); do expdate=$(chage -l $user | awk -F: '/Account expires/{print $2}') echo $expdate | grep -q never && continue datanormal=$(date -d"$expdate" '+%d/%m/%Y') expsec=$(date +%s --date="$expdate") diff=$(echo $datenow - $expsec | bc -l) echo $diff | grep -q ^\- && continue pkill -u $user userdel --force $user grep -v ^$user[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db [[ -e /etc/bot/info-users/$user ]] && rm /etc/bot/info-users/$user [[ -e /etc/VPSManager/userteste/$user.sh ]] && rm /etc/VPSManager/userteste/$user.sh [[ "$(ls /etc/bot/revenda)" != '0' ]] && { for ex in $(ls /etc/bot/revenda); do [[ -e /etc/bot/revenda/$exp/usuarios/$user ]] && rm /etc/bot/revenda/$ex/usuarios/$user done } done ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⌛️ EXPIRED SSH USERS REMOVED" return 0 elif [[ "$(grep -wc "${callback_query_from_username}" $ativos)" != '0' ]]; then [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ $(ls /etc/bot/revenda/${callback_query_from_username}/usuarios | wc -l) == '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "YOU HASN'T CREATED USER YET!" return 0 } datenow=$(date +%s) dir_user="/etc/bot/revenda/${callback_query_from_username}/usuarios" for user in $(ls $dir_user); do expdate=$(chage -l $user | awk -F: '/Account expires/{print $2}') echo $expdate | grep -q never && continue datanormal=$(date -d"$expdate" '+%d/%m/%Y') expsec=$(date +%s --date="$expdate") diff=$(echo $datenow - $expsec | bc -l) echo $diff | grep -q ^\- && continue pkill -f $user userdel --force $user grep -v ^$user[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db [[ -e /etc/VPSManager/userteste/$user.sh ]] && rm /etc/VPSManager/userteste/$user.sh [[ -e "$dir_user/$user" ]] && rm $dir_user/$user done ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⌛️ EXPIRED SSH USERS REMOVED" return 0 else ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 fi } relatorio_rev() { if [[ "${callback_query_from_id[$id]}" = "$id_admin" ]]; then _ons=$(ps -x | grep sshd | grep -v root | grep priv | wc -l) _tuser=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) [[ -e /etc/openvpn/openvpn-status.log ]] && _onop=$(grep -c "10.8.0" /etc/openvpn/openvpn-status.log) || _onop="0" [[ -e /etc/default/dropbear ]] && _drp=$(ps aux | grep dropbear | grep -v grep | wc -l) _ondrp=$(($_drp - 1)) || _ondrp="0" _onli=$(($_ons + $_onop + $_ondrp)) _cont_rev=$(echo $(grep -wc revenda $ativos) - $(grep -wc revenda $suspensos) | bc) _cont_sus=$(grep -wc revenda $suspensos) _cont_sub=$(grep -wc subrevenda $ativos) _cont_revt=$(grep -wc revenda $ativos) local msg msg="◈──────────────────◈\n" msg+="📊 REPORT | INFORMATION\n" msg+="◈──────────────────◈\n\n" msg+="Total users: $_tuser\n" msg+="Online users: $_onli\n" msg+="Active Resellers: $_cont_rev\n" msg+="Suspended Resellers: $_cont_sus\n" msg+="Sub-Resales: $_cont_sub\n\n" msg+="Username: @${callback_query_from_username}\n" msg+="ID: ${callback_query_from_id}\n" [[ $_cont_revt != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "📊 CREATING REPORT!" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ NO DEALER FOUND !" return 0 } echo -e "RETAILER'S REPORT\n\nTotal: $_cont_revt - $(printf 'Data: %(%d/%m/%Y)T\n')\n◈──────────────────◈" >/tmp/Relatorio.txt while read _revlist; do _nome_rev="$(echo $_revlist | awk '{print $2}')" _limite_rev="$(echo $_revlist | awk '{print $4}')" _data_rev="$(echo $_revlist | awk '{print $6}')" [[ -e "/etc/bot/revenda/$_nome_rev/$_nome_rev" ]] && { _dirsts='revenda' _status='Active' } || { _dirsts='suspensos' _status='Suspended' } _subrev="$(grep -wc SUBREVENDA /etc/bot/$_dirsts/$_nome_rev/$_nome_rev)" fun_on() { for user in $(ls /etc/bot/$_dirsts/$_nome_rev/usuarios); do [[ $(netstat -nltp | grep 'dropbear' | wc -l) != '0' ]] && drop="$(fun_drop | grep "$user" | wc -l)" || drop=0 [[ -e /etc/openvpn/openvpn-status.log ]] && ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$user", | wc -l)" || ovp=0 sqd="$(ps -u $user | grep sshd | wc -l)" conex=$(($sqd + $ovp + $drop)) echo -e "$conex" done } [[ "$(ls /etc/bot/$_dirsts/$_nome_rev/usuarios | wc -l)" != '0' ]] && { total_on=$(fun_on | paste -s -d + | bc) total_users=$(ls /etc/bot/$_dirsts/$_nome_rev/usuarios | wc -l) } || { total_on='0' total_users='0' } echo -e "\nSTATUS: $_status\nDEALER: @$_nome_rev\nLIMIT: $_limite_rev\nDAYS REMAINING: $_data_rev\nSSH CREATED: $total_users\nSSH ONLINE: $total_on\nSUB-RESALE: $_subrev\n\n◈──────────────────◈" >>/tmp/Relatorio.txt done <<<"$(grep -w 'revenda' $ativos)" ShellBot.sendDocument --chat_id $id_admin \ --document "@/tmp/Relatorio.txt" \ --caption "$(echo -e "$msg")" \ --parse_mode html return 0 elif [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]]; then [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ $(grep -wc 'SUBREVENDA' /etc/bot/revenda/${callback_query_from_username}/${callback_query_from_username}) == '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ NO SUB DEALER FOUND !" _cont_limite=$(grep -w ${callback_query_from_username} $ativos | awk '{print $4}') fun_verif_limite_rev ${callback_query_from_username} _cont_disp=$(echo $_cont_limite - $_result | bc) local msg msg="◈──────────────────◈\n" msg+="📊 REPORT | INFORMATION\n" msg+="◈──────────────────◈\n\n" msg+="Login Limit: $_cont_limite\n" msg+="Available Limit: $_cont_disp\n" ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$msg" \ --parse_mode html return 0 } fun_contsub() { while read _sublist; do _usub="$(echo $_sublist | awk '{print $2}')" echo $(grep -wc $_usub $suspensos) done <<<"$(grep -w 'SUBREVENDA' /etc/bot/revenda/${callback_query_from_username}/${callback_query_from_username})" } _cont_limite=$(grep -w ${callback_query_from_username} $ativos | awk '{print $4}') fun_verif_limite_rev ${callback_query_from_username} _cont_disp=$(echo $_cont_limite - $_result | bc) _cont_atv=$(grep -wc SUBREVENDA /etc/bot/revenda/${callback_query_from_username}/${callback_query_from_username}) _cont_sup=$(fun_contsub | paste -s -d + | bc) local msg msg="◈──────────────────◈\n" msg+="📊 REPORT | INFORMATION\n" msg+="◈──────────────────◈\n\n" msg+="Login Limit: $_cont_limite\n" msg+="Available Limit: $_cont_disp\n" msg+="Total Sub-Resales: $_cont_atv\n" msg+="Suspended Sub-Resales: $_cont_sup\n" msg+="Username: @${callback_query_from_username}\n" msg+="ID: ${callback_query_from_id}\n" echo -e "LIST OF SUB-SELLERS\n\nTotal: $_cont_atv - $(printf 'Data: %(%d/%m/%Y)T\n')\n◈──────────────────◈" >/tmp/Relatorio-${callback_query_from_username}.txt while read _sublist; do _usub="$(echo $_sublist | awk '{print $2}')" _limit_sub=$(echo $_sublist | awk '{print $4}') _data_sub=$(grep -w $_usub $ativos | awk '{print $6}') [[ -e "/etc/bot/revenda/$_usub/$_usub" ]] && { _dirsts='revenda' _status='Ativo' } || { _dirsts='suspensos' _status='Suspenso' } fun_subon() { for user in $(ls /etc/bot/$_dirsts/$_usub/usuarios); do [[ $(netstat -nltp | grep 'dropbear' | wc -l) != '0' ]] && drop="$(fun_drop | grep "$user" | wc -l)" || drop=0 [[ -e /etc/openvpn/openvpn-status.log ]] && ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$user", | wc -l)" || ovp=0 sqd="$(ps -u $user | grep sshd | wc -l)" conex=$(($sqd + $ovp + $drop)) echo -e "$conex" done } [[ "$(ls /etc/bot/$_dirsts/$_usub/usuarios | wc -l)" != '0' ]] && { total_on=$(fun_on | paste -s -d + | bc) total_users=$(ls /etc/bot/$_dirsts/$_usub/usuarios | wc -l) } || { total_on='0' total_users='0' } echo -e "\nSTATUS: $_status\nSUB-DEALER: @$_usub\nLIMIT: $_limit_sub\nDAYS REMAINING: $_data_sub\nSSH CREATED: $total_users\nSSH ONLINE: $total_on\n\n◈──────────────────◈" >>/tmp/Relatorio-${callback_query_from_username}.txt done <<<"$(grep -w 'SUBREVENDA' /etc/bot/revenda/${callback_query_from_username}/${callback_query_from_username})" ShellBot.sendDocument --chat_id ${callback_query_message_chat_id[$id]} \ --document "@/tmp/Relatorio-${callback_query_from_username}.txt" \ --caption "$(echo -e "$msg")" \ --parse_mode html return 0 else ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 fi } fun_backauto() { [[ "${callback_query_from_id[$id]}" = "$id_admin" ]] && { [[ ! -d /etc/VPSManager/backups ]] && { mkdir /etc/VPSManager/backups [[ $(crontab -l | grep -c "userbackup") = '0' ]] && ( crontab -l 2>/dev/null echo "0 */6 * * * /bin/userbackup 1" ) | crontab - s ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "♻️ AUTOMATIC BACKUP ENABLED 🟢" return 0 } || { [[ $(crontab -l | grep -c "userbackup") != '0' ]] && crontab -l | grep -v 'userbackup' | crontab - [[ -d /etc/VPSManager/backups ]] && rm -rf /etc/VPSManager/backups ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "♻️ AUTOMATIC BACKUP DISABLED 🔴" return 0 } } } backup_auto() { ShellBot.sendDocument --chat_id $id_admin \ --document "@/etc/VPSManager/backups/backup.vps" \ --caption "$(echo -e "♻️ AUTOMATIC BACKUP ♻️")" rm /etc/VPSManager/backups/backup.vps return 0 } restaure_backup() { [[ ${message_from_id[$id]} == ${id_admin} ]] && { [[ "${message_document_file_name}" != 'backup.vps' ]] && return 0 local file_id file_id=${message_document_file_id[$id]} if [[ $file_id ]]; then [[ -e /tmp/backup.vps ]] && rm /tmp/backup.vps [[ "$(ls /tmp | grep -c '.vps')" != '0' ]] && { for i in $(ls /tmp | grep '.vps'); do rm /tmp/$i done } ShellBot.getFile --file_id $file_id if ShellBot.downloadFile --file_path "${return[file_path]}" --dir "/tmp"; then msg='♻️ BACKUP FILE ♻️\n\nThe uploaded file is a file\nuser backup!' ShellBot.sendMessage --chat_id ${id_admin} \ --text "$(echo -e "$msg")" \ --parse_mode html ShellBot.sendMessage --chat_id ${id_admin} \ --text 'Do you want to restore? [Yes | No]' \ --reply_markup "$(ShellBot.ForceReply)" fi fi return 0 } } msg_bem_vindo() { local msg msg="👋 Hello ${message_from_first_name[$id]} ! \n\n🤝 Welcome to\n" msg+="====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n====================================\n\n" msg+="To access the menu\nclick [ /menu ]\n\n" msg+="For information\nclick [ /help ]\n\n ✅ All Tutorials , Updates : @DRAGON_VPS_MANAGER" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e $msg)" \ --parse_mode html ShellBot.sendSticker --chat_id ${message_chat_id[$id]} \ --sticker "CAACAgIAAxkBAAEDZt1hqPwEyUPLlqUVp27340hwwsO8OAACugADMNSdEYTXxIjEUGdWIgQ" return 0 } fun_verif_limite_rev() { _userrev=$1 [[ "$(grep -w "$_userrev" $ativos | awk '{print $NF}')" == 'revenda' ]] && { echo $_userrev [[ $(grep -wc 'SUBREVENDA' /etc/bot/revenda/$_userrev/$_userrev) != '0' ]] && { _limsomarev=$(grep -w 'SUBREVENDA' /etc/bot/revenda/$_userrev/$_userrev | awk {'print $4'} | paste -s -d + | bc) } || { _limsomarev='0' } [[ $(ls /etc/bot/revenda/$_userrev/usuarios | wc -l) != '0' ]] && { _mlim1='0' _meus_users="/etc/bot/revenda/$_userrev/usuarios" for _user_ in $(ls $_meus_users); do _mlim2=$(cat $_meus_users/$_user_ | awk -F : {'print $4'}) _mlim1=$(echo "${_mlim1} + ${_mlim2}" | bc) done } [[ -z "$_mlim1" ]] && _mlim1='0' _result=$(echo "${_limsomarev} + ${_mlim1}" | bc) } [[ "$(grep -w "$_userrev" $ativos | awk '{print $NF}')" == 'subrevenda' ]] && { [[ "$(ls /etc/bot/revenda/$_userrev/usuarios | wc -l)" != '0' ]] && { _dir_users="/etc/bot/revenda/$_userrev/usuarios" _lim1='0' for i in $(ls $_dir_users); do _lim2=$(cat $_dir_users/$i | awk -F : {'print $4'}) _lim1=$(echo "${_lim1} + ${_lim2}" | bc) done } [[ -z "$_lim1" ]] && _lim1='0' _result=$(echo "${_lim1}") } } fun_add_revenda() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "👥 ADD DEALER 👥\n\nEnter the name:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } criar_rev() { file_rev=$1 [[ -z "$file_rev" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e Erro)" _erro='1' break } n_rev=$(sed -n '1 p' $file_rev | cut -d' ' -f2) u_rev=$(sed -n '2 p' $file_rev | awk -F '@' {'print $2'}) l_rev=$(sed -n '3 p' $file_rev | cut -d' ' -f2) d_rev=$(sed -n '4 p' $file_rev | cut -d' ' -f2) [[ "${message_from_id[$id]}" = "$id_admin" ]] && { t_rev='revenda' } || { t_rev='subrevenda' echo -e "SUBRESALE: $u_rev LIMIT_SUBRESALE: $l_rev" >>/etc/bot/revenda/${message_from_username}/${message_from_username} } mkdir /etc/bot/revenda/"$u_rev" mkdir /etc/bot/revenda/"$u_rev"/usuarios touch /etc/bot/revenda/"$u_rev"/$u_rev echo -e "USER: $u_rev LIMITE: $l_rev DIAS: $d_rev TIPO: $t_rev" >>$ativos echo -e "◈──────────────────◈\nLIMIT_RESALE: $l_rev\nDAYS_RESALE: $d_rev\n◈──────────────────◈\n" >/etc/bot/revenda/"$u_rev"/$u_rev sed -i '$d' $file_rev echo -e "Due date: $(date "+%d/%m/%Y" -d "+$d_rev days")" >>$file_rev } fun_del_rev() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "🗑 REMOVE DEALER 🗑\n\nInform his username [Ex: @Dragon_vps_manager]:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } del_rev() { _cli_rev=$1 [[ -z "$_cli_rev" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Erro")" return 0 } [[ "${message_from_id[$id]}" == "$id_admin" ]] && { [[ "$(grep -wc "$_cli_rev" $ativos)" != '0' ]] && { [[ -e "/etc/bot/revenda/$_cli_rev/$_cli_rev" ]] && _dirsts='revenda' || _dirsts='suspensos' [[ "$(grep -wc 'SUBREVENDA' /etc/bot/$_dirsts/$_cli_rev/$_cli_rev)" != '0' ]] && { while read _listsub2; do _usub="$(echo $_listsub2 | awk '{print $2}')" [[ -e "/etc/bot/revenda/$_usub/$_usub" ]] && _dirsts2='revenda' || _dirsts2='suspensos' _dir_users="/etc/bot/$_dirsts2/$_usub/usuarios" [[ "$(ls $_dir_users | wc -l)" != '0' ]] && { for _user in $(ls $_dir_users); do piduser=$(ps -u "$_user" | grep sshd | cut -d? -f1) kill -9 $piduser >/dev/null 2>&1 userdel --force "$_user" 2>/dev/null grep -v ^$_user[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db rm /etc/bot/info-users/$_user done } [[ -d /etc/bot/$_dirsts2/$_usub ]] && rm -rf /etc/bot/$_dirsts2/$_usub >/dev/null 2>&1 sed -i "/\b$_usub\b/d" $ativos [[ $(grep -wc "$_usub" $suspensos) != '0' ]] && { sed -i "/\b$_usub\b/d" $suspensos } done <<<"$(grep -w 'SUBREVENDA' /etc/bot/$_dirsts/$_cli_rev/$_cli_rev)" } [[ "$(ls /etc/bot/$_dirsts/$_cli_rev/usuarios | wc -l)" != '0' ]] && { for _user in $(ls /etc/bot/$_dirsts/$_cli_rev/usuarios); do piduser=$(ps -u "$_user" | grep sshd | cut -d? -f1) kill -9 $piduser >/dev/null 2>&1 userdel --force "$_user" 2>/dev/null grep -v ^$_user[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db rm /etc/bot/info-users/$_user done } [[ -d /etc/bot/$_dirsts/$_cli_rev ]] && rm -rf /etc/bot/$_dirsts/$_cli_rev >/dev/null 2>&1 sed -i "/\b$_cli_rev\b/d" $ativos [[ $(grep -wc "$_cli_rev" $suspensos) != '0' ]] && { sed -i "/\b$_cli_rev\b/d" $suspensos } ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "SUCCESSFULLY REMOVED")" \ --parse_mode html return 0 } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e ❌ DEALER DOES NOT EXIST ❌)" return 0 } } || { [[ "$(grep -wc "$_cli_rev" /etc/bot/revenda/${message_from_username}/${message_from_username})" != '0' ]] && { [[ -d /etc/bot/revenda/$_cli_rev ]] && { [[ "$(ls /etc/bot/revenda/$_cli_rev/usuarios | wc -l)" != '0' ]] && { for _user in $(ls /etc/bot/revenda/$_cli_rev/usuarios); do piduser=$(ps -u "$_user" | grep sshd | cut -d? -f1) kill -9 $piduser >/dev/null 2>&1 userdel --force "$_user" 2>/dev/null grep -v ^$_user[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db rm /etc/bot/info-users/$_user done } [[ -d /etc/bot/revenda/$_cli_rev ]] && rm -rf /etc/bot/revenda/$_cli_rev >/dev/null 2>&1 sed -i "/\b$_cli_rev\b/d" $ativos sed -i "/\b$_cli_rev\b/d" /etc/bot/revenda/${message_from_username}/${message_from_username} } [[ -d /etc/bot/suspensos/$_cli_rev ]] && { [[ "$(ls /etc/bot/suspensos/$_cli_rev/usuarios | wc -l)" != '0' ]] && { for _user in $(ls /etc/bot/suspensos/$_cli_rev/usuarios); do piduser=$(ps -u "$_user" | grep sshd | cut -d? -f1) kill -9 $piduser >/dev/null 2>&1 userdel --force "$_user" 2>/dev/null grep -v ^$_user[[:space:]] /root/usuarios.db >/tmp/ph cat /tmp/ph >/root/usuarios.db rm /etc/bot/info-users/$_user done } [[ -d /etc/bot/suspensos/$_cli_rev ]] && rm -rf /etc/bot/suspensos/$_cli_rev >/dev/null 2>&1 sed -i "/\b$_cli_rev\b/d" $ativos sed -i "/\b$_cli_rev\b/d" $suspensos sed -i "/\b$_cli_rev\b/d" /etc/bot/revenda/${message_from_username}/${message_from_username} } ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "SUCCESSFULLY REMOVED")" \ --parse_mode html return 0 } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e ❌ DEALER DOES NOT EXIST ❌)" return 0 } } } fun_lim_rev() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "♾ CHANGE RESALE LIMIT ♾\n\nInform his username [Ex: @Dragon_vps_manager]:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } lim_rev() { _file_lim=$1 [[ -z "$_file_lim" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Erro")" return 0 } _rev_usern=$(grep -w 'Revendedor' $_file_lim | awk -F '@' {'print $2'}) new_l=$(grep -w 'Limite' $_file_lim | awk {'print $2'}) [[ -d /etc/bot/revenda/$_rev_usern ]] && { l_old=$(grep -w 'LIMITE_REVENDA' /etc/bot/revenda/$_rev_usern/$_rev_usern | awk {'print $2'}) sed -i "/LIMITE_REVENDA/ s/$l_old/$new_l/g" /etc/bot/revenda/$_rev_usern/$_rev_usern sed -i "/$_rev_usern/ s/LIMITE: $l_old/LIMITE: $new_l/" $ativos [[ "${message_from_id[$id]}" != "$id_admin" ]] && { sed -i "/\b$_rev_usern\b/ s/$l_old/$new_l/g" /etc/bot/revenda/${message_from_username}/${message_from_username} } echo $_rev_usern } || { l_old=$(grep -w 'LIMITE_REVENDA' /etc/bot/suspensos/$_rev_usern/$_rev_usern | awk {'print $2'}) sed -i "/LIMITE_REVENDA/ s/$l_old/$new_l/g" /etc/bot/suspensos/$_rev_usern/$_rev_usern sed -i "/\b$_rev_usern\b/ s/LIMITE: $l_old/LIMITE: $new_l/" $ativos sed -i "/\b$_rev_usern\b/ s/LIMITE: $l_old/LIMITE: $new_l/" $suspensos [[ "${message_from_id[$id]}" != "$id_admin" ]] && { sed -i "/\b$_rev_usern\b/ s/$l_old/$new_l/" /etc/bot/revenda/${message_from_username}/${message_from_username} } echo $_rev_usern } } fun_dat_rev() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "📆 CHANGE RESALE DATE 📆\n\nInform his username [Ex: @Dragon_vps_manager]:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } dat_rev() { _datfile=$1 [[ -z "$_datfile" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Error")" _erro='1' return 0 } _revd=$(grep -w 'Revendedor' $_datfile | cut -d'@' -f2) new_d=$(grep -w 'Data' $_datfile | awk '{print $NF}') [[ -d "/etc/bot/suspensos/$_revd" ]] && { [[ "$(ls /etc/bot/suspensos/$_revd/usuarios | wc -l)" != '0' ]] && { for _user in $(ls /etc/bot/suspensos/$_revd/usuarios); do usermod -U $_user done } d_old=$(grep -w 'DIAS_REVENDA' /etc/bot/suspensos/$_revd/$_revd | awk {'print $2'}) sed -i "/\b$_revd\b/ s/DIAS: $d_old/DIAS: $new_d/" $ativos sed -i "/DIAS_REVENDA/ s/$d_old/$new_d/" /etc/bot/suspensos/$_revd/$_revd [[ "$(grep -wc 'SUBREVENDA' /etc/bot/suspensos/$_revd/$_revd)" != '0' ]] && { while read _listsub; do _usub="$(echo $_listsub | awk '{print $2}')" [[ "$(ls /etc/bot/suspensos/$_usub/usuarios | wc -l)" != '0' ]] && { for _user in $(ls /etc/bot/suspensos/$_usub/usuarios); do usermod -U $_user done } mv /etc/bot/suspensos/$_usub /etc/bot/revenda/$_usub sed -i "/\b$_usub\b/d" $suspensos done <<<"$(grep -w 'SUBREVENDA' /etc/bot/suspensos/$_revd/$_revd)" } mv /etc/bot/suspensos/$_revd /etc/bot/revenda/$_revd sed -i "/\b$_revd\b/d" $suspensos sed -i "s;$new_d;$(date "+%d/%m/%Y" -d "+$new_d days");" $_datfile ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "⚠️ $_revd IT WAS SUSPENDED AND WAS REACTIVATED !")" \ --parse_mode html } || { d_old=$(grep -w 'DIAS_REVENDA' /etc/bot/revenda/$_revd/$_revd | awk {'print $2'}) sed -i "/\b$_revd\b/ s/DIAS: $d_old/DIAS: $new_d/" $ativos sed -i "/DIAS_REVENDA/ s/$d_old/$new_d/" /etc/bot/revenda/$_revd/$_revd sed -i "s;$new_d;$(date "+%d/%m/%Y" -d "+$new_d days");" $_datfile } } fun_list_rev() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } if [[ "${callback_query_from_id[$id]}" == "$id_admin" ]]; then local msg1 msg1="◈──────────────────◈\n📃 RESELLERS LIST !\n◈──────────────────◈\n" [[ "$(grep -wc 'revenda' $ativos)" != '0' ]] && { while read _atvs; do _uativ="$(echo $_atvs | awk '{print $2}')" [[ "$(grep -wc "$_uativ" $suspensos)" == '0' ]] && _stsrev='ATIVO' || _stsrev='SUSPENSO' msg1+="• @$_uativ - $_stsrev\n" done <<<"$(grep -w 'revenda' /etc/bot/lista_ativos)" ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e "$msg1")" \ --parse_mode html return 0 } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "YOU DO NOT HAVE RESELLERS" return 0 } elif [[ "$(grep -w ${callback_query_from_username} $ativos | awk '{print $NF}')" == 'revenda' ]]; then _patch="/etc/bot/revenda" local msg1 msg1="◈──────────────────◈\n📃 LIST OF SUBSELLERS !\n◈──────────────────◈\n" [[ "$(grep -wc "SUBREVENDA" $_patch/${callback_query_from_username}/${callback_query_from_username})" != '0' ]] && { while read _listsub; do _usub="$(echo $_listsub | awk '{print $2}')" [[ "$(grep -wc "$_usub" $suspensos)" == '0' ]] && _usts='ACTIVE' || _usts='SUSPENDED' msg1+="• @$_usub - $_usts\n" done <<<"$(grep -w 'SUBREVENDA' $_patch/${callback_query_from_username}/${callback_query_from_username})" ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "$(echo -e "$msg1")" \ --parse_mode html return 0 } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "YOU DO NOT HAVE SUB RESELLERS" return 0 } else ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 fi } fun_susp_rev() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id[$id]} \ --text "🔒 SUSPEND DEALER 🔒\n\nInform his username [Ex: @Dragon_vps_manager]:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "🚫 ACCESS DENIED 🚫" return 0 } } susp_rev() { _revs=$1 [[ -z "$_revs" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Error")" return 0 } [[ -d "/etc/bot/suspensos/$_revs" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "THE USER IS ALREADY SUSPENDED !")" \ --parse_mode html return 0 } [[ ! -d "/etc/bot/revenda/$_revs" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "THE USER DOES NOT EXIST !")" \ --parse_mode html return 0 } [[ "${message_from_id[$id]}" == "$id_admin" ]] && { [[ "$(grep -wc 'SUBREVENDA' /etc/bot/revenda/$_revs/$_revs)" != '0' ]] && { while read _listsub3; do _usub3="$(echo $_listsub3 | awk '{print $2}')" _dir_users="/etc/bot/revenda/$_usub3/usuarios" [[ "$(ls $_dir_users | wc -l)" != '0' ]] && { for _user in $(ls $_dir_users); do usermod -L $_user pkill -f $_user done } mv /etc/bot/revenda/$_usub3 /etc/bot/suspensos/$_usub3 grep -w "$_usub3" $ativos >>$suspensos done <<<"$(grep -w 'SUBREVENDA' /etc/bot/revenda/$_revs/$_revs)" } [[ "$(ls /etc/bot/revenda/$_revs/usuarios | wc -l)" != '0' ]] && { for _user_ in $(ls /etc/bot/revenda/$_revs/usuarios); do usermod -L $_user_ pkill -f $_user_ done } mv /etc/bot/revenda/$_revs /etc/bot/suspensos/$_revs grep -w "$_revs" $ativos >>$suspensos ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "SUCCESSFULLY SUSPENDED")" \ --parse_mode html return 0 } || { [[ "$(grep -wc "$_revs" /etc/bot/revenda/${message_from_username}/${message_from_username})" != '0' ]] && { [[ "$(ls /etc/bot/revenda/$_revs/usuarios | wc -l)" != '0' ]] && { for _user_ in $(ls /etc/bot/revenda/$_revs/usuarios); do usermod -L $_user_ pkill -f $_user_ done } mv /etc/bot/revenda/$_revs /etc/bot/suspensos/$_revs grep -w "$_revs" $ativos >>$suspensos ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "SUCCESSFULLY SUSPENDED")" \ --parse_mode html return 0 } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "THE SUB DEALER DOES NOT EXIST")" \ --parse_mode html return 0 } } } infouserbot() { [[ $(grep -wc ${message_from_username} $ativos) != '0' ]] && { _cont_limite=$(grep -w ${message_from_username} $ativos | awk '{print $4}') fun_verif_limite_rev ${message_from_username} _cont_disp=$(echo $_cont_limite - $_result | bc) ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "NAME: ${message_from_first_name[$(ShellBot.ListUpdates)]}\nUSERNAME:" "@${message_from_username[$(ShellBot.ListUpdates)]:-null}")\nID: ${message_from_id[$(ShellBot.ListUpdates)]}\nACCESS: RESALE\nTOTAL LIMIT: $_cont_limite\nREMAINING LIMIT: $_cont_disp" \ --parse_mode html return 0 } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "NAME: ${message_from_first_name[$(ShellBot.ListUpdates)]}\nUSERNAME:" "@${message_from_username[$(ShellBot.ListUpdates)]:-null}")\nID: ${message_from_id[$(ShellBot.ListUpdates)]} " \ --parse_mode html ShellBot.sendSticker --chat_id ${message_chat_id[$id]} \ --sticker "CAACAgIAAxkBAAEDbJdhrlMi5WT2IvHUwY_3V9t-HQ_tUQACFgADwDZPE2Ah1y2iBLZnIgQ" return 0 } } fun_menurevenda() { [[ "$(grep -wc ${callback_query_from_username} $suspensos)" != '0' ]] && { ShellBot.answerCallbackQuery --callback_query_id ${callback_query_id[$id]} \ --text "⚠️ YOU ARE SUSPENDED! CONTACT THE ADMINISTRATOR" return 0 } [[ "${callback_query_from_id[$id]}" == "$id_admin" ]] || [[ "$(grep -wc ${callback_query_from_username} $ativos)" != '0' ]] && { ShellBot.editMessageText --chat_id ${callback_query_message_chat_id[$id]} \ --message_id ${callback_query_message_message_id[$id]} \ --text "SELECT AN OPTION BELOW:" \ --reply_markup "$(ShellBot.InlineKeyboardMarkup --button 'menu4')" return 0 } } # LISTA MENU ADMIN unset menu1 menu1='' ShellBot.InlineKeyboardButton --button 'menu1' --line 1 --text 'CREATE USER' --callback_data '_criaruser' ShellBot.InlineKeyboardButton --button 'menu1' --line 2 --text 'CREATE TEST' --callback_data '_criarteste' ShellBot.InlineKeyboardButton --button 'menu1' --line 3 --text 'REMOVE USER' --callback_data '_deluser' ShellBot.InlineKeyboardButton --button 'menu1' --line 4 --text 'CHANGE PASSWORD' --callback_data '_altsenha' ShellBot.InlineKeyboardButton --button 'menu1' --line 5 --text 'CHANGE LIMIT' --callback_data '_altlimite' ShellBot.InlineKeyboardButton --button 'menu1' --line 6 --text 'CHANGE DATE' --callback_data '_altdata' ShellBot.InlineKeyboardButton --button 'menu1' --line 7 --text 'ONLINE USERS' --callback_data '_monitor' ShellBot.InlineKeyboardButton --button 'menu1' --line 8 --text 'INFO USERS' --callback_data '_verusers' ShellBot.InlineKeyboardButton --button 'menu1' --line 9 --text 'EXPIRED' --callback_data '_expirados' ShellBot.InlineKeyboardButton --button 'menu1' --line 1 --text 'INFO VPS' --callback_data '_infovps' ShellBot.InlineKeyboardButton --button 'menu1' --line 2 --text 'OTIMIZAR' --callback_data '_otimizar' ShellBot.InlineKeyboardButton --button 'menu1' --line 3 --text 'FILES' --callback_data '_arqdown' ShellBot.InlineKeyboardButton --button 'menu1' --line 4 --text 'RESALE' --callback_data '_opcoesrev' ShellBot.InlineKeyboardButton --button 'menu1' --line 5 --text 'SPEEDTEST' --callback_data '_speedteste' ShellBot.InlineKeyboardButton --button 'menu1' --line 6 --text 'BACKUP USERS' --callback_data '_backupusers' ShellBot.InlineKeyboardButton --button 'menu1' --line 7 --text "AUTO BACKUP" --callback_data '_autobkp' ShellBot.InlineKeyboardButton --button 'menu1' --line 8 --text 'REPORT' --callback_data '_relatorio' ShellBot.InlineKeyboardButton --button 'menu1' --line 9 --text 'HELP' --callback_data '_ajuda' ShellBot.regHandleFunction --function fun_adduser --callback_data _criaruser ShellBot.regHandleFunction --function fun_add_teste --callback_data _criarteste ShellBot.regHandleFunction --function fun_deluser --callback_data _deluser ShellBot.regHandleFunction --function alterar_senha --callback_data _altsenha ShellBot.regHandleFunction --function alterar_limite --callback_data _altlimite ShellBot.regHandleFunction --function alterar_data --callback_data _altdata ShellBot.regHandleFunction --function fun_down --callback_data _arqdown ShellBot.regHandleFunction --function monitor_ssh --callback_data _monitor ShellBot.regHandleFunction --function ver_users --callback_data _verusers ShellBot.regHandleFunction --function fun_exp_user --callback_data _expirados ShellBot.regHandleFunction --function otimizer --callback_data _otimizar ShellBot.regHandleFunction --function speed_test --callback_data _speedteste ShellBot.regHandleFunction --function infovps --callback_data _infovps ShellBot.regHandleFunction --function backup_users --callback_data _backupusers ShellBot.regHandleFunction --function fun_backauto --callback_data _autobkp ShellBot.regHandleFunction --function relatorio_rev --callback_data _relatorio ShellBot.regHandleFunction --function fun_ajuda --callback_data _ajuda ShellBot.regHandleFunction --function fun_menurevenda --callback_data _opcoesrev unset keyboard1 keyboard1="$(ShellBot.InlineKeyboardMarkup -b 'menu1')" # LISTA MENU REVENDEDOR unset menu2 menu2='' ShellBot.InlineKeyboardButton --button 'menu2' --line 1 --text 'CREATE USER' --callback_data '_criaruser2' ShellBot.InlineKeyboardButton --button 'menu2' --line 1 --text 'CREATE TEST' --callback_data '_criarteste2' ShellBot.InlineKeyboardButton --button 'menu2' --line 2 --text 'REMOVE USER' --callback_data '_deluser2' ShellBot.InlineKeyboardButton --button 'menu2' --line 2 --text 'ONLINE USERS' --callback_data '_monitor2' ShellBot.InlineKeyboardButton --button 'menu2' --line 3 --text 'CHANGE LIMIT' --callback_data '_altlimite2' ShellBot.InlineKeyboardButton --button 'menu2' --line 3 --text 'USER INFO' --callback_data '_verusers2' ShellBot.InlineKeyboardButton --button 'menu2' --line 4 --text 'CHANGE PASSWORD' --callback_data '_altsenha2' ShellBot.InlineKeyboardButton --button 'menu2' --line 4 --text 'EXPIRED' --callback_data '_expirados2' ShellBot.InlineKeyboardButton --button 'menu2' --line 5 --text 'CHANGE DATE' --callback_data '_altdata2' ShellBot.InlineKeyboardButton --button 'menu2' --line 5 --text 'RESALE' --callback_data '_opcoesrev2' ShellBot.InlineKeyboardButton --button 'menu2' --line 6 --text 'REPORT' --callback_data '_relatorio2' ShellBot.InlineKeyboardButton --button 'menu2' --line 6 --text 'HELP' --callback_data '_ajuda2' ShellBot.regHandleFunction --function fun_adduser --callback_data _criaruser2 ShellBot.regHandleFunction --function fun_add_teste --callback_data _criarteste2 ShellBot.regHandleFunction --function fun_deluser --callback_data _deluser2 ShellBot.regHandleFunction --function alterar_senha --callback_data _altsenha2 ShellBot.regHandleFunction --function alterar_limite --callback_data _altlimite2 ShellBot.regHandleFunction --function alterar_data --callback_data _altdata2 ShellBot.regHandleFunction --function monitor_ssh --callback_data _monitor2 ShellBot.regHandleFunction --function ver_users --callback_data _verusers2 ShellBot.regHandleFunction --function fun_exp_user --callback_data _expirados2 ShellBot.regHandleFunction --function relatorio_rev --callback_data _relatorio2 ShellBot.regHandleFunction --function fun_menurevenda --callback_data _opcoesrev2 ShellBot.regHandleFunction --function fun_ajuda --callback_data _ajuda2 unset keyboard2 keyboard2="$(ShellBot.InlineKeyboardMarkup -b 'menu2')" #LISTA MUNU SUB REVENDEDOR unset menu3 menu3='' ShellBot.InlineKeyboardButton --button 'menu3' --line 1 --text 'CREATE USER' --callback_data '_criaruser3' ShellBot.InlineKeyboardButton --button 'menu3' --line 1 --text 'CREATE TEST' --callback_data '_criarteste3' ShellBot.InlineKeyboardButton --button 'menu3' --line 2 --text 'REMOVE USER' --callback_data '_deluser3' ShellBot.InlineKeyboardButton --button 'menu3' --line 2 --text 'ONLINE USERS' --callback_data '_monitor3' ShellBot.InlineKeyboardButton --button 'menu3' --line 3 --text 'CHANGE LIMIT' --callback_data '_altlimite3' ShellBot.InlineKeyboardButton --button 'menu3' --line 3 --text 'USER INFO' --callback_data '_verusers3' ShellBot.InlineKeyboardButton --button 'menu3' --line 4 --text 'CHANGE PASSWORD' --callback_data '_altsenha3' ShellBot.InlineKeyboardButton --button 'menu3' --line 4 --text 'EXPIRED' --callback_data '_expirados3' ShellBot.InlineKeyboardButton --button 'menu3' --line 5 --text 'CHANGE DATE' --callback_data '_altdata3' ShellBot.InlineKeyboardButton --button 'menu3' --line 5 --text 'HELP' --callback_data '_ajuda3' ShellBot.regHandleFunction --function fun_adduser --callback_data _criaruser3 ShellBot.regHandleFunction --function fun_add_teste --callback_data _criarteste3 ShellBot.regHandleFunction --function fun_deluser --callback_data _deluser3 ShellBot.regHandleFunction --function alterar_senha --callback_data _altsenha3 ShellBot.regHandleFunction --function alterar_limite --callback_data _altlimite3 ShellBot.regHandleFunction --function alterar_data --callback_data _altdata3 ShellBot.regHandleFunction --function monitor_ssh --callback_data _monitor3 ShellBot.regHandleFunction --function ver_users --callback_data _verusers3 ShellBot.regHandleFunction --function fun_exp_user --callback_data _expirados3 ShellBot.regHandleFunction --function fun_ajuda --callback_data _ajuda3 unset keyboard3 keyboard3="$(ShellBot.InlineKeyboardMarkup -b 'menu3')" #LISTA MENU OPCOES REVENDA unset menu4 menu4='' ShellBot.InlineKeyboardButton --button 'menu4' --line 1 --text 'ADD RESALE' --callback_data '_addrev' ShellBot.InlineKeyboardButton --button 'menu4' --line 2 --text 'REMOVE RESALE' --callback_data '_delrev' ShellBot.InlineKeyboardButton --button 'menu4' --line 3 --text 'CHANGE RESALE LIMIT' --callback_data '_limrev' ShellBot.InlineKeyboardButton --button 'menu4' --line 4 --text 'CHANGE RESALE DATE' --callback_data '_datrev' ShellBot.InlineKeyboardButton --button 'menu4' --line 5 --text 'LIST RESALE' --callback_data '_listrev' ShellBot.InlineKeyboardButton --button 'menu4' --line 6 --text 'SUSPEND RESALE' --callback_data '_susprevendas' ShellBot.regHandleFunction --function fun_add_revenda --callback_data _addrev ShellBot.regHandleFunction --function fun_del_rev --callback_data _delrev ShellBot.regHandleFunction --function fun_lim_rev --callback_data _limrev ShellBot.regHandleFunction --function fun_dat_rev --callback_data _datrev ShellBot.regHandleFunction --function fun_list_rev --callback_data _listrev ShellBot.regHandleFunction --function fun_susp_rev --callback _susprevendas unset keyboard4 keyboard4="$(ShellBot.InlineKeyboardMarkup -b 'menu4')" while :; do [[ -e "/etc/VPSManager/backups/backup.vps" ]] && { backup_auto } #Obtem as atualizações ShellBot.getUpdates --limit 100 --offset $(ShellBot.OffsetNext) --timeout 35 #Lista o índice das atualizações for id in $(ShellBot.ListUpdates); do #Inicio thread ( ShellBot.watchHandle --callback_data ${callback_query_data[$id]} # Requisições somente no privado. [[ ${message_chat_type[$id]} != 'private' ]] && continue [[ ${message_text[$id]} ]] || restaure_backup CAD_ARQ=/tmp/cad.${message_from_id[$id]} if [[ ${message_entities_type[$id]} == bot_command ]]; then #Verifica se a mensagem enviada pelo usuário é um comando válido. case ${message_text[$id]} in *) : #comandos comando=(${message_text[$id]}) [[ "${comando[0]}" = "/start" ]] && msg_bem_vindo [[ "${comando[0]}" = "/menu" ]] && fun_menu [[ "${comando[0]}" = "/info" ]] && infouserbot [[ "${comando[0]}" = "/help" || "${comando[0]}" = "/ajuda" ]] && fun_ajuda [[ "${comando[0]}" = "/bot" || "${comando[0]}" = "/sobre" ]] && sobremim ;; esac fi if [[ ${message_reply_to_message_message_id[$id]} ]]; then # Analisa a interface de resposta. case ${message_reply_to_message_text[$id]} in '👤 CREATE USER 👤\n\nUsername:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ "$(awk -F : '$3 >= 1000 { print $1 }' /etc/passwd | grep -w ${message_text[$id]} | wc -l)" != '0' ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error! INVALID USER ❌\n\n⚠️ Enter Another Name..")" \ --parse_mode html >$CAD_ARQ break } [ "${message_text[$id]}" == 'root' ] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error! INVALID USER ❌\n\n⚠️ Enter Another Name..")" \ --parse_mode html >$CAD_ARQ break } sizemin=$(echo -e ${#message_text[$id]}) [[ "$sizemin" -lt '4' ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error !\n\nUse at least 4 characters\n[EX: test]")" \ --parse_mode html >$CAD_ARQ break } sizemax=$(echo -e ${#message_text[$id]}) [[ "$sizemax" -gt '10' ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error !\n\nUse a maximum of 8 characters\n[EX: abcdefgh]")" \ --parse_mode html >$CAD_ARQ break } echo "Nome: ${message_text[$id]}" >$CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Senha:' \ --reply_markup "$(ShellBot.ForceReply)" # Força a resposta. ;; 'Senha:') sizepass=$(echo -e ${#message_text[$id]}) verifica_acesso [[ "$_erro" == '1' ]] && break [[ "$sizepass" -lt '4' ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error !\n\nUse at least 4 characters\n[EX: 1234]")" \ --parse_mode html >$CAD_ARQ break } echo "Senha: ${message_text[$id]}" >>$CAD_ARQ # Próximo campo. ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Limite:' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'Limite:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\nuse only numbers [EX: 1]")" \ --parse_mode html >$CAD_ARQ break } [[ "${message_from_id[$id]}" != "$id_admin" ]] && { _limTotal=$(grep -w "${message_from_username}" $ativos | awk '{print $4}') fun_verif_limite_rev ${message_from_username} _limsomarev2=$(echo "$_result + ${message_text[$id]}" | bc) [[ "$_limsomarev2" -gt "$_limTotal" ]] && { _restant1=$(($_limTotal - $_result)) ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ you don't have enough limit\n\nAvailable limit: $_restant1 ")" \ --parse_mode html >$CAD_ARQ break } } echo "Limite: ${message_text[$id]}" >>$CAD_ARQ # Próximo campo. ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Validity in days: ' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'Validity in days:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\nuse only numbers [EX: 30]")" \ --parse_mode html >$CAD_ARQ break } info_data=$(date '+%d/%m/%C%y' -d " +${message_text[$id]} days") echo "Validade: $info_data" >>$CAD_ARQ criar_user $CAD_ARQ [[ "(grep -w ${message_text[$id]} /etc/passwd)" = '0' ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e ❌ Error creating user !)" \ --parse_mode html >$CAD_ARQ break } [[ "$(ls /etc/bot/arquivos | wc -l)" != '0' ]] && { ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text '📥 AVAILABLE FILES 📥\n\nDo you want to download? Yes or no?:' \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n====================================\n\n◈─────⪧ IMPORTANT ⪦──────◈\n\n◈⪧ 🚫 NO SPAM\n◈⪧ ⚠️ NO DDOS\n◈⪧ 🎭 NO Hacking\n◈⪧ ⛔️ NO Carding\n◈⪧ 🙅‍♂️ NO Torrent\n◈⪧ ❌ NO MultiLogin\n◈⪧ 🤷‍♂️ NO Illegal Activities\n\n◈─────⪧ SSH ACCOUNT ⪦─────◈\n\n◈ Host / IP :⪧ $(cat /etc/IP)\n◈ Username :⪧ $(awk -F " " '/Nome/ {print $2}' $CAD_ARQ)\n◈ Password :⪧ $(awk -F " " '/Senha/ {print $2}' $CAD_ARQ)\n◈ Login Limit :⪧ $(awk -F " " '/Limite/ {print $2}' $CAD_ARQ)\n◈ Expire Date :⪧ $(awk -F " " '/Validade/ {print $2}' $CAD_ARQ)\n\n◈──────⪧ PORTS ⪦ ───────◈\n\n◈ SSH ⌁ 22\n◈ SSL ⌁ 443\n◈ Squid ⌁ 8080\n◈ DropBear ⌁ 80\n◈ BadVPN ⌁ 7300\n\n◈───⪧ONLINE USER COUNT⪦────◈ \n\nhttp://$(cat /etc/IP):8888/server/online\n\n◈──────────────────◈\n\n©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉\n◈──────────────────◈" \ --parse_mode html break } ;; '📥 AVAILABLE FILES 📥\n\nDo you want to download? Yes or no?:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([A-Za-z]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Invalid option ❌\n\n⚠️ use only letters [EX: Yes or No]")" \ --parse_mode html ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n====================================\n\n◈─────⪧ IMPORTANT ⪦──────◈\n\n◈⪧ 🚫 NO SPAM\n◈⪧ ⚠️ NO DDOS\n◈⪧ 🎭 NO Hacking\n◈⪧ ⛔️ NO Carding\n◈⪧ 🙅‍♂️ NO Torrent\n◈⪧ ❌ NO MultiLogin\n◈⪧ 🤷‍♂️ NO Illegal Activities\n\n◈─────⪧ SSH ACCOUNT ⪦─────◈\n\n◈ Host / IP :⪧ $(cat /etc/IP)\n◈ Username :⪧ $(awk -F " " '/Nome/ {print $2}' $CAD_ARQ)\n◈ Password :⪧ $(awk -F " " '/Senha/ {print $2}' $CAD_ARQ)\n◈ Login Limit :⪧ $(awk -F " " '/Limite/ {print $2}' $CAD_ARQ)\n◈ Expire Date :⪧ $(awk -F " " '/Validade/ {print $2}' $CAD_ARQ)\n\n◈──────⪧ PORTS ⪦ ───────◈\n\n◈ SSH ⌁ 22\n◈ SSL ⌁ 443\n◈ Squid ⌁ 8080\n◈ DropBear ⌁ 80\n◈ BadVPN ⌁ 7300\n\n◈───⪧ONLINE USER COUNT⪦────◈ \n\nhttp://$(cat /etc/IP):8888/server/online\n\n◈──────────────────◈\n\n©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉\n◈──────────────────◈" \ --parse_mode html break } [[ "${message_text[$id]}" = @(Sim|sim|SIM) ]] && { msg_cli="◈──────────────────◈\n" msg_cli+="PRE-CONFIGURED FILES ❗\n" msg_cli+="◈──────────────────◈\n\n" for _file in $(ls /etc/bot/arquivos); do i=$(($i + 1)) msg_cli+="[$i] - $_file\n" done ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "$msg_cli")" \ --parse_mode html ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Enter the File Number:' \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n====================================\n\n◈─────⪧ IMPORTANT ⪦──────◈\n\n◈⪧ 🚫 NO SPAM\n◈⪧ ⚠️ NO DDOS\n◈⪧ 🎭 NO Hacking\n◈⪧ ⛔️ NO Carding\n◈⪧ 🙅‍♂️ NO Torrent\n◈⪧ ❌ NO MultiLogin\n◈⪧ 🤷‍♂️ NO Illegal Activities\n\n◈─────⪧ SSH ACCOUNT ⪦─────◈\n\n◈ Host / IP :⪧ $(cat /etc/IP)\n◈ Username :⪧ $(awk -F " " '/Nome/ {print $2}' $CAD_ARQ)\n◈ Password :⪧ $(awk -F " " '/Senha/ {print $2}' $CAD_ARQ)\n◈ Login Limit :⪧ $(awk -F " " '/Limite/ {print $2}' $CAD_ARQ)\n◈ Expire Date :⪧ $(awk -F " " '/Validade/ {print $2}' $CAD_ARQ)\n\n◈──────⪧ PORTS ⪦ ───────◈\n\n◈ SSH ⌁ 22\n◈ SSL ⌁ 443\n◈ Squid ⌁ 8080\n◈ DropBear ⌁ 80\n◈ BadVPN ⌁ 7300\n\n◈───⪧ONLINE USER COUNT⪦────◈ \n\nhttp://$(cat /etc/IP):8888/server/online\n\n◈──────────────────◈\n\n©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉\n◈──────────────────◈" \ --parse_mode html } ;; 'Enter the File Number:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Invalid option ❌ \n\n⚠️ use only numbers [EX: 1]")" \ --parse_mode html ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "====================================\n 🐉 DRAGON VPS MANAGER 🐉 \n====================================\n\n◈─────⪧ IMPORTANT ⪦──────◈\n\n◈⪧ 🚫 NO SPAM\n◈⪧ ⚠️ NO DDOS\n◈⪧ 🎭 NO Hacking\n◈⪧ ⛔️ NO Carding\n◈⪧ 🙅‍♂️ NO Torrent\n◈⪧ ❌ NO MultiLogin\n◈⪧ 🤷‍♂️ NO Illegal Activities\n\n◈─────⪧ SSH ACCOUNT ⪦─────◈\n\n◈ Host / IP :⪧ $(cat /etc/IP)\n◈ Username :⪧ $(awk -F " " '/Nome/ {print $2}' $CAD_ARQ)\n◈ Password :⪧ $(awk -F " " '/Senha/ {print $2}' $CAD_ARQ)\n◈ Login Limit :⪧ $(awk -F " " '/Limite/ {print $2}' $CAD_ARQ)\n◈ Expire Date :⪧ $(awk -F " " '/Validade/ {print $2}' $CAD_ARQ)\n\n◈──────⪧ PORTS ⪦ ───────◈\n\n◈ SSH ⌁ 22\n◈ SSL ⌁ 443\n◈ Squid ⌁ 8080\n◈ DropBear ⌁ 80\n◈ BadVPN ⌁ 7300\n\n◈───⪧ONLINE USER COUNT⪦────◈ \n\nhttp://$(cat /etc/IP):8888/server/online\n\n◈──────────────────◈\n\n©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉\n◈──────────────────◈" \ --parse_mode html >$CAD_ARQ break } fun_download ${message_text[$id]} $CAD_ARQ # Limpa o arquivo temporário. >$CAD_ARQ break ;; '🗑 REMOVE USER 🗑\n\nUsername:') verifica_acesso [[ "$_erro" == '1' ]] && break fun_del_user ${message_text[$id]} [[ "$_erro" == '1' ]] && break ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "✅ *Successfully removed.* 🚮" \ --parse_mode markdown ;; '🔐 Change Password 🔐\n\nUsername:') verifica_acesso [[ "$_erro" == '1' ]] && break fun_verif_user ${message_text[$id]} echo "$_erro" [[ "$_erro" == '1' ]] && break echo "${message_text[$id]}" >/tmp/name-s ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'new password:' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'new password:') sizepass=$(echo -e ${#message_text[$id]}) verifica_acesso [[ "$_erro" == '1' ]] && break [[ "$sizepass" -lt '4' ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error !\n\n⚠️ Use at least 4 characters [EX: 1234]")" \ --parse_mode html break } alterar_senha_user $(cat /tmp/name-s) ${message_text[$id]} [[ "$_erro" == '1' ]] && break ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "$(echo -e "◈──────────────────◈\n✅ PASSWORD CHANGED ! !\n◈──────────────────◈\n\nUser: $(cat /tmp/name-s)\nNew Password: ${message_text[$id]}")" \ --parse_mode html rm /tmp/name-s >/dev/null 2>&1 ;; '👥 Change Limit 👥\n\nUsername:') verifica_acesso [[ "$_erro" == '1' ]] && break echo $_erro segundo fun_verif_user ${message_text[$id]} echo "$_erro" [[ "$_erro" == '1' ]] && break echo "${message_text[$id]}" >/tmp/name-l ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'new limit:' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'new limit:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\n⚠️ use only numbers [EX: 1]")" \ --parse_mode html break } alterar_limite_user $(cat /tmp/name-l) ${message_text[$id]} [[ "$_erro" == '1' ]] && break ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "$(echo -e "◈──────────────────◈\n✅ Limit CHANGED ! !\n◈──────────────────◈\n\nUser: $(cat /tmp/name-l)\nNew Limit: ${message_text[$id]}")" \ --parse_mode html rm /tmp/name-l >/dev/null 2>&1 ;; '⏳ Change Date ⏳\n\nUsername:') verifica_acesso [[ "$_erro" == '1' ]] && break fun_verif_user ${message_text[$id]} [[ "$_erro" == '1' ]] && break echo "${message_text[$id]}" >/tmp/name-d ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'inform the days or date:' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'inform the days or date:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9/]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error! follow the example\n\nformat days [EX: 30]\nDate format [EX: 30/12/2019]")" \ --parse_mode html break } alterar_data_user $(cat /tmp/name-d) ${message_text[$id]} [[ "$_erro" == '1' ]] && break ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "$(echo -e "◈──────────────────◈\n✅ DATE CHANGED ! !\n◈──────────────────◈\n\nUser: $(cat /tmp/name-d)\nNew Date: $udata")" \ --parse_mode html rm /tmp/name-d >/dev/null 2>&1 ;; '[1] - ADD FILE\n[2] - DELETE FILE\n\nInform the option [1-2]:') [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\n⚠️ use only numbers [EX: 1 or 2]")" \ --parse_mode html break } if [[ "${message_text[$id]}" = '1' ]]; then ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "📤 HOST FILES 📤\n\nsend me the file:" \ --reply_markup "$(ShellBot.ForceReply)" elif [[ "${message_text[$id]}" = '2' ]]; then [[ $(ls /etc/bot/arquivos | wc -l) != '0' ]] && { msg_cli1="◈──────────────────◈\n" msg_cli1+="🚀 HOSTED FILES \n" msg_cli1+="◈──────────────────◈\n\n" for _file in $(ls /etc/bot/arquivos); do i=$(($i + 1)) msg_cli1+="[$i] - $_file\n" done ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "$msg_cli1")" \ --parse_mode html ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "🗑Delete File\nEnter the File Number:" \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "There are no files available")" \ --parse_mode html break } else ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Invalid option")" \ --parse_mode html break fi ;; '🗑Delete File\nEnter the File Number:') [[ "${message_from_id[$id]}" != "$id_admin" ]] && break Opc1=${message_text[$id]} echo $Opc1 [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error Deleting File ! \n\n⚠️ use only numbers [EX: 1]")" \ --parse_mode html break } || { echo "opcao $Opc1" _DirArq=$(ls /etc/bot/arquivos) i=0 unset _Pass while read _Arq; do i=$(expr $i + 1) _oP=$i [[ $i == [1-9] ]] && i=0$i && oP+=" 0$i" echo -e "[$i] - $_Arq" _Pass+="\n${_oP}:${_Arq}" done <<<"${_DirArq}" _file=$(echo -e "${_Pass}" | grep -E "\b$Opc1\b" | cut -d: -f2) [[ -e /etc/bot/arquivos/$_file ]] && { rm /etc/bot/arquivos/$_file ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "✅ *successfully deleted* ✅" \ --parse_mode markdown break } || { ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "$(echo -e "❌ Invalid option")" break } } ;; '📤 HOST FILES 📤\n\nsend me the file:') if [ "${update_id[$id]}" ]; then # Monitora o envio de arquivos [[ ${message_document_file_id[$id]} ]] && file_id=${message_document_file_id[$id]} && download_file=1 # Verifica se o download está ativado. [[ $download_file -eq 1 ]] && { file_id=($file_id) ShellBot.getFile --file_id "${file_id[0]}" ShellBot.downloadFile --file_path ${return[file_path]} --dir "/tmp/file" && { msg='*✅ Successfully hosted file.*\n\n' msg+="*📤 Information*\n\n" msg+="*Name*: ${message_document_file_name}\n" msg+="*Saved in*: /etc/bot/arquivos" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "$msg")" \ --parse_mode markdown mv /tmp/file/$(ls -1rt /tmp/file | tail -n1) /etc/bot/arquivos/${message_document_file_name} break } } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error receiving file ❌")" \ --parse_mode markdown break } fi ;; 'Deseja restaurar ? [sim | nao]') Resp=${message_text[$id]} [[ ${message_from_id[$id]} != ${id_admin} ]] && break [[ $Resp != ?(+|-)+([a-z]) ]] && { ShellBot.sendMessage --chat_id ${id_admin} \ --text "$(echo -e "❌ Error ! \n\n⚠️ Use only yes or no")" \ --parse_mode html break } [[ "$Resp" = @(Sim|sim|SIM) ]] && { filebkp=$(ls /tmp | grep '.vps') [[ -e /tmp/$filebkp ]] && { mv /tmp/$filebkp /backup.vps cd / tar -xvf backup.vps rm /backup.vps ShellBot.sendMessage --chat_id ${id_admin} \ --text "$(echo -e "✅ Backup restored\nsuccessfully!")" \ --parse_mode html break } } break ;; # FUNCOES DE GESTAO REVENDA # # Adicionar, remover, limite, data, suspencao, relatorio # '👥 ADD DEALER 👥\n\nEnter the name:') verifica_acesso [[ "$_erro" == '1' ]] && break echo "Nome: ${message_text[$id]}" >$CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Inform his username [Ex: @Dragon_vps_manager]:' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'Inform his username [Ex: @Dragon_vps_manager]:') verifica_acesso [[ "$_erro" == '1' ]] && break _VAR1=$(echo -e ${message_text[$id]} | awk -F '@' {'print $2'}) [[ -z $_VAR1 ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error \n\n⚠️ inform the username [EX: @Dragon_vps_manager]")" \ --parse_mode html break } [[ -d /etc/bot/revenda/$_VAR1 ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ the dealer ${message_text[$id]} already exists")" \ --parse_mode html break } echo "User: ${message_text[$id]}" >>$CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'How many SSH can it create:' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'How many SSH can it create:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\n⚠️ use only numbers [EX: 10]")" \ --parse_mode html break } [[ "${message_from_id[$id]}" != "$id_admin" ]] && { _limTotal=$(grep -w "${message_from_username}" $ativos | awk '{print $4}') fun_verif_limite_rev ${message_from_username} _limsomarev=$(echo "$_result + ${message_text[$id]}" | bc) [[ "$_limsomarev" -gt "$_limTotal" ]] && { _restant1=$(($_limTotal - $_result)) ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ you don't have enough limit\n\nLimite disponivel: $_restant1 ")" \ --parse_mode html break } } echo "Limite: ${message_text[$id]}" >>$CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'how many days of access:' \ --reply_markup "$(ShellBot.ForceReply)" ;; 'how many days of access:') verifica_acesso [[ "$_erro" == '1' ]] && break echo "Validade: ${message_text[$id]}" >>$CAD_ARQ _clientrev=$(cat $CAD_ARQ) criar_rev $CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "✅ successfully created. ✅\n\n$(<$CAD_ARQ)\n\nBOT: @${message_reply_to_message_from_username}" \ --parse_mode html ;; # REMOVE REVENDEDOR '🗑 REMOVE DEALER 🗑\n\nInform his username [Ex: @Dragon_vps_manager]:') echo -e "${message_text[$id]}" >$CAD_ARQ _Var=$(sed -n '1 p' $CAD_ARQ | awk -F '@' {'print $2'}) [[ -z $_Var ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ invalid user")" \ --parse_mode html break } del_rev $_Var break ;; # ALTERAR LIMITE '♾ CHANGE RESALE LIMIT ♾\n\nInform his username [Ex: @Dragon_vps_manager]:') verifica_acesso [[ "$_erro" == '1' ]] && break echo -e "Dealer: ${message_text[$id]}" >$CAD_ARQ _Var1=$(sed -n '1 p' $CAD_ARQ | awk -F '@' {'print $2'}) [[ -z $_Var1 ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Invalid name !")" \ --parse_mode html break } [[ "${message_from_id[$id]}" == "$id_admin" ]] && { [[ $(grep -wc $_Var1 $ativos) != '0' ]] && { ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Enter the SSH Limit:' \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Dealer ${message_text[$id]} does not exist")" \ --parse_mode html break } } [[ $(grep -w ${message_from_username} $ativos | awk '{print $NF}') == 'revenda' ]] && { [[ "$(grep -wc "$_Var1" /etc/bot/revenda/${message_from_username}/${message_from_username})" != '0' ]] && { ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Enter the SSH Limit:' \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Sub-dealer does not exist")" \ --parse_mode html break } } ;; 'Informe o Limite SSH:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\nuse only numbers [EX: 1]")" \ --parse_mode html break } [[ "${message_from_id[$id]}" != "$id_admin" ]] && { _limTotal=$(grep -w "${message_from_username}" $ativos | awk '{print $4}') fun_verif_limite_rev ${message_from_username} _limsomarev=$(echo "$_result + ${message_text[$id]}" | bc) [[ $(grep -wc 'SUBREVENDA' /etc/bot/revenda/${message_from_username}/${message_from_username}) != '0' ]] && { _limsomarev2=$(echo "$(grep -w 'SUBREVENDA' /etc/bot/revenda/${message_from_username}/${message_from_username} | awk {'print $4'} | paste -s -d + | bc)" + "${message_text[$id]}" | bc) } || { _limsomarev2='0' } [[ "$_limsomarev2" -ge "$_limTotal" ]] && { echo $_limsomarev2 ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ you don't have enough limit")" \ --parse_mode html break } [[ "$_limsomarev" -gt "$_limTotal" ]] && { [[ "$_limTotal" == "$(($_limTotal - $_result))" ]] && _restant1='0' || _restant1=$(($_limTotal - $_result)) ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ you don't have enough limit\n\nLimite restante: $_restant1 ")" \ --parse_mode html break } } echo -e "Limite: ${message_text[$id]}" >>$CAD_ARQ lim_rev $CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "$(echo -e "◈──────────────────◈\n✅ CHANGED RESALE LIMIT ! !\n◈──────────────────◈\n\n$(<$CAD_ARQ)")" \ --parse_mode html # ALTERAR DATA ;; '📆 CHANGE RESALE DATE 📆\n\nInform his username [Ex: @Dragon_vps_manager]:') verifica_acesso [[ "$_erro" == '1' ]] && break _VAR1=$(echo -e ${message_text[$id]} | awk -F '@' {'print $2'}) [[ -z $_VAR1 ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Dealer ${message_text[$id]} does not exist")" \ --parse_mode html break } [[ "${message_from_id[$id]}" == "$id_admin" ]] && { [[ $(grep -wc $_VAR1 $ativos) != '0' ]] && { echo -e "Dealer: ${message_text[$id]}" >$CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Access days [Ex: 30]:' \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ The Reseller ${message_text[$id]} does not exist")" \ --parse_mode html break } } || { [[ $(grep -w ${message_from_username} $ativos | awk '{print $NF}') == 'revenda' ]] && { [[ "$(grep -wc "$_VAR1" /etc/bot/revenda/${message_from_username}/${message_from_username})" != '0' ]] && { echo -e "Dealer: ${message_text[$id]}" >$CAD_ARQ ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text 'Access days [Ex: 30]:' \ --reply_markup "$(ShellBot.ForceReply)" } || { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ The SubReseller ${message_text[$id]} does not exist")" \ --parse_mode html break } } } ;; 'Access days [Ex: 30]:') verifica_acesso [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\nuse only numbers [EX: 30]")" \ --parse_mode html break } echo -e "Data: ${message_text[$id]}" >>$CAD_ARQ dat_rev $CAD_ARQ [[ "$_erro" == '1' ]] && break ShellBot.sendMessage --chat_id ${message_from_id[$id]} \ --text "$(echo -e "◈──────────────────◈\n✅ CHANGED RESALE DATE! !\n◈──────────────────◈\n\n$(<$CAD_ARQ)")" \ --parse_mode html ;; # SUSPENDER REVENDEDOR '🔒 SUSPEND DEALER 🔒\n\nInform his username [Ex: @Dragon_vps_manager]:') _VAR1=$(echo -e ${message_text[$id]} | awk -F '@' {'print $2'}) [[ -z $_VAR1 ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Dealer ${message_text[$id]} does not exist")" \ --parse_mode html break } susp_rev $_VAR1 break ;; '👤 CREATE TEST 👤\n\nhow many hours should it last EX: 1:') verifica_acesso echo $_erro [[ "$_erro" == '1' ]] && break [[ ${message_text[$id]} != ?(+|-)+([0-9]) ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ Error ! \n\nuse only numbers [EX: 1]")" \ --parse_mode html >$CAD_ARQ break } [[ "${message_from_id[$id]}" != "$id_admin" ]] && { _limTotal=$(grep -w "${message_from_username}" $ativos | awk '{print $4}') fun_verif_limite_rev ${message_from_username} _limsomarev2=$(echo "$_result + 1" | bc) [[ "$_limsomarev2" -gt "$_limTotal" ]] && { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "❌ you don't have enough limit")" \ --parse_mode html >$CAD_ARQ break } } fun_teste ${message_text[$id]} ;; esac fi ) & done done #FIM ================================================ FILE: Modulos/botgen ================================================ #!/bin/bash [[ $(screen -list| grep -c 'bot_gen') == '0' ]] && { clear echo -e "\E[44;1;37m ㅤ🐉ㅤDRAGON VPS MANAGER TELE BOT ACTIVATIONㅤ🐉ㅤ \E[0m" echo "" echo -ne "\033[1;32m◇ INFORM YOUR BOT TOKEN FROM @BotFather\033[1;37m: "; read token echo "" echo -ne "\033[1;32m◇ INFORM YOUR TELEGRAM ID\033[1;37m: "; read idtelegram cd /etc/VPSManager screen -dmS bot_gen ./botgerador $token $idtelegram > /dev/null 2>&1 [[ $(grep -wc "bot_gen" /etc/autostart) = '0' ]] && { echo -e "ps x | grep 'bot_gen' | grep -v 'grep' || cd /etc/VPSManager && sudo screen -dmS bot_gen ./botgerador $token $idtelegram && cd $HOME" >>/etc/autostart } || { sed -i '/bot_gen/d' /etc/autostart echo -e "ps x | grep 'bot_gen' | grep -v 'grep' || cd /etc/VPSManager && sudo screen -dmS bot_gen ./botgerador $token $idtelegram && cd $HOME" >>/etc/autostart } clear && echo "◇ BOT ACTIVATED!" } || { screen -r -S "bot_gen" -X quit clear && echo "◇ BOT DISABLED!" } ================================================ FILE: Modulos/botgerador ================================================ #!/bin/bash clear source ShellBot.sh api_bot=$1 id_admin=$2 ShellBot.init --token "$api_bot" --monitor --flush ShellBot.username # - Funcao menu menu() { [[ "${message_from_id[$id]}" == "$id_admin" ]] && { local msg msg="◇──────────────────◇\n" msg+="•🔹•ㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ•🔹•\n" msg+="◇──────────────────◇\n\n" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e $msg)" \ --reply_markup "$keyboard1" \ --parse_mode html return 0 } ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e 🚫 ACCESS DENIED 🚫)" return 0 } # - funcao criar ssh criarssh30() { usuario=$(echo BR$(( RANDOM% + 999999))) senha=$((RANDOM% + 99999)) limite='1' tempo='31' final=$(date "+%Y-%m-%d" -d "+$tempo days") gui=$(date "+%d/%m/%Y" -d "+$tempo days") pass=$(perl -e 'print crypt($ARGV[0], "password")' $senha) if [[ "$(grep -wc $usuario /etc/passwd)" != '0' ]]; then ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \ --text "◇ GENERATED ACCOUNT ALREADY EXISTS! TRY AGAIN" return 0 else useradd -e $final -M -s /bin/false -p $pass $usuario >/dev/null 2>&1 (echo "$senha";echo "$senha") | passwd $usuario > /dev/null 2>&1 echo "$senha" > /etc/VPSManager/senha/$usuario echo "$usuario $limite" >> /root/usuarios.db # - ENVIA O SSH ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \ --text "$(echo -e "✅ successfully created ✅\n\nSERVER: $(cat /etc/IP) \nUSERNAME: $usuario\nPASSWORD: $senha\nEXPIRE: 01\n\n⏳ Expira em: $gui ")" \ --parse_mode html return 0 fi } # - funcao criar ssh criarssh15() { usuario=$(echo BR$(( RANDOM% + 999999))) senha=$((RANDOM% + 99999)) limite='1' tempo='16' final=$(date "+%Y-%m-%d" -d "+$tempo days") gui=$(date "+%d/%m/%Y" -d "+$tempo days") pass=$(perl -e 'print crypt($ARGV[0], "password")' $senha) if [[ "$(grep -wc $usuario /etc/passwd)" != '0' ]]; then ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \ --text "◇ GENERATED ACCOUNTALREADY EXISTS! TRY AGAIN" return 0 else useradd -e $final -M -s /bin/false -p $pass $usuario >/dev/null 2>&1 (echo "$senha";echo "$senha") | passwd $usuario > /dev/null 2>&1 echo "$senha" > /etc/VPSManager/senha/$usuario echo "$usuario $limite" >> /root/usuarios.db # - ENVIA O SSH ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \ --text "$(echo -e "✅ pt7gtpgt7pgt7pgt7phpuygypu7o ✅\n\nSERVIDOR: $(cat /etc/IP) \nUSUARIO: $usuario\nSENHA: $senha\nACESSO: 01\n\n⏳ Expira em: $gui ")" \ --parse_mode html return 0 fi } #informacoes usuario infouser () { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Nome: ${message_from_first_name[$(ShellBot.ListUpdates)]}\nUser: @${message_from_username[$(ShellBot.ListUpdates)]:-null}")\nID: ${message_from_id[$(ShellBot.ListUpdates)]} " \ --parse_mode html return 0 } unset botao1 botao1='' ShellBot.InlineKeyboardButton --button 'botao1' --line 1 --text '30 DAYS SSH ACCOUNT' --callback_data 'gerarssh30' ShellBot.InlineKeyboardButton --button 'botao1' --line 2 --text '15 DAYS SSH ACCOUNT' --callback_data 'gerarssh15' ShellBot.regHandleFunction --function criarssh30 --callback_data gerarssh30 ShellBot.regHandleFunction --function criarssh15 --callback_data gerarssh15 unset keyboard1 keyboard1="$(ShellBot.InlineKeyboardMarkup -b 'botao1')" while :; do ShellBot.getUpdates --limit 100 --offset $(ShellBot.OffsetNext) --timeout 30 for id in $(ShellBot.ListUpdates); do ( ShellBot.watchHandle --callback_data ${callback_query_data[$id]} comando=(${message_text[$id]}) [[ "${comando[0]}" = "/menu" || "${comando[0]}" = "/start" ]] && menu [[ "${comando[0]}" = "/id" ]] && infouser ) & done done ================================================ FILE: Modulos/botssh ================================================ #!/bin/bash clear fun_bar() { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim ${comando[0]} -y >/dev/null 2>&1 ${comando[1]} -y >/dev/null 2>&1 touch $HOME/fim ) >/dev/null 2>&1 & tput civis echo -ne "\033[1;33m[" while true; do for ((i = 0; i < 18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne "\033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m" tput cnorm } fun_botOnOff() { [[ $(ps x | grep "bot_plus" | grep -v grep | wc -l) = '0' ]] && { clear echo -e "\E[44;1;37mㅤ🐉ㅤDRAGON VPS MANAGERㅤTELE BOT INSTALLERㅤ🐉ㅤ\E[0m\n" echo -ne "\033[1;32m◇ INFORM YOUR BOT TOKEN:\033[1;37m " read tokenbot echo "" echo -ne "\033[1;32m◇ INFORM YOUR TELEGRAM ID:\033[1;37m " read iduser clear echo -e "\033[1;32mㅤ🐉ㅤDRAGON VPS MANAGERㅤTELE BOT STARTING...ㅤ🐉ㅤ\033[0m\n" fun_bot1() { [[ "$(grep -wc '16' /etc/issue.net)" != '0' ]] && { wget -qO- https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/ShellBot.sh > /etc/VPSManager/ShellBot.sh } [[ ! -e "/etc/VPSManager/ShellBot.sh" ]] && { wget -qO- https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/ShellBot.sh >/etc/VPSManager/ShellBot.sh } cd /etc/VPSManager screen -dmS bot_plus ./bot $tokenbot $iduser >/dev/null 2>&1 [[ $(grep -wc "bot_plus" /etc/autostart) = '0' ]] && { echo -e "ps x | grep 'bot_plus' | grep -v 'grep' || cd /etc/VPSManager && sudo screen -dmS bot_plus ./bot $tokenbot $iduser && cd $HOME" >>/etc/autostart } || { sed -i '/bot_plus/d' /etc/autostart echo -e "ps x | grep 'bot_plus' | grep -v 'grep' || cd /etc/VPSManager && sudo screen -dmS bot_plus ./bot $tokenbot $iduser && cd $HOME" >>/etc/autostart } [[ $(crontab -l | grep -c "verifbot") = '0' ]] && ( crontab -l 2>/dev/null echo "@daily /bin/verifbot" ) | crontab - cd $HOME } fun_bar 'fun_bot1' [[ $(ps x | grep "bot_plus" | grep -v grep | wc -l) != '0' ]] && echo -e "\n\033[1;32m🐉ㅤDRAGON VPS MANAGERㅤTELE BOT ENABLED!ㅤ🐉\033[0m" || echo -e "\n\033[1;31m◇ MISTAKE! REANALYZE YOUR INFORMATION\033[0m" sleep 2 menu } || { clear echo -e "\033[1;32m🐉ㅤDRAGON VPS MANAGERㅤTELE BOT STOPPING...ㅤ🐉\033[0m\n" fun_bot2() { screen -r -S "bot_plus" -X quit screen -wipe 1>/dev/null 2>/dev/null [[ $(grep -wc "bot_plus" /etc/autostart) != '0' ]] && { sed -i '/bot_plus/d' /etc/autostart } [[ $(crontab -l | grep -c "verifbot") != '0' ]] && crontab -l | grep -v 'verifbot' | crontab - sleep 1 } fun_bar 'fun_bot2' echo -e "\n\033[1;32m \033[1;31m🐉ㅤDRAGON VPS MANAGERㅤTELE BOT STOPPED!ㅤ🐉\033[0m" sleep 2 menu } } fun_instbot() { echo -e "\E[44;1;37mㅤ🐉ㅤDRAGON VPS MANAGERㅤTELE BOT INSTALLERㅤ🐉ㅤ\E[0m\n" echo -e " \033[1;33m[\033[1;31m!\033[1;33m] \033[1;31mATTENTION! \033[1;33m[\033[1;31m!\033[1;33m]\033[0m" echo -e "\n\033[1;32m1° \033[1;37m- \033[1;33mTHROUGH YOUR TELEGRAM ACCOUNT, ACCESS THE FOLLOWING BOT\033[1;37m:\033[0m" echo -e "\n\033[1;32m2° \033[1;37m- \033[1;33mBOT \033[1;37m@BotFather \033[1;33mCREATE YOUR BOT \033[1;31mSEND TO @Botfather: \033[1;37m/newbot\033[0m" echo -e "\n\033[1;32m3° \033[1;37m- \033[1;33mBOT \033[1;37m@TwincyBot \033[1;33mAND GET YOUR ID \033[1;31mSEND TO @TwincyBot: \033[1;37m/id\033[0m" echo -e "\033[0;34m◇────────────────────────────────────────────────◇\033[1;32m" echo "" read -p "◇ DO YOU WISH TO CONTINUE ? [s/n]: " -e -i s resposta [[ "$resposta" = 's' ]] && { fun_botOnOff } || { echo -e "\n\033[1;31m◇ Returning...\033[0m" sleep 2 menu } } [[ -f "/etc/VPSManager/ShellBot.sh" ]] && fun_botOnOff || fun_instbot #fim ================================================ FILE: Modulos/botsshteste ================================================ #!/bin/bash clear source ShellBot.sh touch lista [[ ! -e RESET ]] && touch RESET api_bot=$1 ShellBot.init --token "$api_bot" --monitor --flush ShellBot.username # - Funcao menu menu() { local msg msg="◇──────────────────◇\n" msg+="•🔹• HELLO WELCOME •🔹•\n" msg+="◇──────────────────◇\n\n" msg+="ssh account R$ 10/Month" ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e $msg)" \ --reply_markup "$keyboard1" \ --parse_mode html return 0 } # - funcao criar ssh criarteste() { [[ $(grep -wc ${callback_query_from_id} lista) != '0' ]] && { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \ --text "YOU HAVE ALREADY CREATED YOUR TEST!" return 0 } usuario=$(echo TESTE$(( RANDOM% + 250 ))) senha=$((RANDOM% + 99999)) limite='1' tempo='1' tuserdate=$(date '+%C%y/%m/%d' -d " +1 days") useradd -M -N -s /bin/false $usuario -e $tuserdate > /dev/null 2>&1 (echo "$senha";echo "$senha") | passwd $usuario > /dev/null 2>&1 echo "$senha" > /etc/VPSManager/senha/$usuario echo "$usuario $limite" >> /root/usuarios.db echo "#!/bin/bash pkill -f "$usuario" userdel --force $usuario grep -v ^$usuario[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db rm /etc/VPSManager/senha/$usuario > /dev/null 2>&1 rm -rf /etc/VPSManager/userteste/$usuario.sh" > /etc/VPSManager/userteste/$usuario.sh chmod +x /etc/VPSManager/userteste/$usuario.sh at -f /etc/VPSManager/userteste/$usuario.sh now + $tempo hour > /dev/null 2>&1 echo ${callback_query_from_id} >> lista # - ENVIA O SSH ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \ --text "$(echo -e "✅ successfully created ✅\n\nSERVER: $(cat /etc/IP) \n\nUSER: $usuario\nPASSWORD: $senha\n\n⏳ Expires in: $tempo Hora")" \ --parse_mode html return 0 } #informacoes usuario infouser () { ShellBot.sendMessage --chat_id ${message_chat_id[$id]} \ --text "$(echo -e "Nome: ${message_from_first_name[$(ShellBot.ListUpdates)]}\nUser: @${message_from_username[$(ShellBot.ListUpdates)]:-null}")\nID: ${message_from_id[$(ShellBot.ListUpdates)]} " \ --parse_mode html return 0 } #informacoes usuario pix () { ShellBot.sendMessage --chat_id ${callback_query_message_chat_id} \ --text "$(echo -e "ssh account R$ 10/Month \n\nCOPY THE RANDOM PIX KEY\n b54bc1c3-c892-4b3a-a7ac-73a46f9eefa3")" \ --parse_mode html return 0 } unset botao1 botao1='' ShellBot.InlineKeyboardButton --button 'botao1' --line 1 --text 'CREATE TEST' --callback_data 'gerarssh' ShellBot.InlineKeyboardButton --button 'botao1' --line 2 --text 'TELEGRAM CONTACT' --callback_data '2' --url 'https://https://t.me/SD_VPS_MANAGER' ShellBot.InlineKeyboardButton --button 'botao1' --line 3 --text 'TELEGRAM CONTACT' --callback_data '3' --url 'https://https://t.me/SD_VPS_MANAGER' ShellBot.InlineKeyboardButton --button 'botao1' --line 4 --text 'TELEGRAM CONTACT' --callback_data 'pay' ShellBot.InlineKeyboardButton --button 'botao1' --line 4 --text 'TELEGRAM CONTACT' --callback_data '4' --url 'https://https://t.me/SD_VPS_MANAGER' ShellBot.regHandleFunction --function criarteste --callback_data gerarssh ShellBot.regHandleFunction --function pix --callback_data pay unset keyboard1 keyboard1="$(ShellBot.InlineKeyboardMarkup -b 'botao1')" while :; do [[ "$(date +%d +5days)" != "$(cat RESET)" ]] && { echo $(date +%d +5days) > RESET echo ' ' > lista } ShellBot.getUpdates --limit 100 --offset $(ShellBot.OffsetNext) --timeout 30 for id in $(ShellBot.ListUpdates); do ( ShellBot.watchHandle --callback_data ${callback_query_data[$id]} comando=(${message_text[$id]}) [[ "${comando[0]}" = "/menu" || "${comando[0]}" = "/start" ]] && menu [[ "${comando[0]}" = "/id" ]] && infouser ) & done done ================================================ FILE: Modulos/botteste ================================================ #!/bin/bash [[ $(screen -list| grep -c 'bot_teste') == '0' ]] && { clear echo -e "\E[44;1;37m◇ BOT SSH TEST ACTIVATION \E[0m" echo "" echo -ne "\033[1;32m◇ INFORM THE TELEGRAM BOT TOKEN\033[1;37m: "; read token cd /etc/VPSManager screen -dmS bot_teste ./botsshteste $token > /dev/null 2>&1 [[ $(grep -wc "bot_teste" /etc/autostart) = '0' ]] && { echo -e "ps x | grep 'bot_teste' | grep -v 'grep' || cd /etc/VPSManager && sudo screen -dmS bot_teste ./botsshteste $token && cd $HOME" >>/etc/autostart } || { sed -i '/bot_teste/d' /etc/autostart echo -e "ps x | grep 'bot_teste' | grep -v 'grep' || cd /etc/VPSManager && sudo screen -dmS bot_teste ./botsshteste $token && cd $HOME" >>/etc/autostart } clear && echo "◇ BOT ACTIVATED!" } || { screen -r -S "bot_teste" -X quit clear && echo "◇ BOT DEACTIVATED!" } ================================================ FILE: Modulos/cabecalho ================================================ #!/bin/bash clear ================================================ FILE: Modulos/conexao ================================================ #!/bin/bash cor1='\033[41;1;37m' cor2='\033[44;1;37m' scor='\033[0m' GREEN='\033[1;32m' YELLOW='\033[1;33m' SCOLOR='\033[0m' [[ $(awk -F" " '{print $2}' /usr/lib/licence) == "@DRAGON_VPS_MANAGER" ]] && { ram1=$(free -h | grep -i mem | awk {'print $2'}) ram2=$(free -h | grep -i mem | awk {'print $4'}) ram3=$(free -h | grep -i mem | awk {'print $3'}) uso=$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }') system=$(cat /etc/issue.net) fun_bar() { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim [[ ! -d /etc/VPSManager ]] && rm -rf /bin/menu ${comando[0]} >/dev/null 2>&1 ${comando[1]} >/dev/null 2>&1 touch $HOME/fim ) >/dev/null 2>&1 & tput civis echo -ne "\033[1;33mPLEASE WAIT... \033[1;37m- \033[1;33m[" while true; do for ((i = 0; i < 18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne "\033[1;33mPLEASE WAIT... \033[1;37m- \033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m DONE !\033[1;37m" tput cnorm } verif_ptrs() { porta=$1 PT=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" | grep -v "COMMAND" | grep "LISTEN") for pton in $(echo -e "$PT" | cut -d: -f2 | cut -d' ' -f1 | uniq); do svcs=$(echo -e "$PT" | grep -w "$pton" | awk '{print $1}' | uniq) [[ "$porta" = "$pton" ]] && { echo -e "\n\033[1;31mPORT \033[1;33m$porta \033[1;31mIN USE BY \033[1;37m$svcs\033[0m" sleep 3 fun_conexao } done } inst_sqd() { if netstat -nltp | grep 'squid' 1>/dev/null 2>/dev/null; then echo -e "\E[41;1;37m REMOVE SQUID PROXY \E[0m" echo "" echo -ne "\033[1;32mREALLY WANT TO REMOVE SQUID \033[1;31m? \033[1;33m[s/n]:\033[1;37m " read resp [[ "$resp" = 's' ]] && { echo -e "\n\033[1;32mREMOVING THE SQUID PROXY !\033[0m" echo "" rem_sqd() { [[ -d "/etc/squid" ]] && { apt-get remove squid -y >/dev/null 2>&1 apt-get purge squid -y >/dev/null 2>&1 rm -rf /etc/squid >/dev/null 2>&1 } [[ -d "/etc/squid3" ]] && { apt-get remove squid3 -y >/dev/null 2>&1 apt-get purge squid3 -y >/dev/null 2>&1 rm -rf /etc/squid3 >/dev/null 2>&1 apt autoremove -y >/dev/null 2>&1 } } fun_bar 'rem_sqd' echo -e "\n\033[1;32mSQUID SUCCESSFULLY REMOVED !\033[0m" sleep 2 clear fun_conexao } || { echo -e "\n\033[1;31mreturning...\033[0m" sleep 2 clear fun_conexao } else clear echo -e "\E[44;1;37m SQUID INSTALLER \E[0m" echo "" IP=$(wget -qO- ipv4.icanhazip.com) echo -ne "\033[1;32mTO CONTINUE CONFIRM YOUR IP: \033[1;37m" read -e -i $IP ipdovps [[ -z "$ipdovps" ]] && { echo -e "\n\033[1;31mInvalid IP\033[1;32m" echo "" read -p "Digite seu IP: " IP } echo -e "\n\033[1;33mWHICH DOORS DO YOU WANT TO USE ON THE SQUID \033[1;31m?" echo -e "\n\033[1;33m[\033[1;31m!\033[1;33m] \033[1;32mDEFINE THE PORTS IN SEQUENCE \033[1;33mEX: \033[1;37m80 8080" echo "" echo -ne "\033[1;32mINFORM THE PORTS\033[1;37m: " read portass [[ -z "$portass" ]] && { echo -e "\n\033[1;31mINVALID PORT!" sleep 3 fun_conexao } for porta in $(echo -e $portass); do verif_ptrs $porta done [[ $(grep -wc '14' /etc/issue.net) != '0' ]] || [[ $(grep -wc '8' /etc/issue.net) != '0' ]] && { echo -e "\n\033[1;32mINSTALLING SQUID PROXY\033[0m\n" fun_bar 'apt update -y' "apt install squid3 -y" } || { echo -e "\n\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mSQUID VERSION 3.3.X\n\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mSQUID VERSION 3.5.X\033[0m\n" read -p "$(echo -e "\033[1;32mENTER AN OPTION \033[1;37m: ")" -e -i 1 opc [[ -z "$opc" ]] && { echo -e "\n\033[1;31mInvalid option!" sleep 2 fun_conexao } [[ "$opc" != '1' ]] && { [[ "$opc" != '2' ]] && { echo -e "\n\033[1;31mInvalid option !" sleep 2 fun_conexao } } echo -e "\n\033[1;32mINSTALLING SQUID PROXY\033[0m\n" fun_bar 'apt update -y' "instsqd $opc" } if [[ -d "/etc/squid/" ]]; then var_sqd="/etc/squid/squid.conf" var_pay="/etc/squid/payload.txt" elif [[ -d "/etc/squid3/" ]]; then var_sqd="/etc/squid3/squid.conf" var_pay="/etc/squid3/payload.txt" else echo -e "\n\033[1;33m[\033[1;31mERROR!\033[1;33m]\033[1;37m: \033[1;33mSQUID PROXY CORRUPT\033[0m" sleep 2 fun_conexao fi cat <<-EOF >$var_pay .whatsapp.net/ .facebook.net/ .twitter.com/ .speedtest.net/ EOF cat <<-EOF >$var_sqd acl url1 dstdomain -i 127.0.0.1 acl url2 dstdomain -i localhost acl url3 dstdomain -i $ipdovps acl url4 dstdomain -i /VPSMANAGER? acl payload url_regex -i "$var_pay" acl all src 0.0.0.0/0 http_access allow url1 http_access allow url2 http_access allow url3 http_access allow url4 http_access allow payload http_access deny all #Portas EOF for Pts in $(echo -e $portass); do echo -e "http_port $Pts" >>$var_sqd [[ -f "/usr/sbin/ufw" ]] && ufw allow $Pts/tcp done cat <<-EOF >>$var_sqd #Nome squid visible_hostname VPSMANAGER via off forwarded_for off pipeline_prefetch off EOF sqd_conf() { [[ -d "/etc/squid/" ]] && { service ssh restart /etc/init.d/squid restart service squid restart } [[ -d "/etc/squid3/" ]] && { service ssh restart /etc/init.d/squid3 restart service squid3 restart } } echo -e "\n\033[1;32mSETTING SQUID PROXY\033[0m" echo "" fun_bar 'sqd_conf' echo -e "\n\033[1;32mSQUID INSTALLED SUCCESSFULLY!\033[0m" sleep 2.5s fun_conexao fi } addpt_sqd() { echo -e "\E[44;1;37m ADD PORT TO SQUID \E[0m" echo -e "\n\033[1;33mPORTS IN USE: \033[1;32m$sqdp\n" if [[ -f "/etc/squid/squid.conf" ]]; then var_sqd="/etc/squid/squid.conf" elif [[ -f "/etc/squid3/squid.conf" ]]; then var_sqd="/etc/squid3/squid.conf" else echo -e "\n\033[1;31mSQUID IS NOT INSTALLED!\033[0m" echo -e "\n\033[1;31mreturning...\033[0m" sleep 2 clear fun_squid fi echo -ne "\033[1;32mWHICH PORT DO YOU WANT TO ADD \033[1;33m?\033[1;37m " read pt [[ -z "$pt" ]] && { echo -e "\n\033[1;31mInvalid port!" sleep 2 clear fun_conexao } verif_ptrs $pt echo -e "\n\033[1;32mADDING PORT TO SQUID!" echo "" sed -i "s/#Portas/#Portas\nhttp_port $pt/g" $var_sqd fun_bar 'sleep 2' echo -e "\n\033[1;32mRESETTING THE SQUID!" echo "" fun_bar 'service squid restart' 'service squid3 restart' echo -e "\n\033[1;32mSUCCESSFULLY ADDED PORT!" sleep 3 clear fun_squid } rempt_sqd() { echo -e "\E[41;1;37m REMOVE PORT FROM SQUID \E[0m" echo -e "\n\033[1;33mPORTAS EM USO: \033[1;32m$sqdp\n" if [[ -f "/etc/squid/squid.conf" ]]; then var_sqd="/etc/squid/squid.conf" elif [[ -f "/etc/squid3/squid.conf" ]]; then var_sqd="/etc/squid3/squid.conf" else echo -e "\n\033[1;31mSQUID IS NOT INSTALLED!\033[0m" echo -e "\n\033[1;31mreturning...\033[0m" sleep 2 clear fun_squid fi echo -ne "\033[1;32mWHICH PORT DO YOU WANT TO REMOVE \033[1;33m?\033[1;37m " read pt [[ -z "$pt" ]] && { echo -e "\n\033[1;31mInvalid port!" sleep 2 clear fun_conexao } if grep -E "$pt" $var_sqd >/dev/null 2>&1; then echo -e "\n\033[1;32mREMOVING SQUID PORT!" echo "" sed -i "/http_port $pt/d" $var_sqd fun_bar 'sleep 3' echo -e "\n\033[1;32mRESETTING THE SQUID!" echo "" fun_bar 'service squid restart' 'service squid3 restart' echo -e "\n\033[1;32mPORT SUCCESSFULLY REMOVED!" sleep 3.5s clear fun_squid else echo -e "\n\033[1;31mPORT \033[1;32m$pt \033[1;31mNOT FOUND!" sleep 3.5s clear fun_squid fi } fun_squid() { [[ "$(netstat -nplt | grep -c 'squid')" = "0" ]] && inst_sqd echo -e "\E[44;1;37m MANAGE SQUID PROXY \E[0m" [[ "$(netstat -nplt | grep -c 'squid')" != "0" ]] && { sqdp=$(netstat -nplt | grep 'squid' | awk -F ":" {'print $4'} | xargs) echo -e "\n\033[1;33mPORTS\033[1;37m: \033[1;32m$sqdp" VarSqdOn="REMOVER SQUID PROXY" } || { VarSqdOn="INSTALAR SQUID PROXY" } echo -e "\n\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33m$VarSqdOn \033[1;31m [\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mADD PORT \033[1;31m [\033[1;36m3\033[1;31m] \033[1;37m• \033[1;33mREMOVE PORT\033[1;31m [\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;31m?\033[1;37m " read x clear case $x in 1 | 01) inst_sqd ;; 2 | 02) addpt_sqd ;; 3 | 03) rempt_sqd ;; 0 | 00) echo -e "\033[1;31mreturning...\033[0m" sleep 1 fun_conexao ;; *) echo -e "\033[1;31mInvalid option...\033[0m" sleep 2 fun_conexao ;; esac } fun_drop() { if netstat -nltp | grep 'dropbear' 1>/dev/null 2>/dev/null; then clear [[ $(netstat -nltp | grep -c 'dropbear') != '0' ]] && dpbr=$(netstat -nplt | grep 'dropbear' | awk -F ":" {'print $4'} | xargs) || sqdp="\033[1;31mINDISPONIVEL" if ps x | grep "limiter" | grep -v grep 1>/dev/null 2>/dev/null; then stats='\033[1;32m♦ ' else stats='\033[1;31m○ ' fi echo -e "\E[44;1;37m MANAGE DROPBEAR \E[0m" echo -e "\n\033[1;33mPORTAS\033[1;37m: \033[1;32m$dpbr" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mDROPBEAR LIMITER $stats\033[0m" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mCHANGE DROPBEAR PORT\033[0m" echo -e "\033[1;31m[\033[1;36m3\033[1;31m] \033[1;37m• \033[1;33mREMOVE DROPBEAR\033[0m" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;37m " read resposta if [[ "$resposta" = '1' ]]; then clear if ps x | grep "limiter" | grep -v grep 1>/dev/null 2>/dev/null; then echo -e "\033[1;32mstopping the limiter... \033[0m" echo "" fun_stplimiter() { pidlimiter=$(ps x | grep "limiter" | awk -F "pts" {'print $1'}) kill -9 $pidlimiter screen -wipe } fun_bar 'fun_stplimiter' 'sleep 2' echo -e "\n\033[1;31m LIMIT DISABLED \033[0m" sleep 3 fun_drop else echo -e "\n\033[1;32mStarting the limiter... \033[0m" echo "" fun_bar 'screen -d -m -t limiter droplimiter' 'sleep 3' echo -e "\n\033[1;32m LIMITER ENABLED \033[0m" sleep 3 fun_drop fi elif [[ "$resposta" = '2' ]]; then echo "" echo -ne "\033[1;32mWHICH PORT YOU WANT TO USE \033[1;33m?\033[1;37m " read pt echo "" verif_ptrs $pt var1=$(grep 'DROPBEAR_PORT=' /etc/default/dropbear | cut -d'=' -f2) echo -e "\033[1;32mCHANGING DROPBEAR PORT!" sed -i "s/\b$var1\b/$pt/g" /etc/default/dropbear >/dev/null 2>&1 echo "" fun_bar 'sleep 2' echo -e "\n\033[1;32mRESTARTING DROPBEAR!" echo "" fun_bar 'service dropbear restart' '/etc/init.d/dropbear restart' echo -e "\n\033[1;32mSUCCESSFULLY CHANGED PORT!" sleep 3 clear fun_conexao elif [[ "$resposta" = '3' ]]; then echo -e "\n\033[1;32mREMOVING THE DROPBEAR!\033[0m" echo "" fun_dropunistall() { service dropbear stop && /etc/init.d/dropbear stop apt-get autoremove dropbear -y apt-get remove dropbear-run -y apt-get remove dropbear -y apt-get purge dropbear -y rm -rf /etc/default/dropbear } fun_bar 'fun_dropunistall' echo -e "\n\033[1;32mSUCCESSFULLY REMOVED DROPBEAR !\033[0m" sleep 3 clear fun_conexao elif [[ "$resposta" = '0' ]]; then echo -e "\n\033[1;31mReturning...\033[0m" sleep 2 fun_conexao else echo -e "\n\033[1;31mInvalid option...\033[0m" sleep 2 fun_conexao fi else clear echo -e "\E[44;1;37m DROPBEAR INSTALLER \E[0m" echo -e "\n\033[1;33mVC ARE ABOUT TO INSTALL DROPBEAR !\033[0m\n" echo -ne "\033[1;32mDO YOU WISH TO CONTINUE \033[1;31m? \033[1;33m[s/n]:\033[1;37m " read resposta [[ "$resposta" = 's' ]] && { echo -e "\n\033[1;33mDEFINE A PORT FOR DROPBEAR !\033[0m\n" echo -ne "\033[1;32mWHICH PORT \033[1;33m?\033[1;37m " read porta [[ -z "$porta" ]] && { echo -e "\n\033[1;31mInvalid port!" sleep 3 clear fun_conexao } verif_ptrs $porta echo -e "\n\033[1;32mINSTALLING DROPBEAR ! \033[0m" echo "" fun_instdrop() { apt-get update -y apt-get install dropbear -y } fun_bar 'fun_instdrop' fun_ports() { sed -i 's/NO_START=1/NO_START=0/g' /etc/default/dropbear >/dev/null 2>&1 sed -i "s/DROPBEAR_PORT=22/DROPBEAR_PORT=$porta/g" /etc/default/dropbear >/dev/null 2>&1 sed -i 's/DROPBEAR_EXTRA_ARGS=/DROPBEAR_EXTRA_ARGS="-p 110"/g' /etc/default/dropbear >/dev/null 2>&1 } echo "" echo -e "\033[1;32mSETTING PORT DROPBEAR!\033[0m" echo "" fun_bar 'fun_ports' grep -v "^PasswordAuthentication yes" /etc/ssh/sshd_config >/tmp/passlogin && mv /tmp/passlogin /etc/ssh/sshd_config echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config grep -v "^PermitTunnel yes" /etc/ssh/sshd_config >/tmp/ssh && mv /tmp/ssh /etc/ssh/sshd_config echo "PermitTunnel yes" >>/etc/ssh/sshd_config echo "" echo -e "\033[1;32mFINISHING INSTALLATION !\033[0m" echo "" fun_ondrop() { service dropbear start /etc/init.d/dropbear restart } fun_bar 'fun_ondrop' 'sleep 1' echo -e "\n\033[1;32mINSTALLATION COMPLETED \033[1;33mPORT: \033[1;37m$porta\033[0m" [[ $(grep -c "/bin/false" /etc/shells) = '0' ]] && echo "/bin/false" >>/etc/shells sleep 2 clear fun_conexao } || { echo"" echo -e "\033[1;31mReturning...\033[0m" sleep 3 clear fun_conexao } fi } fun_chisel() { clear echo -e "\E[44;1;37m MANAGE CHISEL \E[0m" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mACTIVATE CHISEL\033[0m" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mRESET CHISEL\033[0m" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;37m " read resposta if [[ "$resposta" = '1' ]]; then if netstat -nltp | grep 'docker' 1>/dev/null 2>/dev/null; then clear echo -e "\E[41;1;37m CHISEL \E[0m" echo "" fun_chiseloff() { docker stop chisel docker rm chisel docker.io stop chisel docker.io rm chisel } echo -e "\033[1;32mDISABLING CHISEL\033[1;33m" echo "" fun_bar 'fun_chiseloff' echo "" echo -e "\033[1;32mCHISEL SUCCESSFULLY DISABLED!\033[1;33m" sleep 3 fun_chisel else clear fun_installdocker() { _pacotes=("docker" "docker.io") for _prog in ${_pacotes[@]}; do apt install $_prog -y done } echo -e "\n${YELLOW}BE AWARE THAT THIS METHOD IS UNSTABLE\nMAY OR MAY NOT WORK ON YOUR MACHINE\nBE AWARE OF THE RISKS ! ${SCOLOR}\n" echo -ne "${GREEN}WISH TO CONTINUE INSTALLATION ? ${YELLOW}[s/n]:${SCOLOR} " read resp [[ "$resp" != @(s|sim|S|SIM) ]] && { echo -e "\n${RED}Returning...${SCOLOR}" sleep 2 conexao } echo -e "\n\033[1;32mSupported Ubuntu 16+\033[1;33m" echo -e "\n\033[1;32mINSTALLING CHISEL !\033[1;33m" echo "" fun_bar 'fun_installdocker' clear echo -e "\E[44;1;37m CHISEL \E[0m" echo "" echo -ne "\033[1;32mWHICH PORT DO YOU WANT TO USE \033[1;33m?\033[1;37m: " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 3 clear fun_chisel } verif_ptrs $porta clear echo -ne "\033[1;32mUsername:\033[1;37m ";read username [[ -z $username ]] && { echo -e "\n${cor1}Empty or invalid username!${scor}\n" fun_chisel } [[ ${username} != ?(+|-)+([a-zA-Z0-9]) ]] && { echo -e "\n${cor1}You entered an invalid username!${scor}" echo -e "${cor1}Do not use spaces, accents or special characters!${scor}\n" fun_chisel } sizemin=$(echo ${#username}) [[ $sizemin -lt 2 ]] && { echo -e "\n${cor1}You entered too short a username${scor}" echo -e "${cor1}use at least two characters!${scor}\n" fun_chisel } sizemax=$(echo ${#username}) [[ $sizemax -gt 10 ]] && { echo -e "\n${cor1}You entered a very large username" echo -e "${cor1}use a maximum of 10 characters!${scor}\n" fun_chisel } echo -ne "\033[1;32mPassword:\033[1;37m ";read password [[ -z $password ]] && { echo -e "\n${cor1}Empty or invalid password!${scor}\n" fun_chisel } sizepass=$(echo ${#password}) [[ $sizepass -lt 4 ]] && { echo -e "\n${cor1}Short password!, use at least 4 characters${scor}\n" fun_chisel } echo -e "\n\033[1;32mSETTING CHISEL !\033[0m" echo "" fun_inichisel() { docker run --name chisel -p $porta:$porta -d --restart always jpillora/chisel server -p $porta --socks5 --key supersecret --auth "$username:$password" docker.io run --name chisel -p $porta:$porta -d --restart always jpillora/chisel server -p $porta --socks5 --key supersecret --auth "$username:$password" } fun_bar 'fun_inichisel' clear echo -e "\n\033[1;32mSUCCESSFULLY INSTALLED CHISEL!\033[1;31m PORT: \033[1;33m${porta}\033[0m" sleep 3 clear fun_chisel fi elif [[ "$resposta" = '2' ]]; then clear echo -e "\n\033[1;32mRESETTING CHISEL !\033[1;33m" echo "" fun_attchisel() { docker restart chisel docker.io restart chisel } fun_attchisel clear echo -e "\n\033[1;32mCHISEL RESTARTING SUCCESSFULLY !\033[1;33m" sleep 1 fun_chisel elif [[ "$resposta" = '0' ]]; then echo "" echo -e "\033[1;31mreturning...\033[0m" sleep 1 fun_conexao else echo "" echo -e "\033[1;31mInvalid option !\033[0m" sleep 1 fun_socks fi } inst_ssl() { if netstat -nltp | grep 'stunnel4' 1>/dev/null 2>/dev/null; then [[ $(netstat -nltp | grep 'stunnel4' | wc -l) != '0' ]] && sslt=$(netstat -nplt | grep stunnel4 | awk {'print $4'} | awk -F ":" {'print $2'} | xargs) || sslt="\033[1;31mINDISPONIVEL" echo -e "\E[44;1;37m MANAGE SSL TUNNEL \E[0m" echo -e "\n\033[1;33mPORTAS\033[1;37m: \033[1;32m$sslt" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mCHANGE PORT SSL TUNNEL\033[0m" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mREMOVE SSL TUNNEL\033[0m" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;37m " read resposta echo "" [[ "$resposta" = '1' ]] && { echo -ne "\033[1;32mWHICH PORT YOU WANT TO USE \033[1;33m?\033[1;37m " read porta echo "" [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 2 clear fun_conexao } verif_ptrs $porta echo -e "\033[1;32mCHANGING PORT SSL TUNNEL!" var2=$(grep 'accept' /etc/stunnel/stunnel.conf | awk '{print $NF}') sed -i "s/\b$var2\b/$porta/g" /etc/stunnel/stunnel.conf >/dev/null 2>&1 echo "" fun_bar 'sleep 2' echo "" echo -e "\033[1;32mRESETTING SSL TUNNEL!\n" fun_bar 'service stunnel4 restart' '/etc/init.d/stunnel4 restart' echo "" netstat -nltp | grep 'stunnel4' >/dev/null && echo -e "\033[1;32mSUCCESSFULLY CHANGED PORT!" || echo -e "\033[1;31mUNEXPECTED ERROR!" sleep 3.5s clear fun_conexao } [[ "$resposta" = '2' ]] && { echo -e "\033[1;32mREMOVING SSL TUNNEL !\033[0m" del_ssl() { service stunnel4 stop apt-get remove stunnel4 -y apt-get autoremove stunnel4 -y apt-get purge stunnel4 -y rm -rf /etc/stunnel/stunnel.conf rm -rf /etc/default/stunnel4 rm -rf /etc/stunnel/stunnel.pem } echo "" fun_bar 'del_ssl' echo "" echo -e "\033[1;32mSSL TUNNEL SUCCESSFULLY REMOVED!\033[0m" sleep 3 fun_conexao } || { echo -e "\033[1;31mReturning...\033[0m" sleep 3 fun_conexao } else clear echo -e "\E[44;1;37m INSTALL SSL TUNNEL \E[0m" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mINSTALL SSL TUNNEL STANDARD\033[0m" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mINSTALL SSL TUNNEL WEBSOCKET\033[0m" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;37m " read resposta echo "" if [[ "$resposta" = '1' ]]; then portssl='22' elif [[ "$resposta" = '2' ]]; then portssl='80' elif [[ "$resposta" = '0' ]]; then echo -e "\033[1;31mReturning...\033[0m" sleep 3 fun_conexao else echo "" echo -e "\033[1;31mInvalid option !\033[0m" sleep 1 inst_ssl fi clear echo -e "\E[44;1;37m SSL TUNNEL INSTALLER \E[0m" echo -e "\n\033[1;33mVC ARE ABOUT TO INSTALL SSL TUNNEL !\033[0m" echo "" echo -ne "\033[1;32mDO YOU WISH TO CONTINUE \033[1;31m? \033[1;33m[s/n]:\033[1;37m " read resposta [[ "$resposta" = 's' ]] && { echo -e "\n\033[1;33mDEFINE A PORT FOR SSL TUNNEL !\033[0m" echo "" echo -ne "\033[1;32mWHICH PORT YOU WANT TO USE \033[1;33m?\033[1;37m " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 3 clear fun_conexao } verif_ptrs $porta echo -e "\n\033[1;32mINSTALLING SSL TUNNEL !\033[1;33m" echo "" fun_bar 'apt-get update -y' 'apt-get install stunnel4 -y' echo -e "\n\033[1;32mCONFIGURING SSL TUNNEL !\033[0m" echo "" ssl_conf() { echo -e "cert = /etc/stunnel/stunnel.pem\nclient = no\nsocket = a:SO_REUSEADDR=1\nsocket = l:TCP_NODELAY=1\nsocket = r:TCP_NODELAY=1\n\n[stunnel]\nconnect = 127.0.0.1:$portssl\naccept = ${porta}" >/etc/stunnel/stunnel.conf } fun_bar 'ssl_conf' echo -e "\n\033[1;32mCREATING CERTIFICATE!\033[0m" echo "" ssl_certif() { #crt='EC' #openssl genrsa -out key.pem 2048 >/dev/null 2>&1 #( #echo $crt #echo $crt #echo $crt #echo $crt #echo $crt #echo $crt #echo $crt #) | openssl req -new -x509 -key key.pem -out cert.pem -days 1050 >/dev/null 2>&1 #cat cert.pem key.pem >>/etc/stunnel/stunnel.pem #rm key.pem cert.pem >/dev/null 2>&1 sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4 cd /etc/stunnel && wget https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Sistema/script/stunnel.pem && cd $HOME } fun_bar 'ssl_certif' echo -e "\n\033[1;32mSTARTING SSL TUNNEL !\033[0m" echo "" fun_finssl() { service stunnel4 restart service ssh restart /etc/init.d/stunnel4 restart } fun_bar 'fun_finssl' 'service stunnel4 restart' echo -e "\n\033[1;32mSSL TUNNEL SUCCESSFULLY INSTALLED !\033[1;31m PORT: \033[1;33m$porta\033[0m" sleep 3 clear fun_conexao } || { echo -e "\n\033[1;31mReturning...\033[0m" sleep 2 clear fun_conexao } fi } fun_openvpn() { if readlink /proc/$$/exe | grep -qs "dash"; then echo "This script needs to be run with bash, not sh" exit 1 fi [[ "$EUID" -ne 0 ]] && { clear echo "run as root" exit 2 } [[ ! -e /dev/net/tun ]] && { echo -e "\033[1;31mTUN TAP NOT AVAILABLE\033[0m" sleep 2 exit 3 } if grep -qs "CentOS release 5" "/etc/redhat-release"; then echo "CentOS 5 is too old and not supported" exit 4 fi if [[ -e /etc/debian_version ]]; then OS=debian GROUPNAME=nogroup RCLOCAL='/etc/rc.local' elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then OS=centos GROUPNAME=nobody RCLOCAL='/etc/rc.d/rc.local' else echo -e "SYSTEM NOT SUPPORTED" exit 5 fi newclient() { # gerar client.ovpn cp /etc/openvpn/client-common.txt ~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/ca.crt >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/private/$1.key >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/ta.key >>~/$1.ovpn echo "" >>~/$1.ovpn } IP1=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) IP2=$(wget -4qO- "http://whatismyip.akamai.com/") [[ "$IP1" = "" ]] && { IP1=$(hostname -I | cut -d' ' -f1) } [[ "$IP1" != "$IP2" ]] && { IP="$IP1" } || { IP="$IP2" } [[ $(netstat -nplt | grep -wc 'openvpn') != '0' ]] && { while :; do clear opnp=$(cat /etc/openvpn/server.conf | grep "port" | awk {'print $2'}) [[ -d /var/www/html/openvpn ]] && { ovpnweb=$(echo -e "\033[1;32m♦ ") } || { ovpnweb=$(echo -e "\033[1;31m○ ") } if grep "duplicate-cn" /etc/openvpn/server.conf >/dev/null; then mult=$(echo -e "\033[1;32m♦ ") else mult=$(echo -e "\033[1;31m○ ") fi echo -e "\E[44;1;37m MANAGE OPENVPN \E[0m" echo "" echo -e "\033[1;33mPORT\033[1;37m: \033[1;32m$opnp" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mCHANGE PORT" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mREMOVE OPENVPN" echo -e "\033[1;31m[\033[1;36m3\033[1;31m] \033[1;37m• \033[1;33mOVPN VIA LINK $ovpnweb" echo -e "\033[1;31m[\033[1;36m4\033[1;31m] \033[1;37m• \033[1;33mMULTILOGIN OVPN $mult" echo -e "\033[1;31m[\033[1;36m5\033[1;31m] \033[1;37m• \033[1;33mCHANGE HOST DNS" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;31m?\033[1;37m " read option case $option in 1) clear echo -e "\E[44;1;37m CHANGE PORT OPENVPN \E[0m" echo "" echo -e "\033[1;33mPORT IN USE: \033[1;32m$opnp" echo "" echo -ne "\033[1;32mWHICH PORT DO YOU WANT TO USE \033[1;33m?\033[1;37m " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 3 fun_conexao } verif_ptrs echo "" echo -e "\033[1;32mCHANGING THE PORT OPENVPN!\033[1;33m" echo "" fun_opn() { var_ptovpn=$(sed -n '1 p' /etc/openvpn/server.conf) sed -i "s/\b$var_ptovpn\b/port $porta/g" /etc/openvpn/server.conf sleep 1 var_ptovpn2=$(sed -n '7 p' /etc/openvpn/client-common.txt | awk {'print $NF'}) sed -i "s/\b$var_ptovpn2/\b$porta/g" /etc/openvpn/client-common.txt sleep 1 service openvpn restart } fun_bar 'fun_opn' echo "" echo -e "\033[1;32mSUCCESSFULLY CHANGED PORT!\033[1;33m" sleep 2 fun_conexao ;; 2) echo "" echo -ne "\033[1;32mWANT TO REMOVE OPENVPN \033[1;31m? \033[1;33m[s/n]:\033[1;37m " read REMOVE [[ "$REMOVE" = 's' ]] && { rmv_open() { PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2) PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2) IP=$(grep 'iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to ' $RCLOCAL | cut -d " " -f 11) if pgrep firewalld; then firewall-cmd --zone=public --remove-port=$PORT/$PROTOCOL firewall-cmd --zone=trusted --remove-source=10.8.0.0/24 firewall-cmd --permanent --zone=public --remove-port=$PORT/$PROTOCOL firewall-cmd --permanent --zone=trusted --remove-source=10.8.0.0/24 fi if iptables -L -n | grep -qE 'REJECT|DROP|ACCEPT'; then iptables -D INPUT -p $PROTOCOL --dport $PORT -j ACCEPT iptables -D FORWARD -s 10.8.0.0/24 -j ACCEPT iptables -D FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT sed -i "/iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT/d" $RCLOCAL sed -i "/iptables -I FORWARD -s 10.8.0.0\/24 -j ACCEPT/d" $RCLOCAL sed -i "/iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT/d" $RCLOCAL fi iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0\/24 -j SNAT --to /d' $RCLOCAL if hash sestatus 2>/dev/null; then if sestatus | grep "Current mode" | grep -qs "enforcing"; then if [[ "$PORT" != '1194' || "$PROTOCOL" = 'tcp' ]]; then semanage port -d -t openvpn_port_t -p $PROTOCOL $PORT fi fi fi [[ "$OS" = 'debian' ]] && { apt-get remove --purge -y openvpn openvpn-blacklist apt-get autoremove openvpn -y apt-get autoremove -y } || { yum remove openvpn -y } rm -rf /etc/openvpn rm -rf /usr/share/doc/openvpn* } echo "" echo -e "\033[1;32mREMOVING OPENVPN!\033[0m" echo "" fun_bar 'rmv_open' echo "" echo -e "\033[1;32mOPENVPN SUCCESSFULLY REMOVED!\033[0m" sleep 2 fun_conexao } || { echo "" echo -e "\033[1;31mReturning...\033[0m" sleep 2 fun_conexao } ;; 3) [[ -d /var/www/html/openvpn ]] && { clear fun_spcr() { apt-get remove apache2 -y apt-get autoremove -y rm -rf /var/www/html/openvpn } function aguarde() { helice() { fun_spcr >/dev/null 2>&1 & tput civis while [ -d /proc/$! ]; do for i in / - \\ \|; do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo -ne "\033[1;31mDISABLING\033[1;32m.\033[1;33m.\033[1;31m. \033[1;33m" helice echo -e "\e[1DOk" } aguarde sleep 2 fun_openvpn } || { clear fun_apchon() { apt-get install apache2 zip -y sed -i "s/Listen 80/Listen 81/g" /etc/apache2/ports.conf service apache2 restart [[ ! -d /var/www/html ]] && { mkdir /var/www/html } [[ ! -d /var/www/html/openvpn ]] && { mkdir /var/www/html/openvpn } touch /var/www/html/openvpn/index.html chmod -R 755 /var/www /etc/init.d/apache2 restart } function aguarde2() { helice() { fun_apchon >/dev/null 2>&1 & tput civis while [ -d /proc/$! ]; do for i in / - \\ \|; do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo -ne "\033[1;32mACTIVATING\033[1;32m.\033[1;33m.\033[1;31m. \033[1;33m" helice echo -e "\e[1DOk" } aguarde2 fun_openvpn } ;; 4) if grep "duplicate-cn" /etc/openvpn/server.conf >/dev/null; then clear fun_multon() { sed -i '/duplicate-cn/d' /etc/openvpn/server.conf sleep 1.5s service openvpn restart >/dev/null sleep 2 } fun_spinmult() { helice() { fun_multon >/dev/null 2>&1 & tput civis while [ -d /proc/$! ]; do for i in / - \\ \|; do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo "" echo -ne "\033[1;31mMULTILOGIN BLOCK\033[1;32m.\033[1;33m.\033[1;31m. \033[1;33m" helice echo -e "\e[1DOk" } fun_spinmult sleep 1 fun_openvpn else clear fun_multoff() { grep -v "^duplicate-cn" /etc/openvpn/server.conf >/tmp/tmpass && mv /tmp/tmpass /etc/openvpn/server.conf echo "duplicate-cn" >>/etc/openvpn/server.conf sleep 1.5s service openvpn restart >/dev/null } fun_spinmult2() { helice() { fun_multoff >/dev/null 2>&1 & tput civis while [ -d /proc/$! ]; do for i in / - \\ \|; do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo "" echo -ne "\033[1;32mALLOWING MULTILOGIN\033[1;32m.\033[1;33m.\033[1;31m. \033[1;33m" helice echo -e "\e[1DOk" } fun_spinmult2 sleep 1 fun_openvpn fi ;; 5) clear echo -e "\E[44;1;37m CHANGE DNS HOST \E[0m" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mADD HOST DNS" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mREMOVE HOST DNS" echo -e "\033[1;31m[\033[1;36m3\033[1;31m] \033[1;37m• \033[1;33mEDIT MANUALLY" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;31m?\033[1;37m " read resp [[ -z "$resp" ]] && { echo "" echo -e "\033[1;31mInvalid option!" sleep 3 fun_openvpn } if [[ "$resp" = '1' ]]; then clear echo -e "\E[44;1;37m Add DNS Host \E[0m" echo "" echo -e "\033[1;33mList of current hosts:\033[0m " echo "" i=0 for _host in $(grep -w "127.0.0.1" /etc/hosts | grep -v "localhost" | cut -d' ' -f2); do echo -e "\033[1;32m$_host" done echo "" echo -ne "\033[1;33mEnter the host to be added\033[1;37m : " read host if [[ -z $host ]]; then echo "" echo -e "\E[41;1;37m Empty or invalid field ! \E[0m" sleep 2 fun_openvpn fi if [[ "$(grep -w "$host" /etc/hosts | wc -l)" -gt "0" ]]; then echo -e "\E[41;1;37m This host is already added ! \E[0m" sleep 2 fun_openvpn fi sed -i "3i\127.0.0.1 $host" /etc/hosts echo "" echo -e "\E[44;1;37m Host added successfully! \E[0m" sleep 2 fun_openvpn elif [[ "$resp" = '2' ]]; then clear echo -e "\E[44;1;37m DNS Host Remover \E[0m" echo "" echo -e "\033[1;33mList of current hosts:\033[0m " echo "" i=0 for _host in $(grep -w "127.0.0.1" /etc/hosts | grep -v "localhost" | cut -d' ' -f2); do i=$(expr $i + 1) oP+=$i [[ $i == [1-9] ]] && oP+=" 0$i" && i=0$i oP+=":$_host\n" echo -e "\033[1;33m[\033[1;31m$i\033[1;33m] \033[1;37m- \033[1;32m$_host\033[0m" done echo "" echo -ne "\033[1;32mSelect the host to be removed \033[1;33m[\033[1;37m1\033[1;31m-\033[1;37m$i\033[1;33m]\033[1;37m: " read option if [[ -z $option ]]; then echo "" echo -e "\E[41;1;37m Invalid option ! \E[0m" sleep 2 fun_openvpn fi host=$(echo -e "$oP" | grep -E "\b$option\b" | cut -d: -f2) hst=$(grep -v "127.0.0.1 $host" /etc/hosts) echo "$hst" >/etc/hosts echo "" echo -e "\E[41;1;37m Host removed successfully ! \E[0m" sleep 2 fun_openvpn elif [[ "$resp" = '3' ]]; then echo -e "\n\033[1;32mCHANGING FILE \033[1;37m/etc/hosts\033[0m" echo -e "\n\033[1;31mATTENTION!\033[0m" echo -e "\n\033[1;33mTO SAVE USE KEYS \033[1;32mctrl x y\033[0m" sleep 4 clear nano /etc/hosts echo -e "\n\033[1;32mSUCCESSFULLY CHANGED!\033[0m" sleep 3 fun_openvpn elif [[ "$resp" = '0' ]]; then echo "" echo -e "\033[1;31mreturning...\033[0m" sleep 2 fun_conexao else echo "" echo -e "\033[1;31mInvalid option!\033[0m" sleep 2 fun_openvpn fi ;; 0) fun_conexao ;; *) echo "" echo -e "\033[1;31mInvalid option !\033[0m" sleep 2 fun_openvpn ;; esac done } || { clear echo -e "\E[44;1;37m OPENVPN INSTALLER \E[0m" echo "" echo -e "\033[1;33mANSWER THE QUESTIONS TO START THE INSTALLATION" echo "" echo -ne "\033[1;32mTO CONTINUE CONFIRM YOUR IP: \033[1;37m" read -e -i $IP IP [[ -z "$IP" ]] && { echo "" echo -e "\033[1;31mInvalid IP!" sleep 3 fun_conexao } echo "" read -p "$(echo -e "\033[1;32mWHICH PORT DO YOU WANT TO USE? \033[1;37m")" -e -i 1194 porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 2 fun_conexao } echo "" echo -e "\033[1;33mVERIFYING PORT..." verif_ptrs $porta echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;33mSystem" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;33mGoogle (\033[1;32mRecommended\033[1;33m)" echo -e "\033[1;31m[\033[1;36m3\033[1;31m] \033[1;33mOpenDNS" echo -e "\033[1;31m[\033[1;36m4\033[1;31m] \033[1;33mCloudflare" echo -e "\033[1;31m[\033[1;36m5\033[1;31m] \033[1;33mHurricane Electric" echo -e "\033[1;31m[\033[1;36m6\033[1;31m] \033[1;33mVerisign" echo -e "\033[1;31m[\033[1;36m7\033[1;31m] \033[1;33mDNS Performace\033[0m" echo "" read -p "$(echo -e "\033[1;32mWHICH DNS DO YOU WANT TO USE? \033[1;37m")" -e -i 2 DNS echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;33mUDP" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;33mTCP (\033[1;32mRecommended\033[1;33m)" echo "" read -p "$(echo -e "\033[1;32mWHICH PROTOCOL DO YOU WANT TO USE IN OPENVPN? \033[1;37m")" -e -i 2 resp if [[ "$resp" = '1' ]]; then PROTOCOL=udp elif [[ "$resp" = '2' ]]; then PROTOCOL=tcp else PROTOCOL=tcp fi echo "" [[ "$OS" = 'debian' ]] && { echo -e "\033[1;32mUPDATING THE SYSTEM" echo "" fun_attos() { apt-get update-y } fun_bar 'fun_attos' echo "" echo -e "\033[1;32mINSTALLING DEPENDENCES" echo "" fun_instdep() { apt-get install openvpn iptables openssl ca-certificates -y apt-get install zip -y } fun_bar 'fun_instdep' } || { fun_bar 'yum install epel-release -y' fun_bar 'yum install openvpn iptables openssl wget ca-certificates -y' } [[ -d /etc/openvpn/easy-rsa/ ]] && { rm -rf /etc/openvpn/easy-rsa/ } # Adquirindo easy-rsa echo "" fun_dep() { wget -O ~/EasyRSA-3.0.1.tgz "https://github.com/januda-ui/DRAGON-VPS-MANAGER/raw/main/Install/EasyRSA-3.0.1.tgz" [[ ! -e $HOME/EasyRSA-3.0.1.tgz ]] && { wget -O ~/EasyRSA-3.0.1.tgz "http://sshplus.xyz/script/EasyRSA-3.0.1.tgz" } tar xzf ~/EasyRSA-3.0.1.tgz -C ~/ mv ~/EasyRSA-3.0.1/ /etc/openvpn/ mv /etc/openvpn/EasyRSA-3.0.1/ /etc/openvpn/easy-rsa/ chown -R root:root /etc/openvpn/easy-rsa/ rm -rf ~/EasyRSA-3.0.1.tgz cd /etc/openvpn/easy-rsa/ ./easyrsa init-pki ./easyrsa --batch build-ca nopass ./easyrsa gen-dh ./easyrsa build-server-full server nopass ./easyrsa build-client-full VPSMANAGER nopass ./easyrsa gen-crl cp pki/ca.crt pki/private/ca.key pki/dh.pem pki/issued/server.crt pki/private/server.key /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn chown nobody:$GROUPNAME /etc/openvpn/crl.pem openvpn --genkey --secret /etc/openvpn/ta.key # Generando server.conf echo "port $porta proto $PROTOCOL dev tun sndbuf 0 rcvbuf 0 ca ca.crt cert server.crt key server.key dh dh.pem tls-auth ta.key 0 topology subnet server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt" >/etc/openvpn/server.conf echo 'push "redirect-gateway def1 bypass-dhcp"' >>/etc/openvpn/server.conf # DNS case $DNS in 1) # Obtain the resolvers from resolv.conf and use them for OpenVPN grep -v '#' /etc/resolv.conf | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read line; do echo "push \"dhcp-option DNS $line\"" >>/etc/openvpn/server.conf done ;; 2) echo 'push "dhcp-option DNS 8.8.8.8"' >>/etc/openvpn/server.conf echo 'push "dhcp-option DNS 8.8.4.4"' >>/etc/openvpn/server.conf ;; 3) echo 'push "dhcp-option DNS 208.67.222.222"' >>/etc/openvpn/server.conf echo 'push "dhcp-option DNS 208.67.220.220"' >>/etc/openvpn/server.conf ;; 4) echo 'push "dhcp-option DNS 1.1.1.1"' >>/etc/openvpn/server.conf echo 'push "dhcp-option DNS 1.0.0.1"' >>/etc/openvpn/server.conf ;; 5) echo 'push "dhcp-option DNS 74.82.42.42"' >>/etc/openvpn/server.conf ;; 6) echo 'push "dhcp-option DNS 64.6.64.6"' >>/etc/openvpn/server.conf echo 'push "dhcp-option DNS 64.6.65.6"' >>/etc/openvpn/server.conf ;; 7) echo 'push "dhcp-option DNS 189.38.95.95"' >>/etc/openvpn/server.conf echo 'push "dhcp-option DNS 216.146.36.36"' >>/etc/openvpn/server.conf ;; esac echo "keepalive 10 120 float cipher AES-256-CBC comp-lzo yes user nobody group $GROUPNAME persist-key persist-tun status openvpn-status.log management localhost 7505 verb 3 crl-verify crl.pem client-to-client client-cert-not-required username-as-common-name plugin $(find /usr -type f -name 'openvpn-plugin-auth-pam.so') login duplicate-cn" >>/etc/openvpn/server.conf sed -i '/\/c\net.ipv4.ip_forward=1' /etc/sysctl.conf if ! grep -q "\" /etc/sysctl.conf; then echo 'net.ipv4.ip_forward=1' >>/etc/sysctl.conf fi echo 1 >/proc/sys/net/ipv4/ip_forward if [[ "$OS" = 'debian' && ! -e $RCLOCAL ]]; then echo '#!/bin/sh -e exit 0' >$RCLOCAL fi chmod +x $RCLOCAL iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL if pgrep firewalld; then firewall-cmd --zone=public --add-port=$porta/$PROTOCOL firewall-cmd --zone=trusted --add-source=10.8.0.0/24 firewall-cmd --permanent --zone=public --add-port=$porta/$PROTOCOL firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24 fi if iptables -L -n | grep -qE 'REJECT|DROP'; then iptables -I INPUT -p $PROTOCOL --dport $porta -j ACCEPT iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT iptables -F iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT sed -i "1 a\iptables -I INPUT -p $PROTOCOL --dport $porta -j ACCEPT" $RCLOCAL sed -i "1 a\iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT" $RCLOCAL sed -i "1 a\iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT" $RCLOCAL fi if hash sestatus 2>/dev/null; then if sestatus | grep "Current mode" | grep -qs "enforcing"; then if [[ "$porta" != '1194' || "$PROTOCOL" = 'tcp' ]]; then if ! hash semanage 2>/dev/null; then yum install policycoreutils-python -y fi semanage port -a -t openvpn_port_t -p $PROTOCOL $porta fi fi fi } echo -e "\033[1;32mINSTALLING OPENVPN \033[1;31m(\033[1;33mMAY TAKE TIME!\033[1;31m)" echo "" fun_bar 'fun_dep > /dev/null 2>&1' fun_ropen() { [[ "$OS" = 'debian' ]] && { if pgrep systemd-journal; then systemctl restart openvpn@server.service else /etc/init.d/openvpn restart fi } || { if pgrep systemd-journal; then systemctl restart openvpn@server.service systemctl enable openvpn@server.service else service openvpn restart chkconfig openvpn on fi } } echo "" echo -e "\033[1;32mRESTARTING OPENVPN" echo "" fun_bar 'fun_ropen' IP2=$(wget -4qO- "http://whatismyip.akamai.com/") if [[ "$IP" != "$IP2" ]]; then IP="$IP2" fi [[ $(grep -wc 'open.py' /etc/autostart) != '0' ]] && pt_proxy=$(grep -w 'open.py' /etc/autostart| cut -d' ' -f6) || pt_proxy=80 cat <<-EOF >/etc/openvpn/client-common.txt # OVPN_ACCESS_SERVER_PROFILE=[VPSMANAGER] client dev tun proto $PROTOCOL sndbuf 0 rcvbuf 0 remote /VPSMANAGER? $porta #payload "HTTP/1.1 [lf]CONNECT HTTP/1.1[lf][lf]|[lf]." http-proxy $IP $pt_proxy resolv-retry 5 nobind persist-key persist-tun remote-cert-tls server cipher AES-256-CBC comp-lzo yes setenv opt block-outside-dns key-direction 1 verb 3 auth-user-pass keepalive 10 120 float EOF # gerar client.ovpn newclient "VPSMANAGER" [[ "$(netstat -nplt | grep -wc 'openvpn')" != '0' ]] && echo -e "\n\033[1;32mOPENVPN SUCCESSFULLY INSTALLED\033[0m" || echo -e "\n\033[1;31mERROR ! THE INSTALLATION CORRUPTED\033[0m" } sed -i '$ i\echo 1 > /proc/sys/net/ipv4/ip_forward' /etc/rc.local sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.local sed -i '$ i\iptables -A INPUT -p tcp --dport 25 -j DROP' /etc/rc.local sed -i '$ i\iptables -A INPUT -p tcp --dport 110 -j DROP' /etc/rc.local sed -i '$ i\iptables -A OUTPUT -p tcp --dport 25 -j DROP' /etc/rc.local sed -i '$ i\iptables -A OUTPUT -p tcp --dport 110 -j DROP' /etc/rc.local sed -i '$ i\iptables -A FORWARD -p tcp --dport 25 -j DROP' /etc/rc.local sed -i '$ i\iptables -A FORWARD -p tcp --dport 110 -j DROP' /etc/rc.local sleep 3 fun_conexao } fun_socks() { clear echo -e "\E[44;1;37m GERENCIAR PROXY SOCKS \E[0m" echo "" [[ $(netstat -nplt | grep -wc 'python') != '0' ]] && { sks='\033[1;32mON' echo -e "\033[1;33mPORTS\033[1;37m: \033[1;32m$(netstat -nplt | grep 'python' | awk {'print $4'} | cut -d: -f2 | xargs)" } || { sks='\033[1;31mOFF' } [[ $(screen -list | grep -wc 'proxy') != '0' ]] && var_sks1="\033[1;32m♦" || var_sks1="\033[1;31m○" [[ $(screen -list | grep -wc 'ws') != '0' ]] && var_sks2="\033[1;32m♦" || var_sks2="\033[1;31m○" [[ $(screen -list | grep -wc 'openpy') != '0' ]] && sksop="\033[1;32m♦" || sksop="\033[1;31m○" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mSOCKS SSH $var_sks1 \033[0m" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mWEBSOCKET $var_sks2 \033[0m" echo -e "\033[1;31m[\033[1;36m3\033[1;31m] \033[1;37m• \033[1;33mSOCKS OPENVPN $sksop \033[0m" echo -e "\033[1;31m[\033[1;36m4\033[1;31m] \033[1;37m• \033[1;33mOPEN PORT\033[0m" echo -e "\033[1;31m[\033[1;36m5\033[1;31m] \033[1;37m• \033[1;33mCHANGE SOCKS SSH STATUS\033[0m" echo -e "\033[1;31m[\033[1;36m6\033[1;31m] \033[1;37m• \033[1;33mCHANGE WEBSOCKET STATUS\033[0m" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;37m " read resposta if [[ "$resposta" = '1' ]]; then if ps x | grep -w proxy.py | grep -v grep 1>/dev/null 2>/dev/null; then clear echo -e "\E[41;1;37m PROXY SOCKS \E[0m" echo "" fun_socksoff() { for pidproxy in $(screen -ls | grep ".proxy" | awk {'print $1'}); do screen -r -S "$pidproxy" -X quit done [[ $(grep -wc "proxy.py" /etc/autostart) != '0' ]] && { sed -i '/proxy.py/d' /etc/autostart } sleep 1 screen -wipe >/dev/null } echo -e "\033[1;32mDISABLING PROXY SOCKS\033[1;33m" echo "" fun_bar 'fun_socksoff' echo "" echo -e "\033[1;32mPROXY SOCKS SUCCESSFULLY DISABLED!\033[1;33m" sleep 3 fun_socks else clear echo -e "\E[44;1;37m PROXY SOCKS \E[0m" echo "" echo -ne "\033[1;32mWHICH PORT YOU WANT TO USE \033[1;33m?\033[1;37m: " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 3 clear fun_conexao } verif_ptrs $porta fun_inisocks() { sleep 1 screen -dmS proxy python /etc/VPSManager/proxy.py $porta [[ $(grep -wc "proxy.py" /etc/autostart) = '0' ]] && { echo -e "netstat -tlpn | grep -w $porta > /dev/null || { screen -r -S 'proxy' -X quit; screen -dmS proxy python /etc/VPSManager/proxy.py $porta; }" >>/etc/autostart } || { sed -i '/proxy.py/d' /etc/autostart echo -e "netstat -tlpn | grep -w $porta > /dev/null || { screen -r -S 'proxy' -X quit; screen -dmS proxy python /etc/VPSManager/proxy.py $porta; }" >>/etc/autostart } } echo "" echo -e "\033[1;32mSTARTING PROXY SOCKS\033[1;33m" echo "" fun_bar 'fun_inisocks' echo "" echo -e "\033[1;32mSOCKS SUCCESSFULLY ACTIVATED\033[1;33m" sleep 3 fun_socks fi elif [[ "$resposta" = '2' ]]; then if ps x | grep -w wsproxy.py | grep -v grep 1>/dev/null 2>/dev/null; then clear echo -e "\E[41;1;37m WEBSOCKET \E[0m" echo "" fun_wssocksoff() { for pidproxy in $(screen -ls | grep ".ws" | awk {'print $1'}); do screen -r -S "$pidproxy" -X quit done [[ $(grep -wc "wsproxy.py" /etc/autostart) != '0' ]] && { sed -i '/wsproxy.py/d' /etc/autostart } sleep 1 screen -wipe >/dev/null } echo -e "\033[1;32mDISABLING THE WEBSOCKET\033[1;33m" echo "" fun_bar 'fun_wssocksoff' echo "" echo -e "\033[1;32mWEBSOCKET SUCCESSFULLY DISABLED!\033[1;33m" sleep 3 fun_socks else clear echo -e "\E[44;1;37m WEBSOCKET \E[0m" echo "" echo -ne "\033[1;32mWHICH PORT YOU WANT TO USE \033[1;33m?\033[1;37m: " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 3 clear fun_conexao } verif_ptrs $porta fun_iniwssocks() { sleep 1 screen -dmS ws python /etc/VPSManager/wsproxy.py $porta [[ $(grep -wc "wsproxy.py" /etc/autostart) = '0' ]] && { echo -e "netstat -tlpn | grep -w $porta > /dev/null || { screen -r -S 'ws' -X quit; screen -dmS ws python /etc/VPSManager/wsproxy.py $porta; }" >>/etc/autostart } || { sed -i '/wsproxy.py/d' /etc/autostart echo -e "netstat -tlpn | grep -w $porta > /dev/null || { screen -r -S 'ws' -X quit; screen -dmS ws python /etc/VPSManager/wsproxy.py $porta; }" >>/etc/autostart } } echo "" echo -e "\033[1;32mSTARTING WEBSOCKET\033[1;33m" echo "" fun_bar 'fun_iniwssocks' echo "" echo -e "\033[1;32mSUCCESSFULLY ACTIVATED WEBSOCKET\033[1;33m" sleep 3 fun_socks fi elif [[ "$resposta" = '3' ]]; then if ps x | grep -w open.py | grep -v grep 1>/dev/null 2>/dev/null; then clear echo -e "\E[41;1;37m SOCKS OPENVPN \E[0m" echo "" fun_socksopenoff() { for pidproxy in $(screen -list | grep -w "openpy" | awk {'print $1'}); do screen -r -S "$pidproxy" -X quit done [[ $(grep -wc "open.py" /etc/autostart) != '0' ]] && { sed -i '/open.py/d' /etc/autostart } sleep 1 screen -wipe >/dev/null } echo -e "\033[1;32mDISABLING THE SOCKS OPEN\033[1;33m" echo "" fun_bar 'fun_socksopenoff' echo "" echo -e "\033[1;32mSOCKS SUCCESSFULLY DISABLED!\033[1;33m" sleep 2 fun_socks else clear echo -e "\E[41;1;37m SOCKS OPENVPN \E[0m" echo "" echo -ne "\033[1;32mWHICH PORT YOU WANT TO USE \033[1;33m?\033[1;37m: " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid port!" sleep 2 clear fun_conexao } verif_ptrs $porta fun_inisocksop() { [[ "$(netstat -tlpn | grep 'openvpn' | wc -l)" != '0' ]] && { listoldop=$(grep -w 'DEFAULT_HOST =' /etc/VPSManager/open.py | cut -d"'" -f2 | cut -d: -f2) listopen=$(netstat -tlpn | grep -w openvpn | grep -v 127.0.0.1 | awk {'print $4'} | cut -d: -f2) sed -i "s/$listoldop/$listopen/" /etc/VPSManager/open.py } sleep 1 screen -dmS openpy python /etc/VPSManager/open.py $porta [[ $(grep -wc "open.py" /etc/autostart) = '0' ]] && { echo -e "netstat -tlpn | grep -w $porta > /dev/null || { screen -r -S 'openpy' -X quit; screen -dmS openpy python /etc/VPSManager/open.py $porta; }" >>/etc/autostart } || { sed -i '/open.py/d' /etc/autostart echo -e "netstat -tlpn | grep -w $porta > /dev/null || { screen -r -S 'openpy' -X quit; screen -dmS openpy python /etc/VPSManager/open.py $porta; }" >>/etc/autostart } } echo "" echo -e "\033[1;32mSTARTING SOCKS OPENVPN\033[1;33m" echo "" fun_bar 'fun_inisocksop' echo "" echo -e "\033[1;32mSOCKS OPENVPN SUCCESSFULLY ACTIVATED\033[1;33m" sleep 3 fun_socks fi elif [[ "$resposta" = '4' ]]; then if ps x | grep proxy.py | grep -v grep 1>/dev/null 2>/dev/null; then sockspt=$(netstat -nplt | grep 'python' | awk {'print $4'} | cut -d: -f2 | xargs) clear echo -e "\E[44;1;37m PROXY SOCKS \E[0m" echo "" echo -e "\033[1;33mPORT IN USE: \033[1;32m$sockspt" echo "" echo -ne "\033[1;32mWHICH PORT DO YOU WANT TO USE \033[1;33m?\033[1;37m: " read porta [[ -z "$porta" ]] && { echo "" echo -e "\033[1;31mInvalid Port!" sleep 2 clear fun_conexao } verif_ptrs $porta echo "" echo -e "\033[1;32mSTARTING PROXY SOCKS AT THE PORT\033[1;31m$porta\033[1;33m" echo "" abrirptsks() { sleep 1 screen -dmS proxy python /etc/VPSManager/proxy.py $porta sleep 1 } fun_bar 'abrirptsks' echo "" echo -e "\033[1;32mPROXY SOCKS SUCCESSFULLY ACTIVATED!\033[1;33m" sleep 2 fun_socks else clear echo -e "\033[1;31mUNAVAILABLE FUNCTION\n\n\033[1;33mACTIVATE SOCKS FIRST !\033[1;33m" sleep 2 fun_socks fi elif [[ "$resposta" = '5' ]]; then if ps x | grep -w proxy.py | grep -v grep 1>/dev/null 2>/dev/null; then clear msgsocks=$(cat /etc/VPSManager/proxy.py | grep -E "MSG =" | awk -F = '{print $2}' | cut -d "'" -f 2) echo -e "\E[44;1;37m PROXY SOCKS \E[0m" echo "" echo -e "\033[1;33mSTATUS: \033[1;32m$msgsocks" echo"" echo -ne "\033[1;32mINFORM YOUR STATUS\033[1;31m:\033[1;37m " read msgg [[ -z "$msgg" ]] && { echo -e "\n\033[1;31minvalid status!" sleep 2 fun_conexao } [[ ${msgg} != ?(+|-)+([a-zA-Z0-9-. ]) ]] && { echo -e "\n\033[1;31m[\033[1;33m!\033[1;31m]\033[1;33m AVOID SPECIAL CHARACTERS\033[0m" sleep 2 fun_socks } echo -e "\n\033[1;31m[\033[1;36m01\033[1;31m]\033[1;33m BLUE" echo -e "\033[1;31m[\033[1;36m02\033[1;31m]\033[1;33m GREEN" echo -e "\033[1;31m[\033[1;36m03\033[1;31m]\033[1;33m RED" echo -e "\033[1;31m[\033[1;36m04\033[1;31m]\033[1;33m YELLOW" echo -e "\033[1;31m[\033[1;36m05\033[1;31m]\033[1;33m PINK" echo -e "\033[1;31m[\033[1;36m06\033[1;31m]\033[1;33m CYAN" echo -e "\033[1;31m[\033[1;36m07\033[1;31m]\033[1;33m ORANGE" echo -e "\033[1;31m[\033[1;36m08\033[1;31m]\033[1;33m PURPLE" echo -e "\033[1;31m[\033[1;36m09\033[1;31m]\033[1;33m BLACK" echo -e "\033[1;31m[\033[1;36m10\033[1;31m]\033[1;33m NO COLOR" echo "" echo -ne "\033[1;32mQUAL A COR\033[1;31m ?\033[1;37m : " read sts_cor if [[ "$sts_cor" = "1" ]] || [[ "$sts_cor" = "01" ]]; then cor_sts='blue' elif [[ "$sts_cor" = "2" ]] || [[ "$sts_cor" = "02" ]]; then cor_sts='green' elif [[ "$sts_cor" = "3" ]] || [[ "$sts_cor" = "03" ]]; then cor_sts='red' elif [[ "$sts_cor" = "4" ]] || [[ "$sts_cor" = "04" ]]; then cor_sts='yellow' elif [[ "$sts_cor" = "5" ]] || [[ "$sts_cor" = "05" ]]; then cor_sts='#F535AA' elif [[ "$sts_cor" = "6" ]] || [[ "$sts_cor" = "06" ]]; then cor_sts='cyan' elif [[ "$sts_cor" = "7" ]] || [[ "$sts_cor" = "07" ]]; then cor_sts='#FF7F00' elif [[ "$sts_cor" = "8" ]] || [[ "$sts_cor" = "08" ]]; then cor_sts='#9932CD' elif [[ "$sts_cor" = "9" ]] || [[ "$sts_cor" = "09" ]]; then cor_sts='black' elif [[ "$sts_cor" = "10" ]]; then cor_sts='null' else echo -e "\n\033[1;33mINVALID OPTION !" cor_sts='null' fi fun_msgsocks() { msgsocks2=$(cat /etc/VPSManager/proxy.py | grep "MSG =" | awk -F = '{print $2}') sed -i "s/$msgsocks2/ '$msgg'/g" /etc/VPSManager/proxy.py sleep 1 cor_old=$(grep 'color=' /etc/VPSManager/proxy.py | cut -d '"' -f2) sed -i "s/\b$cor_old\b/$cor_sts/g" /etc/VPSManager/proxy.py } echo "" echo -e "\033[1;32mCHANGING STATUS!" echo "" fun_bar 'fun_msgsocks' restartsocks() { if ps x | grep proxy.py | grep -v grep 1>/dev/null 2>/dev/null; then echo -e "$(netstat -nplt | grep 'python' | awk {'print $4'} | cut -d: -f2 | xargs)" >/tmp/Pt_sks for pidproxy in $(screen -ls | grep ".proxy" | awk {'print $1'}); do screen -r -S "$pidproxy" -X quit done screen -wipe >/dev/null _Ptsks="$(cat /tmp/Pt_sks)" sleep 1 screen -dmS proxy python /etc/VPSManager/proxy.py $_Ptsks rm /tmp/Pt_sks fi } echo "" echo -e "\033[1;32mRESETTING PROXY SOCKS!" echo "" fun_bar 'restartsocks' echo "" echo -e "\033[1;32mSTATUS SUCCESSFULLY CHANGED!" sleep 2 fun_socks else clear echo -e "\033[1;31mUNAVAILABLE FUNCTION\n\n\033[1;33mACTIVATE SOCKS SSH FIRST !\033[1;33m" sleep 2 fun_socks fi elif [[ "$resposta" = '6' ]]; then if ps x | grep -w wsproxy.py | grep -v grep 1>/dev/null 2>/dev/null; then clear msgsocks=$(cat /etc/VPSManager/wsproxy.py | grep -E "MSG =" | awk -F = '{print $2}' | cut -d "'" -f 2) echo -e "\E[44;1;37m WEBSOCKET \E[0m" echo "" echo -e "\033[1;33mSTATUS: \033[1;32m$msgsocks" echo"" echo -ne "\033[1;32mINFORM YOUR STATUS\033[1;31m:\033[1;37m " read msgg [[ -z "$msgg" ]] && { echo -e "\n\033[1;31minvalid status!" sleep 2 fun_conexao } [[ ${msgg} != ?(+|-)+([a-zA-Z0-9-. ]) ]] && { echo -e "\n\033[1;31m[\033[1;33m!\033[1;31m]\033[1;33m AVOID SPECIAL CHARACTERS\033[0m" sleep 2 fun_socks } echo -e "\n\033[1;31m[\033[1;36m01\033[1;31m]\033[1;33m BLUE" echo -e "\033[1;31m[\033[1;36m02\033[1;31m]\033[1;33m GREEN" echo -e "\033[1;31m[\033[1;36m03\033[1;31m]\033[1;33m RED" echo -e "\033[1;31m[\033[1;36m04\033[1;31m]\033[1;33m YELLOW" echo -e "\033[1;31m[\033[1;36m05\033[1;31m]\033[1;33m PINK" echo -e "\033[1;31m[\033[1;36m06\033[1;31m]\033[1;33m CYAN" echo -e "\033[1;31m[\033[1;36m07\033[1;31m]\033[1;33m ORANGE" echo -e "\033[1;31m[\033[1;36m08\033[1;31m]\033[1;33m PURPLE" echo -e "\033[1;31m[\033[1;36m09\033[1;31m]\033[1;33m BLACK" echo -e "\033[1;31m[\033[1;36m10\033[1;31m]\033[1;33m NO COLOR" echo "" echo -ne "\033[1;32mWHAT'S THE COLOR\033[1;31m ?\033[1;37m : " read sts_cor if [[ "$sts_cor" = "1" ]] || [[ "$sts_cor" = "01" ]]; then cor_sts='blue' elif [[ "$sts_cor" = "2" ]] || [[ "$sts_cor" = "02" ]]; then cor_sts='green' elif [[ "$sts_cor" = "3" ]] || [[ "$sts_cor" = "03" ]]; then cor_sts='red' elif [[ "$sts_cor" = "4" ]] || [[ "$sts_cor" = "04" ]]; then cor_sts='yellow' elif [[ "$sts_cor" = "5" ]] || [[ "$sts_cor" = "05" ]]; then cor_sts='#F535AA' elif [[ "$sts_cor" = "6" ]] || [[ "$sts_cor" = "06" ]]; then cor_sts='cyan' elif [[ "$sts_cor" = "7" ]] || [[ "$sts_cor" = "07" ]]; then cor_sts='#FF7F00' elif [[ "$sts_cor" = "8" ]] || [[ "$sts_cor" = "08" ]]; then cor_sts='#9932CD' elif [[ "$sts_cor" = "9" ]] || [[ "$sts_cor" = "09" ]]; then cor_sts='black' elif [[ "$sts_cor" = "10" ]]; then cor_sts='null' else echo -e "\n\033[1;33mINVALID OPTION !" cor_sts='null' fi fun_msgsocks() { msgsocks2=$(cat /etc/VPSManager/wsproxy.py | grep "MSG =" | awk -F = '{print $2}') sed -i "s/$msgsocks2/ '$msgg'/g" /etc/VPSManager/wsproxy.py sleep 1 cor_old=$(grep 'color=' /etc/VPSManager/wsproxy.py | cut -d '"' -f2) sed -i "s/\b$cor_old\b/$cor_sts/g" /etc/VPSManager/wsproxy.py } echo "" echo -e "\033[1;32mCHANGING STATUS!" echo "" fun_bar 'fun_msgsocks' restartwssocks() { if ps x | grep wsproxy.py | grep -v grep 1>/dev/null 2>/dev/null; then echo -e "$(netstat -nplt | grep 'python' | awk {'print $4'} | cut -d: -f2 | xargs)" >/tmp/Pt_wssks for pidproxy in $(screen -ls | grep ".ws" | awk {'print $1'}); do screen -r -S "$pidproxy" -X quit done screen -wipe >/dev/null _Ptwssks="$(cat /tmp/Pt_wssks)" sleep 1 screen -dmS ws python /etc/VPSManager/wsproxy.py $_Ptwssks rm /tmp/Pt_wssks fi } echo "" echo -e "\033[1;32mRESETTING WEBSOCKET!" echo "" fun_bar 'restartwssocks' echo "" echo -e "\033[1;32mSTATUS SUCCESSFULLY CHANGED!" sleep 2 fun_socks else clear echo -e "\033[1;31mUNAVAILABLE FUNCTION\n\n\033[1;33mACTIVATE WEBSOCKET FIRST !\033[1;33m" sleep 2 fun_socks fi elif [[ "$resposta" = '0' ]]; then echo "" echo -e "\033[1;31mreturning...\033[0m" sleep 1 fun_conexao else echo "" echo -e "\033[1;31mInvalid option !\033[0m" sleep 1 fun_socks fi } fun_openssh() { clear echo -e "\E[44;1;37m OPENSSH \E[0m\n" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mADD PORT\033[1;31m [\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mREMOVE PORT\033[1;31m [\033[1;36m3\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[0m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;37m " read resp if [[ "$resp" = '1' ]]; then clear echo -e "\E[44;1;37m ADD PORT TO SSH \E[0m\n" echo -ne "\033[1;32mWHICH PORT DO YOU WANT TO ADD \033[1;33m?\033[1;37m " read pt [[ -z "$pt" ]] && { echo -e "\n\033[1;31mInvalid Port!" sleep 3 fun_conexao } verif_ptrs $pt echo -e "\n\033[1;32mADDING PORT TO SSH\033[0m" echo "" fun_addpssh() { echo "Port $pt" >>/etc/ssh/sshd_config service ssh restart } fun_bar 'fun_addpssh' echo -e "\n\033[1;32mSUCCESSFULLY ADDED PORT\033[0m" sleep 3 fun_conexao elif [[ "$resp" = '2' ]]; then clear echo -e "\E[41;1;37m REMOVE SSH PORT \E[0m" echo -e "\n\033[1;33m[\033[1;31m!\033[1;33m] \033[1;32mSTANDARD PORT \033[1;37m22 \033[1;33mCAUTION !\033[0m" echo -e "\n\033[1;33mPORTS IN USE: \033[1;37m$(grep 'Port' /etc/ssh/sshd_config | cut -d' ' -f2 | grep -v 'no' | xargs)\n" echo -ne "\033[1;32mWHICH PORT DO YOU WANT TO REMOVE\033[1;33m?\033[1;37m " read pt [[ -z "$pt" ]] && { echo -e "\n\033[1;31mInvalid Port!" sleep 2 fun_conexao } [[ $(grep -wc "$pt" '/etc/ssh/sshd_config') != '0' ]] && { echo -e "\n\033[1;32mREMOVING SSH PORT\033[0m" echo "" fun_delpssh() { sed -i "/Port $pt/d" /etc/ssh/sshd_config service ssh restart } fun_bar 'fun_delpssh' echo -e "\n\033[1;32mSUCCESSFULLY REMOVED PORT\033[0m" sleep 2 fun_conexao } || { echo -e "\n\033[1;31mInvalid Port!" sleep 2 fun_conexao } elif [[ "$resp" = '3' ]]; then echo -e "\n\033[1;31mreturning.." sleep 2 fun_conexao else echo -e "\n\033[1;31mInvalid option!" sleep 2 fun_conexao fi } fun_sslh() { [[ "$(netstat -nltp | grep 'sslh' | wc -l)" = '0' ]] && { clear echo -e "\E[44;1;37m SSLH INSTALLER \E[0m\n" echo -e "\n\033[1;33m[\033[1;31m!\033[1;33m] \033[1;32mA PORT \033[1;37m443 \033[1;32mWILL BE USED BY STANDARD\033[0m\n" echo -ne "\033[1;32mREALLY WANT TO INSTALL SSLH \033[1;31m? \033[1;33m[s/n]:\033[1;37m " read resp [[ "$resp" = 's' ]] && { verif_ptrs 443 fun_instsslh() { [[ -e "/etc/stunnel/stunnel.conf" ]] && ptssl="$(netstat -nplt | grep 'stunnel' | awk {'print $4'} | cut -d: -f2 | xargs)" || ptssl='3128' [[ -e "/etc/openvpn/server.conf" ]] && ptvpn="$(netstat -nplt | grep 'openvpn' | awk {'print $4'} | cut -d: -f2 | xargs)" || ptvpn='1194' DEBIAN_FRONTEND=noninteractive apt-get -y install sslh echo -e "#standalone mode\n\nRUN=yes\n\nDAEMON=/usr/sbin/sslh\n\nDAEMON_OPTS='--user sslh --listen 0.0.0.0:443 --ssh 127.0.0.1:22 --ssl 127.0.0.1:$ptssl --http 127.0.0.1:80 --openvpn 127.0.0.1:$ptvpn --pidfile /var/run/sslh/sslh.pid'" >/etc/default/sslh /etc/init.d/sslh start && service sslh start } echo -e "\n\033[1;32mINSTALLING SSLH !\033[0m\n" fun_bar 'fun_instsslh' echo -e "\n\033[1;32mSTARTING SSLH !\033[0m\n" fun_bar '/etc/init.d/sslh restart && service sslh restart' [[ $(netstat -nplt | grep -w 'sslh' | wc -l) != '0' ]] && echo -e "\n\033[1;32mSUCCESSFULLY INSTALLED !\033[0m" || echo -e "\n\033[1;31mUNEXPECTED ERROR !\033[0m" sleep 3 fun_conexao } || { echo -e "\n\033[1;31mreturning.." sleep 2 fun_conexao } } || { clear echo -e "\E[41;1;37m REMOVE SSLH \E[0m\n" echo -ne "\033[1;32mREALLY WANT TO REMOVE SSLH \033[1;31m? \033[1;33m[s/n]:\033[1;37m " read respo [[ "$respo" = "s" ]] && { fun_delsslh() { /etc/init.d/sslh stop && service sslh stop apt-get remove sslh -y apt-get purge sslh -y } echo -e "\n\033[1;32mREMOVING SSLH !\033[0m\n" fun_bar 'fun_delsslh' echo -e "\n\033[1;32mSUCCESSFULLY REMOVED !\033[0m\n" sleep 2 fun_conexao } || { echo -e "\n\033[1;31mreturning.." sleep 2 fun_conexao } } } x="ok" fun_conexao() { while true $x != "ok"; do [[ ! -e '/home/vpsmanager' ]] && exit 0 clear echo -e "\E[44;1;37m CONNECTION MODE \E[0m\n" echo -e "\033[1;32mSERVICE: \033[1;33mOPENSSH \033[1;32mPORT: \033[1;37m$(grep 'Port' /etc/ssh/sshd_config | cut -d' ' -f2 | grep -v 'no' | xargs)" && sts6="\033[1;32m♦ " [[ "$(netstat -tlpn | grep 'docker' | wc -l)" != '0' ]] && { echo -e "\033[1;32mSERVICE: \033[1;33mCHISEL: \033[1;32mPORT: \033[1;37m$(netstat -nplt | grep 'docker' | awk {'print $4'} | cut -d: -f2 | xargs)" sts8="\033[1;32m♦ " } || { sts8="\033[1;31m○ " } [[ "$(ps x | grep 'slow_dns' | grep -v 'grep'|wc -l)" != '0' ]] && { sts9="\033[1;32m♦ " } || { sts9="\033[1;31m○ " } [[ "$(netstat -tlpn | grep 'sslh' | wc -l)" != '0' ]] && { echo -e "\033[1;32mSERVICE: \033[1;33mSSLH: \033[1;32mPORT: \033[1;37m$(netstat -nplt | grep 'sslh' | awk {'print $4'} | cut -d: -f2 | xargs)" sts7="\033[1;32m♦ " } || { sts7="\033[1;31m○ " } [[ "$(netstat -tlpn | grep 'openvpn' | wc -l)" != '0' ]] && { echo -e "\033[1;32mSERVICE: \033[1;33mOPENVPN: \033[1;32mPORT: \033[1;37m$(netstat -nplt | grep 'openvpn' | awk {'print $4'} | cut -d: -f2 | xargs)" sts5="\033[1;32m♦ " } || { sts5="\033[1;31m○ " } [[ "$(netstat -tlpn | grep 'python' | wc -l)" != '0' ]] && { echo -e "\033[1;32mSERVICE: \033[1;33mPROXY SOCKS \033[1;32mPORT: \033[1;37m$(netstat -nplt | grep 'python' | awk {'print $4'} | cut -d: -f2 | xargs)" sts4="\033[1;32m♦ " } || { sts4="\033[1;31m○ " } [[ -e "/etc/stunnel/stunnel.conf" ]] && { echo -e "\033[1;32mSERVICE: \033[1;33mSSL TUNNEL \033[1;32mPORT: \033[1;37m$(netstat -nplt | grep 'stunnel' | awk {'print $4'} | cut -d: -f2 | xargs)" sts3="\033[1;32m♦ " } || { sts3="\033[1;31m○ " } [[ "$(netstat -tlpn | grep 'dropbear' | wc -l)" != '0' ]] && { echo -e "\033[1;32mSERVICE: \033[1;33mDROPBEAR \033[1;32mPORT: \033[1;37m$(netstat -nplt | grep 'dropbear' | awk -F ":" {'print $4'} | xargs)" sts2="\033[1;32m♦ " } || { sts2="\033[1;31m○ " } [[ "$(netstat -tlpn | grep 'squid' | wc -l)" != '0' ]] && { echo -e "\033[1;32mSERVICE: \033[1;33mSQUID \033[1;32mPORT: \033[1;37m$(netstat -nplt | grep 'squid' | awk -F ":" {'print $4'} | xargs)" sts1="\033[1;32m♦ " } || { sts1="\033[1;31m○ " } echo -e "\033[0;34m◇────────────────────────────────────────────────◇\033[0m" echo "" echo -e "\033[1;31m[\033[1;36m01\033[1;31m] \033[1;37m• \033[1;33mOPENSSH $sts6\033[1;31m [\033[1;36m02\033[1;31m] \033[1;37m• \033[1;33mSQUID PROXY $sts1\033[1;31m [\033[1;36m03\033[1;31m] \033[1;37m• \033[1;33mDROPBEAR $sts2\033[1;31m [\033[1;36m04\033[1;31m] \033[1;37m• \033[1;33mOPENVPN $sts5\033[1;31m [\033[1;36m05\033[1;31m] \033[1;37m• \033[1;33mPROXY SOCKS $sts4\033[1;31m [\033[1;36m06\033[1;31m] \033[1;37m• \033[1;33mSSL TUNNEL $sts3\033[1;31m [\033[1;36m07\033[1;31m] \033[1;37m• \033[1;33mSSLH MULTIPLEX $sts7\033[1;31m [\033[1;36m08\033[1;31m] \033[1;37m• \033[1;33mCHISEL $sts8\033[1;31m [\033[1;36m09\033[1;31m] \033[1;37m• \033[1;33mSLOWDNS $sts9\033[1;31m [\033[1;36m10\033[1;31m] \033[1;37m• \033[1;33mCOME BACK \033[1;32m<\033[1;33m<\033[1;31m< \033[1;31m [\033[1;36m00\033[1;31m] \033[1;37m• \033[1;33mGET OUT \033[1;32m<\033[1;33m<\033[1;31m< \033[0m" echo "" echo -e "\033[0;34m◇────────────────────────────────────────────────◇\033[0m" echo "" tput civis echo -ne "\033[1;32mWHAT DO YOU WANT TO DO \033[1;33m?\033[1;31m?\033[1;37m " read x tput cnorm clear case $x in 1 | 01) fun_openssh ;; 2 | 02) fun_squid ;; 3 | 03) fun_drop ;; 4 | 04) fun_openvpn ;; 5 | 05) fun_socks ;; 6 | 06) inst_ssl ;; 7 | 07) fun_sslh ;; 8 | 08) fun_chisel ;; 9 | 09) slow_dns ;; 10 | 10) menu ;; 0 | 00) echo -e "\033[1;31mGoing out...\033[0m" sleep 2 clear exit ;; *) echo -e "\033[1;31mInvalid option !\033[0m" sleep 2 ;; esac done } fun_conexao } ================================================ FILE: Modulos/criarteste ================================================ #!/bin/bash IP=$(cat /etc/IP) if [ ! -d /etc/VPSManager/userteste ]; then mkdir /etc/VPSManager/userteste fi tput setaf 7 ; tput setab 4 ; tput bold ; printf '%30s%s%-15s\n' "Create test user" ; tput sgr0 echo "" [ "$(ls -A /etc/VPSManager/userteste)" ] && echo -e "\033[1;32mActive Test User!\033[1;37m" || echo -e "\033[1;31mNo active tests!\033[0m" echo "" for testeson in $(ls /etc/VPSManager/userteste |sort |sed 's/.sh//g') do echo "$testeson" done echo "" echo -ne "\033[1;32mUsername\033[1;37m: "; read nome if [[ -z $nome ]] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Empty or invalid name." ; echo "" ; tput sgr0 exit 1 fi awk -F : ' { print $1 }' /etc/passwd > /tmp/users if grep -Fxq "$nome" /tmp/users then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "This user already exists." ; echo "" ; tput sgr0 exit 1 fi echo -ne "\033[1;32mPassword\033[1;37m: "; read pass if [[ -z $pass ]] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Empty or invalid password." ; echo "" ; tput sgr0 exit 1 fi echo -ne "\033[1;32mLimit\033[1;37m: "; read limit if [[ -z $limit ]] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Empty or invalid limit. " ; echo "" ; tput sgr0 exit 1 fi echo -ne "\033[1;32mminutes \033[1;33m(\033[1;31mEx: \033[1;37m60\033[1;33m)\033[1;37m: "; read u_temp if [[ -z $limit ]] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Empty or invalid limit." ; echo "" ; tput sgr0 exit 1 fi useradd -M -s /bin/false $nome (echo $pass;echo $pass) |passwd $nome > /dev/null 2>&1 echo "$pass" > /etc/VPSManager/senha/$nome echo "$nome $limit" >> /root/usuarios.db echo "#!/bin/bash pkill -f "$nome" userdel --force $nome grep -v ^$nome[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db rm /etc/VPSManager/senha/$nome > /dev/null 2>&1 rm -rf /etc/VPSManager/userteste/$nome.sh exit" > /etc/VPSManager/userteste/$nome.sh chmod +x /etc/VPSManager/userteste/$nome.sh at -f /etc/VPSManager/userteste/$nome.sh now + $u_temp min > /dev/null 2>&1 clear echo -e "\033[1;32m====================================" echo -e "\033[1;32m 🐉ㅤDRAGON VPS MANAGERㅤ🐉 " echo -e "\033[1;32m====================================" echo "" echo -e "\033[1;31m◈─────⪧ IMPORTANT ⪦──────◈" echo "" echo -e "\033[1;32m◈⪧ 🚫 NO SPAM" echo -e "\033[1;32m◈⪧ ⚠️ NO DDOS" echo -e "\033[1;32m◈⪧ 🎭 NO Hacking" echo -e "\033[1;32m◈⪧ ⛔️ NO Carding" echo -e "\033[1;32m◈⪧ 🙅‍♂️ NO Torrent" echo -e "\033[1;32m◈⪧ ❌ NO MultiLogin" echo -e "\033[1;32m◈⪧ 🤷‍♂️ NO Illegal Activities" echo "" echo -e "\033[1;37m◈─────⪧ TEST SSH ACCOUNT ⪦─────◈" echo "" echo -e "\033[1;32m◈ Host / IP :⪧ \033[1;31m$IP" echo -e "\033[1;32m◈ Username :⪧ \033[1;31m$nome" echo -e "\033[1;32m◈ Password :⪧ \033[1;31m$pass" echo -e "\033[1;32m◈ Login Limit :⪧ \033[1;31m$limit" echo -e "\033[1;32m◈ Expire Date :⪧ \033[1;31m$u_temp minutes" echo "" echo -e "\033[1;37m◈──────⪧ PORTS ⪦ ───────◈" echo "" echo -e "\033[1;32m◈ SSH ⌁ 22" echo -e "\033[1;32m◈ SSL ⌁ 443" echo -e "\033[1;32m◈ Squid ⌁ 8080" echo -e "\033[1;32m◈ DropBear ⌁ 80" echo -e "\033[1;32m◈ BadVPN ⌁ 7300" echo "" echo -e "\033[1;37m◈───⪧ONLINE USER COUNT⪦────◈ " echo "" echo -e "\033[1;32mhttp://$IP:8888/server/online" echo "" echo -e "\033[1;37m◈─────────────────────────────────◈" echo -e "\033[1;37m©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉" echo -e "\033[1;37m◈─────────────────────────────────◈" echo "" echo -e "\033[1;33mAfter the defined time of the user \033[1;32m$nome" echo -e "\033[1;33mwill be disconnected and deleted.\033[0m" exit ================================================ FILE: Modulos/criarusuario ================================================ #!/bin/bash IP=$(cat /etc/IP) cor1='\033[41;1;37m' cor2='\033[44;1;37m' scor='\033[0m' # Gerar client.ovpn newclient() { cp /etc/openvpn/client-common.txt ~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/ca.crt >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/private/$1.key >>~/$1.ovpn echo "" >>~/$1.ovpn echo "" >>~/$1.ovpn cat /etc/openvpn/ta.key >>~/$1.ovpn echo "" >>~/$1.ovpn } fun_geraovpn() { [[ "$respost" = @(s|S) ]] && { cd /etc/openvpn/easy-rsa/ ./easyrsa build-client-full $username nopass newclient "$username" sed -e "s;auth-user-pass;\n$username\n$password\n;g" /root/$username.ovpn >/root/tmp.ovpn && mv -f /root/tmp.ovpn /root/$username.ovpn } || { cd /etc/openvpn/easy-rsa/ ./easyrsa build-client-full $username nopass newclient "$username" } } >/dev/null 2>&1 [[ -e /etc/openvpn/server.conf ]] && { _Port=$(grep -w 'port' /etc/openvpn/server.conf | awk {'print $2'}) hst=$(sed -n '8 p' /etc/openvpn/client-common.txt | awk {'print $4'}) rmt=$(sed -n '7 p' /etc/openvpn/client-common.txt) hedr=$(sed -n '8 p' /etc/openvpn/client-common.txt) prxy=$(sed -n '9 p' /etc/openvpn/client-common.txt) rmt2='/VPSMANAGER?' rmt3='www.vivo.com.br 8088' prx='200.142.130.104' payload1='#payload "HTTP/1.0 [crlf]Host: m.youtube.com[crlf]CONNECT HTTP/1.0[crlf][crlf]|[crlf]"' payload2='#payload "CONNECT 127.0.0.1:1194[split][crlf] HTTP/1.0 [crlf][crlf]#"' vivo1="portalrecarga.vivo.com.br/recarga" vivo2="portalrecarga.vivo.com.br/controle/" vivo3="navegue.vivo.com.br/pre/" vivo4="navegue.vivo.com.br/controle/" vivo5="www.vivo.com.br" oi="d1n212ccp6ldpw.cloudfront.net" bypass="net_gateway" cert01="/etc/openvpn/client-common.txt" if [[ "$hst" == "$vivo1" ]]; then Host="Portal Recarga" elif [[ "$hst" == "$vivo2" ]]; then Host="Recarga contole" elif [[ "$hst" == "$vivo3" ]]; then Host="Portal Navegue" elif [[ "$hst" == "$vivo4" ]]; then Host="Nav controle" elif [[ "$hst" == "$IP:$_Port" ]]; then Host="Vivo MMS" elif [[ "$hst" == "$oi" ]]; then Host="Oi" elif [[ "$hst" == "$bypass" ]]; then Host="Modo Bypass" elif [[ "$hedr" == "$payload1" ]]; then Host="OPEN SOCKS" elif [[ "$hedr" == "$payload2" ]]; then Host="OPEN SQUID" else Host="Customizado" fi } fun_bar() { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim ${comando[0]} >/dev/null 2>&1 ${comando[1]} >/dev/null 2>&1 touch $HOME/fim ) >/dev/null 2>&1 & tput civis echo -ne "\033[1;33mPlease Wait.. \033[1;37m- \033[1;33m[" while true; do for ((i = 0; i < 18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne "\033[1;33mPlease Wait.. \033[1;37m- \033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m" tput cnorm } fun_edithost() { clear echo -e "\E[44;1;37m CHANGE HOST OVPN \E[0m" echo "" echo -e "\033[1;33mHOST IN USE\033[1;37m: \033[1;32m$Host" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;33mVIVO RECHARGE" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;33mVIVO NAVIGATE PRE" echo -e "\033[1;31m[\033[1;36m3\033[1;31m] \033[1;33mOPEN SOCKS \033[1;31m[\033[1;32mAPP MOD\033[1;31m]" echo -e "\033[1;31m[\033[1;36m4\033[1;31m] \033[1;33mOPEN SQUID \033[1;31m[\033[1;32mAPP MOD\033[1;31m]" echo -e "\033[1;31m[\033[1;36m5\033[1;31m] \033[1;33mVIVO MMS \033[1;31m[\033[1;37mAPN: \033[1;32mmms.vivo.com.br\033[1;31m]" echo -e "\033[1;31m[\033[1;36m6\033[1;31m] \033[1;33mMODO BYPASS \033[1;31m[\033[1;32mOPEN + INJECTOR\033[1;31m]" echo -e "\033[1;31m[\033[1;36m7\033[1;31m] \033[1;33mALL HOSTS \033[1;31m[\033[1;32m1 OVPN OF EACH\033[1;31m]" echo -e "\033[1;31m[\033[1;36m8\033[1;31m] \033[1;33mEDIT MANUALLY" echo -e "\033[1;31m[\033[1;36m0\033[1;31m] \033[1;33mCOME BACK" echo "" echo -ne "\033[1;32mWHICH HOST DO YOU WANT TO USE \033[1;33m?\033[1;37m " read respo [[ -z "$respo" ]] && { echo -e "\n\033[1;31mInvalid option!" sleep 2 fun_edithost } if [[ "$respo" = '1' ]]; then echo -e "\n\033[1;32mCHANGING HOST!\033[0m\n" fun_althost() { sed -i "7,9"d $cert01 sleep 1 sed -i "7i\remote $rmt2 $_Port\nhttp-proxy-option CUSTOM-HEADER Host $vivo1\nhttp-proxy $IP 80" $cert01 } fun_bar 'fun_althost' echo -e "\n\033[1;32mSUCCESSFULLY CHANGED HOST!\033[0m" fun_geraovpn sleep 1.5 elif [[ "$respo" = '2' ]]; then echo -e "\n\033[1;32mCHANGING HOST!\033[0m\n" fun_althost2() { sed -i "7,9"d $cert01 sleep 1 sed -i "7i\remote $rmt2 $_Port\nhttp-proxy-option CUSTOM-HEADER Host $vivo3\nhttp-proxy $IP 80" $cert01 } fun_bar 'fun_althost2' echo -e "\n\033[1;32mSUCCESSFULLY CHANGED HOST!\033[0m" fun_geraovpn sleep 1.5 elif [[ "$respo" = '3' ]]; then echo -e "\n\033[1;32mCHANGING HOST!\033[0m\n" fun_althostpay1() { sed -i "7,9"d $cert01 sleep 1 sed -i "7i\remote $rmt2 $_Port\n$payload1\nhttp-proxy $IP 8080" $cert01 } fun_bar 'fun_althostpay1' echo -e "\n\033[1;32mHOST SUCCESSFULLY CHANGED!\033[0m" fun_geraovpn sleep 1.5 elif [[ "$respo" = '4' ]]; then echo -e "\n\033[1;32mCHANGING HOST!\033[0m\n" fun_althostpay2() { sed -i "7,9"d $cert01 sleep 1 sed -i "7i\remote $rmt2 $_Port\n$payload2\nhttp-proxy $IP 80" $cert01 } fun_bar 'fun_althostpay2' echo -e "\n\033[1;32mHOST SUCCESSFULLY CHANGED!\033[0m" fun_geraovpn sleep 1.5 elif [[ "$respo" = '5' ]]; then echo -e "\n\033[1;32mCHANGING HOST!\033[0m\n" fun_althost5() { sed -i "7,9"d $cert01 sleep 1 sed -i "7i\remote $rmt3\nhttp-proxy-option CUSTOM-HEADER Host $vivo3\nhttp-proxy $prx:$_Port" $cert01 } fun_bar 'fun_althost5' echo -e "\n\033[1;32mHOST SUCCESSFULLY CHANGED!\033[0m" fun_geraovpn sleep 1.5 elif [[ "$respo" = '6' ]]; then echo -e "\n\033[1;32mCHANGING HOST!\033[0m\n" fun_althost6() { sed -i "7,9"d $cert01 sleep 1 sed -i "7i\remote $IP $_Port\nroute $IP 255.255.255.255 net_gateway\nhttp-proxy 127.0.0.1 8989" $cert01 } fun_bar 'fun_althost6' echo -e "\n\033[1;32mSUCCESSFULLY CHANGED HOST!\033[0m" fun_geraovpn sleep 1.5 elif [[ "$respo" = '7' ]]; then [[ ! -e "$HOME/$username.ovpn" ]] && fun_geraovpn echo -e "\n\033[1;32mCHANGING HOST!\033[0m\n" fun_packhost() { [[ ! -d "$HOME/OVPN" ]] && mkdir $HOME/OVPN sed -i "7,9"d $HOME/$username.ovpn sleep 0.5 sed -i "7i\remote $rmt2 $_Port\nhttp-proxy-option CUSTOM-HEADER Host $vivo1\nhttp-proxy $IP 80" $HOME/$username.ovpn cp $HOME/$username.ovpn /root/OVPN/$username-vivo1.ovpn sed -i "8"d $HOME/$username.ovpn sleep 0.5 sed -i "8i\http-proxy-option CUSTOM-HEADER Host $vivo3" $HOME/$username.ovpn cp $HOME/$username.ovpn /root/OVPN/$username-vivo2.ovpn sed -i "7,9"d $HOME/$username.ovpn sleep 0.5 sed -i "7i\remote $rmt3\nhttp-proxy-option CUSTOM-HEADER Host $IP:$_Port\nhttp-proxy $prx 80" $HOME/$username.ovpn cp $HOME/$username.ovpn /root/OVPN/$username-vivo3.ovpn sed -i "7,9"d $HOME/$username.ovpn sleep 0.5 sed -i "7i\remote $IP $_Port\nroute $IP 255.255.255.255 net_gateway\nhttp-proxy 127.0.0.1 8989" $HOME/$username.ovpn cp $HOME/$username.ovpn /root/OVPN/$username-bypass.ovpn sed -i "7,9"d $HOME/$username.ovpn sleep 0.5 sed -i "7i\remote $rmt2 $_Port\n$payload1\nhttp-proxy $IP 8080" $HOME/$username.ovpn cp $HOME/$username.ovpn /root/OVPN/$username-socks.ovpn sed -i "7,9"d $HOME/$username.ovpn sleep 0.5 sed -i "7i\remote $rmt2 $_Port\n$payload2\nhttp-proxy $IP 80" $HOME/$username.ovpn cp $HOME/$username.ovpn /root/OVPN/$username-squid.ovpn cd $HOME/OVPN && zip $username.zip *.ovpn >/dev/null 2>&1 && cp $username.zip $HOME/$username.zip cd $HOME && rm -rf /root/OVPN >/dev/null 2>&1 } fun_bar 'fun_packhost' echo -e "\n\033[1;32mSUCCESSFULLY CHANGED HOST!\033[0m" sleep 1.5 elif [[ "$respo" = '8' ]]; then echo "" echo -e "\033[1;32mCHANGING OVPN FILE!\033[0m" echo "" echo -e "\033[1;31mATTENTION!\033[0m" echo "" echo -e "\033[1;33mTO SAVE USE KEYS \033[1;32mctrl x y\033[0m" sleep 4 clear nano /etc/openvpn/client-common.txt echo "" echo -e "\033[1;32mSUCCESSFULLY CHANGED!\033[0m" fun_geraovpn sleep 1.5 elif [[ "$respo" = '0' ]]; then echo "" echo -e "\033[1;31mreturning...\033[0m" sleep 2 else echo "" echo -e "\033[1;31mInvalid option !\033[0m" sleep 2 fun_edithost fi } [[ ! -e /usr/lib/vpsmanager ]] && exit 0 tput setaf 7;tput setab 4;tput bold;printf '%30s%s%-15s\n' "Create SSH User";tput sgr0 echo "" echo -ne "\033[1;32mUsername:\033[1;37m ";read username [[ -z $username ]] && { echo -e "\n${cor1}Empty or invalid username!${scor}\n" exit 1 } [[ "$(grep -wc $username /etc/passwd)" != '0' ]] && { echo -e "\n${cor1}This user already exists. try another name!${scor}\n" exit 1 } [[ ${username} != ?(+|-)+([a-zA-Z0-9]) ]] && { echo -e "\n${cor1}You entered an invalid username!${scor}" echo -e "${cor1}Do not use spaces, accents or special characters!${scor}\n" exit 1 } sizemin=$(echo ${#username}) [[ $sizemin -lt 2 ]] && { echo -e "\n${cor1}You entered too short a username${scor}" echo -e "${cor1}use at least 4 characters!${scor}\n" exit 1 } sizemax=$(echo ${#username}) [[ $sizemax -gt 10 ]] && { echo -e "\n${cor1}You entered a very large username" echo -e "${cor1}use a maximum of 10 characters!${scor}\n" exit 1 } echo -ne "\033[1;32mPassword:\033[1;37m ";read password [[ -z $password ]] && { echo -e "\n${cor1}Empty or invalid password!${scor}\n" exit 1 } sizepass=$(echo ${#password}) [[ $sizepass -lt 4 ]] && { echo -e "\n${cor1}Short password!, use at least 4 characters${scor}\n" exit 1 } echo -ne "\033[1;32mdays to expire:\033[1;37m ";read dias [[ -z $dias ]] && { echo -e "\n${cor1}number of days empty!${scor}\n" exit 1 } [[ ${dias} != ?(+|-)+([0-9]) ]] && { echo -e "\n${cor1}You entered an invalid number of days!${scor}\n" exit 1 } [[ $dias -lt 1 ]] && { echo -e "\n${cor1}The number must be greater than zero!${scor}\n" exit 1 } echo -ne "\033[1;32mLimit of connections:\033[1;37m ";read sshlimiter [[ -z $sshlimiter ]] && { echo -e "\n${cor1}You left the connection limit empty!${scor}\n" exit 1 } [[ ${sshlimiter} != ?(+|-)+([0-9]) ]] && { echo -e "\n${cor1}You entered an invalid number of connections!${scor}\n" exit 1 } [[ $sshlimiter -lt 1 ]] && { echo -e "\n${cor1}Number of concurrent connections must be greater than zero!${scor}\n" exit 1 } final=$(date "+%Y-%m-%d" -d "+$dias days") gui=$(date "+%d/%m/%Y" -d "+$dias days") pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) useradd -e $final -M -s /bin/false -p $pass $username >/dev/null 2>&1 & echo "$password" >/etc/VPSManager/senha/$username echo "$username $sshlimiter" >>/root/usuarios.db [[ -e /etc/openvpn/server.conf ]] && { echo -ne "\033[1;32mGenerate Ovpn File \033[1;31m? \033[1;33m[s/n]:\033[1;37m "; read resp [[ "$resp" = @(s|S) ]] && { rm $username.zip $username.ovpn >/dev/null 2>&1 echo -ne "\033[1;32mGenerate With Username and Password \033[1;31m? \033[1;33m[s/n]:\033[1;37m " read respost echo -ne "\033[1;32mcurrent host\033[1;37m: \033[1;31m(\033[1;37m$Host\033[1;31m) \033[1;37m- \033[1;32mChange \033[1;31m? \033[1;33m[s/n]:\033[1;37m "; read oprc [[ "$oprc" = @(s|S) ]] && { fun_edithost } || { fun_geraovpn } gerarovpn() { [[ ! -e "/root/$username.zip" ]] && { zip /root/$username.zip /root/$username.ovpn sleep 1.5 } } clear echo -e "\033[1;32m====================================" echo -e "\033[1;32m 🐉ㅤDRAGON VPS MANAGERㅤ🐉 " echo -e "\033[1;32m====================================" echo "" echo -e "\033[1;31m◈─────⪧ IMPORTANT ⪦──────◈" echo "" echo -e "\033[1;32m◈⪧ 🚫ㅤNO SPAM" echo -e "\033[1;32m◈⪧ ⚠️ㅤNO DDOS" echo -e "\033[1;32m◈⪧ 🎭ㅤNO Hacking" echo -e "\033[1;32m◈⪧ ⛔️ㅤNO Carding" echo -e "\033[1;32m◈⪧ 🙅‍♂️ㅤNO Torrent" echo -e "\033[1;32m◈⪧ ❌ㅤNO MultiLogin" echo -e "\033[1;32m◈⪧ 🤷‍♂️ㅤNO Illegal Activities" echo "" echo -e "\033[1;37m◈─────⪧ SSH ACCOUNT ⪦─────◈" echo "" echo -e "\033[1;32m◈ Host / IP :⪧ \033[1;31m$IP" echo -e "\033[1;32m◈ Username :⪧ \033[1;31m$username" echo -e "\033[1;32m◈ Password :⪧ \033[1;31m$password" echo -e "\033[1;32m◈ Login Limit :⪧ \033[1;31m$sshlimiter" echo -e "\033[1;32m◈ Expire Date :⪧ \033[1;31m$gui" echo "" echo -e "\033[1;37m◈──────⪧ PORTS ⪦ ───────◈" echo "" echo -e "\033[1;32m◈ SSH ⌁ 22" echo -e "\033[1;32m◈ SSL ⌁ 443" echo -e "\033[1;32m◈ Squid ⌁ 8080" echo -e "\033[1;32m◈ DropBear ⌁ 80" echo -e "\033[1;32m◈ BadVPN ⌁ 7300" echo "" echo -e "\033[1;37m◈───⪧ONLINE USER COUNT⪦────◈ " echo "" echo -e "\033[1;32mhttp://$IP:8888/server/online" echo "" echo -e "\033[1;37m◈─────────────────────────────────◈" echo -e "\033[1;37m©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉" echo -e "\033[1;37m◈─────────────────────────────────◈" sleep 1 function aguarde() { helice() { gerarovpn >/dev/null 2>&1 & tput civis while [ -d /proc/$! ]; do for i in / - \\ \|; do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo "" echo -ne "\033[1;31mCREATING OVPN...\033[1;33m.\033[1;31m. \033[1;32m" helice echo -e "\e[1DOK" } aguarde VERSION_ID=$(cat /etc/os-release | grep "VERSION_ID") echo "" [[ -d /var/www/html/openvpn ]] && { mv $HOME/$username.zip /var/www/html/openvpn/$username.zip >/dev/null 2>&1 [[ "$VERSION_ID" = 'VERSION_ID="14.04"' ]] && { echo -e "\033[1;32mLINK\033[1;37m: \033[1;36m$IP:81/html/openvpn/$username.zip" } || { echo -e "\033[1;32mLINK\033[1;37m: \033[1;36m$IP:81/openvpn/$username.zip" } } || { echo -e "\033[1;32mAvailable in\033[1;31m" ~/"$username.zip\033[0m" sleep 1 } } || { clear echo -e "\033[1;32m====================================" echo -e "\033[1;32m 🐉ㅤDRAGON VPS MANAGERㅤ🐉 " echo -e "\033[1;32m====================================" echo "" echo -e "\033[1;31m◈─────⪧ IMPORTANT ⪦──────◈" echo "" echo -e "\033[1;32m◈⪧ 🚫ㅤNO SPAM" echo -e "\033[1;32m◈⪧ ⚠️ㅤNO DDOS" echo -e "\033[1;32m◈⪧ 🎭ㅤNO Hacking" echo -e "\033[1;32m◈⪧ ⛔️ㅤNO Carding" echo -e "\033[1;32m◈⪧ 🙅‍♂️ㅤNO Torrent" echo -e "\033[1;32m◈⪧ ❌ㅤNO MultiLogin" echo -e "\033[1;32m◈⪧ 🤷‍♂️ㅤNO Illegal Activities" echo "" echo -e "\033[1;37m◈─────⪧ SSH ACCOUNT ⪦─────◈" echo "" echo -e "\033[1;32m◈ Host / IP :⪧ \033[1;31m$IP" echo -e "\033[1;32m◈ Username :⪧ \033[1;31m$username" echo -e "\033[1;32m◈ Password :⪧ \033[1;31m$password" echo -e "\033[1;32m◈ Login Limit :⪧ \033[1;31m$sshlimiter" echo -e "\033[1;32m◈ Expire Date :⪧ \033[1;31m$gui" echo "" echo -e "\033[1;37m◈──────⪧ PORTS ⪦ ───────◈" echo "" echo -e "\033[1;32m◈ SSH ⌁ 22" echo -e "\033[1;32m◈ SSL ⌁ 443" echo -e "\033[1;32m◈ Squid ⌁ 8080" echo -e "\033[1;32m◈ DropBear ⌁ 80" echo -e "\033[1;32m◈ BadVPN ⌁ 7300" echo "" echo -e "\033[1;37m◈───⪧ONLINE USER COUNT⪦────◈ " echo "" echo -e "\033[1;32mhttp://$IP:8888/server/online" echo "" echo -e "\033[1;37m◈─────────────────────────────────◈" echo -e "\033[1;37m©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉" echo -e "\033[1;37m◈─────────────────────────────────◈" } } || { clear echo -e "\033[1;32m====================================" echo -e "\033[1;32m 🐉ㅤDRAGON VPS MANAGERㅤ🐉 " echo -e "\033[1;32m====================================" echo "" echo -e "\033[1;31m◈─────⪧ IMPORTANT ⪦──────◈" echo "" echo -e "\033[1;32m◈⪧ 🚫ㅤNO SPAM" echo -e "\033[1;32m◈⪧ ⚠️ㅤNO DDOS" echo -e "\033[1;32m◈⪧ 🎭ㅤNO Hacking" echo -e "\033[1;32m◈⪧ ⛔️ㅤNO Carding" echo -e "\033[1;32m◈⪧ 🙅‍♂️ㅤNO Torrent" echo -e "\033[1;32m◈⪧ ❌ㅤNO MultiLogin" echo -e "\033[1;32m◈⪧ 🤷‍♂️ㅤNO Illegal Activities" echo "" echo -e "\033[1;37m◈─────⪧ SSH ACCOUNT ⪦─────◈" echo "" echo -e "\033[1;32m◈ Host / IP :⪧ \033[1;31m$IP" echo -e "\033[1;32m◈ Username :⪧ \033[1;31m$username" echo -e "\033[1;32m◈ Password :⪧ \033[1;31m$password" echo -e "\033[1;32m◈ Login Limit :⪧ \033[1;31m$sshlimiter" echo -e "\033[1;32m◈ Expire Date :⪧ \033[1;31m$gui" echo "" echo -e "\033[1;37m◈──────⪧ PORTS ⪦ ───────◈" echo "" echo -e "\033[1;32m◈ SSH ⌁ 22" echo -e "\033[1;32m◈ SSL ⌁ 443" echo -e "\033[1;32m◈ Squid ⌁ 8080" echo -e "\033[1;32m◈ DropBear ⌁ 80" echo -e "\033[1;32m◈ BadVPN ⌁ 7300" echo "" echo -e "\033[1;37m◈───⪧ONLINE USER COUNT⪦────◈ " echo "" echo -e "\033[1;32mhttp://$IP:8888/server/online" echo "" echo -e "\033[1;37m◈─────────────────────────────────◈" echo -e "\033[1;37m©️ 🐉 DRAGON VPS MANAGER SCRIPT 🐉" echo -e "\033[1;37m◈─────────────────────────────────◈" } ================================================ FILE: Modulos/delhost ================================================ #!/bin/bash if [ -d "/etc/squid/" ]; then payload="/etc/squid/payload.txt" elif [ -d "/etc/squid3/" ]; then payload="/etc/squid3/payload.txt" fi tput setaf 7 ; tput setab 4 ; tput bold ; printf '%35s%s%-10s\n' "ㅤ🐉ㅤRemove Host from Squid Proxyㅤ🐉ㅤ" ; tput sgr0 if [ ! -f "$payload" ] then tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "File $payload not found" ; tput sgr0 exit 1 else tput setaf 2 ; tput bold ; echo ""; echo "Current domains in file $payload:" ; tput sgr0 tput setaf 3 ; tput bold ; echo "" ; cat $payload ; echo "" ; tput sgr0 read -p "Enter the domain you want to remove from the list: " host if [[ -z $host ]] then tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "You have entered an empty or non-existent domain!" ; echo "" ; tput sgr0 exit 1 else if [[ `grep -c "^$host" $payload` -ne 1 ]] then tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "the domain $host not found in the file $payload" ; echo "" ; tput sgr0 exit 1 else grep -v "^$host" $payload > /tmp/a && mv /tmp/a $payload tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "File $payload updated, the domain was removed successfully:" ; tput sgr0 tput setaf 3 ; tput bold ; echo "" ; cat $payload ; echo "" ; tput sgr0 if [ ! -f "/etc/init.d/squid3" ] then service squid3 reload elif [ ! -f "/etc/init.d/squid" ] then service squid reload fi tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "Proxy Squid Proxy reloaded successfully!" ; echo "" ; tput sgr0 exit 1 fi fi fi ================================================ FILE: Modulos/delscript ================================================ #!/bin/bash clear echo -e "\033[1;32mWANT TO UNINSTALLㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ\033[1;33m" read -p "Want to remove? [s/n] " resp if [[ "$resp" = s || "$resp" = S ]];then apt-get purge screen -y > /dev/null 2>&1 apt-get purge nmap -y > /dev/null 2>&1 apt-get purge figlet -y > /dev/null 2>&1 apt-get purge squid -y > /dev/null 2>&1 apt-get purge squid3 -y > /dev/null 2>&1 apt-get purge dropbear -y > /dev/null 2>&1 apt-get purge apache2 -y > /dev/null 2>&1 rm /bin/criarusuario /bin/expcleaner /bin/sshlimiter /bin/addhost /bin/listar /bin/sshmonitor /bin/ajuda /bin/menu /bin/OpenVPN /bin/userbackup /bin/tcpspeed /bin/badvpn /bin/otimizar /bin/speedtest /bin/trafego /bin/banner /bin/limit /bin/limite /bin/senharoot /bin/reiniciarservicos /bin/reiniciarsistema /bin/attscript /bin/criarteste /bin/socks /bin/DropBear /bin/alterarlimite /bin/alterarsenha /bin/remover /bin/detalhes /bin/mudardata /bin/botssh /bin/infousers /bin/droplimiter /bin/conexao /bin/versao > /dev/null 2>&1 rm -rf /etc/VPSManager > /dev/null 2>&1 clear echo -e "\033[1;36mThank you for usingㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ\033[1;33m" sleep 2 cat /dev/null > ~/.bash_history && history -c && exit 0 else echo -e "\033[1;32CTRL+C to get out\033[1;33m" sleep 3 menu fi ================================================ FILE: Modulos/detalhes ================================================ #!/bin/bash clear echo -e "\E[44;1;37m 🐉ㅤℹㅤVPS INFORMATIONㅤℹㅤ🐉 \E[0m" echo "" if [ -f /etc/lsb-release ] then echo -e "\033[1;31m• \033[1;32mOPERATING SYSTEML\033[1;31m •\033[0m" echo "" name=$(cat /etc/lsb-release |grep DESCRIPTION |awk -F = {'print $2'}) codename=$(cat /etc/lsb-release |grep CODENAME |awk -F = {'print $2'}) echo -e "\033[1;33mVersion: \033[1;37m$name" echo -e "\033[1;33mCodeName: \033[1;37m$codename" echo -e "\033[1;33mKernel: \033[1;37m$(uname -s)" echo -e "\033[1;33mKernel Release: \033[1;37m$(uname -r)" if [ -f /etc/os-release ] then devlike=$(cat /etc/os-release |grep LIKE |awk -F = {'print $2'}) echo -e "\033[1;33mDerived from OS: \033[1;37m$devlike" echo "" fi else system=$(cat /etc/issue.net) echo -e "\033[1;31m• \033[1;32mOPERATIONAL SYSTEM\033[1;31m •\033[0m" echo "" echo -e "\033[1;33mVersion: \033[1;37m$system" echo "" fi if [ -f /proc/cpuinfo ] then uso=$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }') echo -e "\033[1;31m• \033[1;32mPROCESSOR\033[1;31m •\033[0m" echo "" modelo=$(cat /proc/cpuinfo |grep "model name" |uniq |awk -F : {'print $2'}) cpucores=$(grep -c cpu[0-9] /proc/stat) cache=$(cat /proc/cpuinfo |grep "cache size" |uniq |awk -F : {'print $2'}) echo -e "\033[1;33mModel:\033[1;37m$modelo" echo -e "\033[1;33mCPU cores:\033[1;37m $cpucores" echo -e "\033[1;33mCache memory:\033[1;37m$cache" echo -e "\033[1;33mArchitecture: \033[1;37m$(uname -p)" echo -e "\033[1;33musage: \033[37m$uso" echo "" else echo -e "\033[1;32mPROCESSOR\033[0m" echo "" echo "Unable to get information" fi if free 1>/dev/null 2>/dev/null then ram1=$(free -h | grep -i mem | awk {'print $2'}) ram2=$(free -h | grep -i mem | awk {'print $4'}) ram3=$(free -h | grep -i mem | awk {'print $3'}) usoram=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }') echo -e "\033[1;31m• \033[1;32mRAM MEMORY\033[1;31m •\033[0m" echo "" echo -e "\033[1;33mTotal: \033[1;37m$ram1" echo -e "\033[1;33mIn Use: \033[1;37m$ram3" echo -e "\033[1;33mFree: \033[1;37m$ram2" echo -e "\033[1;33musage: \033[37m$usoram" echo "" else echo -e "\033[1;32mRAM MEMORY\033[0m" echo "" echo "Unable to get information" fi [[ ! -e /bin/versao ]] && rm -rf /etc/VPSManager echo -e "\033[1;31m• \033[1;32mSERVICES IN PERFORMANCE\033[1;31m •\033[0m" echo "" PT=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN") for porta in `echo -e "$PT" | cut -d: -f2 | cut -d' ' -f1 | uniq`; do svcs=$(echo -e "$PT" | grep -w "$porta" | awk '{print $1}' | uniq) echo -e "\033[1;33mService \033[1;37m$svcs \033[1;33mPort \033[1;37m$porta" done ================================================ FILE: Modulos/droplimiter ================================================ #!/bin/bash database="/root/usuarios.db" echo $$ > /tmp/pids fun_drop () { port_dropbear=`ps aux | grep dropbear | awk NR==1 | awk '{print $17;}'` log=/var/log/auth.log loginsukses='Password auth succeeded' clear pids=`ps ax |grep dropbear |grep " $port_dropbear" |awk -F" " '{print $1}'` for pid in $pids do pidlogs=`grep $pid $log |grep "$loginsukses" |awk -F" " '{print $3}'` i=0 for pidend in $pidlogs do let i=i+1 done if [ $pidend ];then login=`grep $pid $log |grep "$pidend" |grep "$loginsukses"` PID=$pid user=`echo $login |awk -F" " '{print $10}' | sed -r "s/'/ /g"` waktu=`echo $login |awk -F" " '{print $2"-"$1,$3}'` while [ ${#waktu} -lt 13 ]; do waktu=$waktu" " done while [ ${#user} -lt 16 ]; do user=$user" " done while [ ${#PID} -lt 8 ]; do PID=$PID" " done echo "$user $PID $waktu" fi done } if [ ! -f "$database" ] then echo "◇ File /root/usuarios.db not found" exit 1 fi while true do clear echo -e "\E[42;1;37m ㅤ🐉ㅤDROPBEAR LIMITERㅤ🐉ㅤ \E[0m" echo -e "\E[42;1;37m◇Ususario ◇Connection¦Limite\E[0m" while read usline do user="$(echo $usline | cut -d' ' -f1)" s2ssh="$(echo $usline | cut -d' ' -f2)" s3drop="$(fun_drop | grep "$user" | wc -l)" if [ -z "$user" ] ; then echo "" > /dev/null else fun_drop | grep "$user" | awk '{print $2}' |cut -d' ' -f2 > /tmp/userpid sed -n '2 p' /tmp/userpid > /tmp/tmp2 rm /tmp/userpid tput setaf 3 ; tput bold ; printf ' %-35s%s\n' $user $s3drop/$s2ssh; tput sgr0 if [ "$s3drop" -gt "$s2ssh" ]; then echo -e "\E[41;1;37m◇ User disconnected for exceeding the limit! \E[0m" while read line do tmp="$(echo $line | cut -d' ' -f1)" kill $tmp done < /tmp/tmp2 rm /tmp/tmp2 fi fi done < "$database" sleep 6 done ================================================ FILE: Modulos/expcleaner ================================================ #!/bin/bash datenow=$(date +%s) remove_ovp () { if [[ -e /etc/debian_version ]]; then GROUPNAME=nogroup fi user="$1" cd /etc/openvpn/easy-rsa/ ./easyrsa --batch revoke $user ./easyrsa gen-crl rm -rf pki/reqs/$user.req rm -rf pki/private/$user.key rm -rf pki/issued/$user.crt rm -rf /etc/openvpn/crl.pem cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem chown nobody:$GROUPNAME /etc/openvpn/crl.pem [[ -e $HOME/$user.ovpn ]] && rm $HOME/$user.ovpn > /dev/null 2>&1 [[ -e /var/www/html/openvpn/$user.zip ]] && rm /var/www/html/openvpn/$user.zip > /dev/null 2>&1 } > /dev/null 2>&1 echo -e "\E[44;1;37m◇User ◇Date ◇status ◇Action \E[0m" echo "" for user in $(awk -F: '{print $1}' /etc/passwd); do expdate=$(chage -l $user|awk -F: '/Account expires/{print $2}') echo $expdate|grep -q never && continue datanormal=$(date -d"$expdate" '+%d/%m/%Y') tput setaf 3 ; tput bold ; printf '%-15s%-17s%s' $user $datanormal ; tput sgr0 expsec=$(date +%s --date="$expdate") diff=$(echo $datenow - $expsec|bc -l) tput setaf 2 ; tput bold echo $diff|grep -q ^\- && echo "◇ VALID NOT REMOVED" && continue tput setaf 1 ; tput bold echo "◇ USER WAS REMOVED" pkill -f $user userdel --force $user grep -v ^$user[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db if [[ -e /etc/openvpn/server.conf ]]; then remove_ovp $user fi done echo '0' > /etc/VPSManager/Exp tput sgr0 echo "" ================================================ FILE: Modulos/infousers ================================================ #!/bin/bash clear echo -e "\E[44;1;37m◇User ◇Password ◇limit ◇validity \E[0m" echo "" [[ ! -e /bin/versao ]] && rm -rf /bin/menu for users in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |sort |grep -v "nobody" |grep -vi polkitd |grep -vi system-` do if [[ $(grep -cw $users $HOME/usuarios.db) == "1" ]]; then lim=$(grep -w $users $HOME/usuarios.db | cut -d' ' -f2) else lim="1" fi if [[ -e "/etc/VPSManager/senha/$users" ]]; then senha=$(cat /etc/VPSManager/senha/$users) else senha="Null" fi datauser=$(chage -l $users |grep -i co |awk -F : '{print $2}') if [ $datauser = never ] 2> /dev/null then data="\033[1;33mNunca\033[0m" else databr="$(date -d "$datauser" +"%Y%m%d")" hoje="$(date -d today +"%Y%m%d")" if [ $hoje -ge $databr ] then data="\033[1;31mVenceu\033[0m" else dat="$(date -d"$datauser" '+%Y-%m-%d')" data=$(echo -e "$((($(date -ud $dat +%s)-$(date -ud $(date +%Y-%m-%d) +%s))/86400)) \033[1;37mDias\033[0m") fi fi Usuario=$(printf ' %-15s' "$users") Senha=$(printf '%-13s' "$senha") Limite=$(printf '%-10s' "$lim") Data=$(printf '%-1s' "$data") echo -e "\033[1;33m$Usuario \033[1;37m$Senha \033[1;37m$Limite \033[1;32m$Data\033[0m" echo -e "\033[0;34m◇────────────────────────────────────────────────◇\033[0m" done echo "" _tuser=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) _ons=$(ps -x | grep sshd | grep -v root | grep priv | wc -l) [[ "$(cat /etc/VPSManager/Exp)" != "" ]] && _expuser=$(cat /etc/VPSManager/Exp) || _expuser="0" [[ -e /etc/openvpn/openvpn-status.log ]] && _onop=$(grep -c "10.8.0" /etc/openvpn/openvpn-status.log) || _onop="0" [[ -e /etc/default/dropbear ]] && _drp=$(ps aux | grep dropbear | grep -v grep | wc -l) _ondrp=$(($_drp - 1)) || _ondrp="0" _onli=$(($_ons + $_onop + $_ondrp)) echo -e "\033[1;33m◇ \033[1;36mTOTAL USERS\033[1;37m $_tuser \033[1;33m◇ \033[1;32mONLINE\033[1;37m: $_onli \033[1;33m◇ \033[1;31mEXPIRED\033[1;37m: $_expuser \033[1;33m◇\033[0m" ================================================ FILE: Modulos/instsqd ================================================ clear op=$1 [[ ! -d /usr/share/.hehe ]] && exit 0 fun_sqd01() { [[ -e /etc/apt/sources.list.d/trusty_sources.list ]] && { rm /etc/apt/sources.list.d/trusty_sources.list >/dev/null 2>&1 [[ $(grep -wc 'Debian' /etc/issue.net) != '0' ]] && { apt-key del 3B4FE6ACC0B21F32 >/dev/null 2>&1 } apt remove squid3=3.3.8-1ubuntu6 squid=3.3.8-1ubuntu6 squid3-common=3.3.8-1ubuntu6 -y >/dev/null 2>&1 apt update -y >/dev/null 2>&1 apt autoremove -y >/dev/null 2>&1 } apt install squid3 -y >/dev/null 2>&1 } fun_sqd02() { [[ ! -e /etc/apt/sources.list.d/trusty_sources.list ]] && { touch /etc/apt/sources.list.d/trusty_sources.list >/dev/null 2>&1 echo "deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe" | tee --append /etc/apt/sources.list.d/trusty_sources.list >/dev/null 2>&1 } [[ $(grep -wc 'Debian' /etc/issue.net) != '0' ]] && { apt install dirmngr -y >/dev/null 2>&1 [[ $(apt-key list 2>/dev/null | grep -c 'Ubuntu') == '0' ]] && { apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 >/dev/null 2>&1 } } apt update -y >/dev/null 2>&1 apt install squid3=3.3.8-1ubuntu6 squid=3.3.8-1ubuntu6 squid3-common=3.3.8-1ubuntu6 -y >/dev/null 2>&1 wget -qO- https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/squid3 >/etc/init.d/squid3 chmod +x /etc/init.d/squid3 >/dev/null 2>&1 update-rc.d squid3 defaults >/dev/null 2>&1 } [[ $op == '1' ]] && { fun_sqd02 } || { fun_sqd01 } ================================================ FILE: Modulos/limiter ================================================ #!/bin/bash clear database="/root/usuarios.db" fun_multilogin() { ( while read user; do [[ $(grep -wc "$user" $database) != '0' ]] && limit="$(grep -w $user $database | cut -d' ' -f2)" || limit='1' conssh="$(ps -u $user | grep sshd | wc -l)" [[ "$conssh" -gt "$limit" ]] && { pkill -u $user } [[ -e /etc/openvpn/openvpn-status.log ]] && { ovp="$(grep -E ,"$user", /etc/openvpn/openvpn-status.log | wc -l)" [[ "$ovp" -gt "$limit" ]] && { pidokill=$(($limit - $ovp)) listpid=$(grep -E ,"$user", /etc/openvpn/openvpn-status.log | cut -d "," -f3 | head -n $pidokill) while read ovpids; do ( telnet localhost 7505 <<-EOF kill $ovpids EOF ) &>/dev/null & done <<<"$listpid" } } done <<<"$(awk -F: '$3 >= 1000 {print $1}' /etc/passwd)" ) & } while true; do echo 'Checking...' fun_multilogin > /dev/null 2>&1 sleep 15s done ================================================ FILE: Modulos/menu ================================================ #!/bin/bash fun_bar () { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim [[ ! -e /usr/lib/vpsmanager ]] && rm -rf /bin/menu > /dev/null 2>&1 ${comando[0]} -y > /dev/null 2>&1 ${comando[1]} -y > /dev/null 2>&1 touch $HOME/fim ) > /dev/null 2>&1 & tput civis echo -ne "\033[1;33m[" while true; do for((i=0; i<18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne "\033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m" tput cnorm } IP=$(cat /etc/IP) x="ok" menu () { velocity () { aguarde () { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim [[ ! -d /etc/VPSManager ]] && rm -rf /bin/menu ${comando[0]} > /dev/null 2>&1 ${comando[1]} > /dev/null 2>&1 touch $HOME/fim ) > /dev/null 2>&1 & tput civis echo -ne " \033[1;33mPlease Wait... \033[1;37m- \033[1;33m[" while true; do for((i=0; i<18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne " \033[1;33mPlease Wait... \033[1;37m- \033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m" tput cnorm } fun_tst () { speedtest --share > speed } echo "" echo -e " \033[1;32mㅤ🐉ㅤTESTING SERVER SPEEDㅤ🐉ㅤ\033[0m" echo "" aguarde 'fun_tst' echo "" png=$(cat speed | sed -n '5 p' |awk -F : {'print $NF'}) down=$(cat speed | sed -n '7 p' |awk -F : {'print $NF'}) upl=$(cat speed | sed -n '9 p' |awk -F : {'print $NF'}) lnk=$(cat speed | sed -n '10 p' |awk {'print $NF'}) echo -e "\033[0;34m◇─────────────────────────────────────────◇\033[0m" echo -e "\033[1;32m◇ PING (LATENCY):\033[1;37m$png" echo -e "\033[1;32m◇ DOWNLOAD:\033[1;37m$down" echo -e "\033[1;32m◇ UPLOAD:\033[1;37m$upl" echo -e "\033[1;32m◇ LINK: \033[1;36m$lnk\033[0m" echo -e "\033[0;34m◇─────────────────────────────────────────◇\033[0m" rm -rf $HOME/speed } #limiter function limit1 () { clear echo -e "\n\033[1;32m◇ㅤSTARTING USER LIMITER... \033[0m" echo "" fun_bar 'screen -dmS limiter limiter' 'sleep 3' [[ $(grep -wc "limiter" /etc/autostart) = '0' ]] && { echo -e "ps x | grep 'limiter' | grep -v 'grep' && echo 'ON' || screen -dmS limiter limiter" >> /etc/autostart } || { sed -i '/limiter/d' /etc/autostart echo -e "ps x | grep 'limiter' | grep -v 'grep' && echo 'ON' || screen -dmS limiter limiter" >> /etc/autostart } echo -e "\n\033[1;32m◇ㅤUSER LIMITER ACTIVED !\033[0m" sleep 3 menu } function limit2 () { clear echo -e "\033[1;32m◇ㅤSTOPPING USER LIMITER... \033[0m" echo "" fun_stplimiter () { sleep 1 screen -r -S "limiter" -X quit screen -wipe 1>/dev/null 2>/dev/null [[ $(grep -wc "limiter" /etc/autostart) != '0' ]] && { sed -i '/limiter/d' /etc/autostart } sleep 1 } fun_bar 'fun_stplimiter' 'sleep 3' echo -e "\n\033[1;31m◇ㅤUSER LIMITER STOPPED!\033[0m" sleep 3 menu } function limit_ssh () { [[ $(ps x | grep "limiter"|grep -v grep |wc -l) = '0' ]] && limit1 || limit2 } function autoexec () { if grep "menu;" /etc/profile > /dev/null; then clear echo -e "\033[1;32m◇ㅤDISABLING SELF-RUN\033[0m" offautmenu () { sed -i '/menu;/d' /etc/profile } echo "" fun_bar 'offautmenu' echo "" echo -e "\033[1;31m◇ㅤAUTO RUN DISABLED!\033[0m" sleep 1.5s menu2 else clear echo -e "\033[1;32mA◇ㅤCTIVATING SELF-RUN\033[0m" autmenu () { grep -v "^menu;" /etc/profile > /tmp/tmpass && mv /tmp/tmpass /etc/profile echo "menu;" >> /etc/profile } echo "" fun_bar 'autmenu' echo "" echo -e "\033[1;32m◇ㅤAUTO RUN ON!\033[0m" sleep 1.5s menu2 fi } #menu2 menu2 (){ [[ -e /etc/Plus-torrent ]] && stsf=$(echo -e "\033[1;32m♦ ") || stsf=$(echo -e "\033[1;31m○ ") stsbot=$(ps x | grep "bot_plus"|grep -v grep > /dev/null && echo -e "\033[1;32m♦ " || echo -e "\033[1;31m○ ") autm=$(grep "menu;" /etc/profile > /dev/null && echo -e "\033[1;32m♦ " || echo -e "\033[1;31m○ ") [[ ! -e /usr/lib/licence ]] && rm -rf /bin > /dev/null 2>&1 if [[ "$(grep -c "Ubuntu" /etc/issue.net)" = "1" ]]; then system=$(cut -d' ' -f1 /etc/issue.net) system+=$(echo ' ') system+=$(cut -d' ' -f2 /etc/issue.net |awk -F "." '{print $1}') elif [[ "$(grep -c "Debian" /etc/issue.net)" = "1" ]]; then system=$(cut -d' ' -f1 /etc/issue.net) system+=$(echo ' ') system+=$(cut -d' ' -f3 /etc/issue.net) else system=$(cut -d' ' -f1 /etc/issue.net) fi _ons=$(ps -x | grep sshd | grep -v root | grep priv | wc -l) [[ "$(cat /etc/VPSManager/Exp)" != "" ]] && _expuser=$(cat /etc/VPSManager/Exp) || _expuser="0" [[ -e /etc/openvpn/openvpn-status.log ]] && _onop=$(grep -c "10.8.0" /etc/openvpn/openvpn-status.log) || _onop="0" [[ -e /etc/default/dropbear ]] && _drp=$(ps aux | grep dropbear | grep -v grep | wc -l) _ondrp=$(($_drp - 1)) || _ondrp="0" _onli=$(($_ons + $_onop + $_ondrp)) _ram=$(printf ' %-9s' "$(free -h | grep -i mem | awk {'print $2'})") _usor=$(printf '%-8s' "$(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }')") _usop=$(printf '%-1s' "$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }')") _core=$(printf '%-1s' "$(grep -c cpu[0-9] /proc/stat)") _system=$(printf '%-14s' "$system") _hora=$(printf '%(%H:%M:%S)T') _onlin=$(printf '%-5s' "$_onli") _userexp=$(printf '%-5s' "$_expuser") _tuser=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) clear echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo -e "\E[41;1;37m •ㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ• \E[0m" echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo -e "\033[1;32m◇ㅤSYSTEM ◇ㅤRAM MEMORY ◇ㅤPROCESSOR" echo -e "\033[1;31mOS: \033[1;37m$_system \033[1;31mTotal:\033[1;37m$_ram \033[1;31mCPU cores: \033[1;37m$_core\033[0m" echo -e "\033[1;31mUp Time: \033[1;37m$_hora \033[1;31mIn use: \033[1;37m$_usor \033[1;31mIn use: \033[1;37m$_usop\033[0m" echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" [[ ! -e /tmp/att ]] && { echo -e "\033[1;32m◇ㅤOnline:\033[1;37m $_onlin \033[1;31m◇ㅤexpired: \033[1;37m$_userexp\033[1;33m◇ㅤTotal: \033[1;37m$_tuser\033[0m" var01='\033[1;37m•' } || { echo -e " \033[1;33m[\033[1;31m!\033[1;33m] \033[1;32m◇ THERE IS AN UPDATE AVAILABLE! \033[1;33m[\033[1;31m!\033[1;33m]\033[0m" var01="\033[1;32m!" } echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo "" echo -e "\033[1;31m[\033[1;36m20\033[1;31m] \033[1;37m◇ \033[1;33mADD HOST \033[1;31m [\033[1;36m26\033[1;31m] \033[1;37m◇ \033[1;33mCHANGE ROOT PASSWORD \033[1;31m [\033[1;36m21\033[1;31m] \033[1;37m◇ \033[1;33mREMOVE HOST \033[1;31m [\033[1;36m27\033[1;31m] \033[1;37m◇ \033[1;33mSELF EXECUTION $autm \033[1;31m [\033[1;36m22\033[1;31m] \033[1;37m◇ \033[1;33mRESTART SYSTEM \033[1;31m [\033[1;36m28\033[1;31m] $var01 \033[1;33mUPDATE SCRIPT \033[1;31m [\033[1;36m23\033[1;31m] \033[1;37m◇ \033[1;33mRESTART SERVICES \033[1;31m [\033[1;36m29\033[1;31m] \033[1;37m◇ \033[1;33mREMOVE SCRIPT \033[1;31m [\033[1;36m24\033[1;31m] \033[1;37m◇ \033[1;33mBLOCK TORRENT $stsf\033[1;31m [\033[1;36m30\033[1;31m] \033[1;37m◇ \033[1;33mCOME BACK \033[1;32m<\033[1;33m<\033[1;31m< \033[1;31m [\033[1;36m25\033[1;31m] \033[1;37m◇ \033[1;33mTELEGRAM BOT $stsbot\033[1;31m [\033[1;36m00\033[1;31m] \033[1;37m◇ \033[1;33mGET OUT \033[1;32m<\033[1;33m<\033[1;31m<\033[1;31m" echo "" echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo "" echo -ne "\033[1;32m◇ WHAT DO YOU WANT TO DO \033[1;33m?\033[1;31m?\033[1;37m : "; read x case "$x" in 20) clear addhost echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read menu2 ;; 21) clear delhost echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read menu2 ;; 22) clear reiniciarsistema ;; 23) clear reiniciarservicos sleep 3 ;; 24) blockt ;; 25) botssh ;; 26) clear senharoot sleep 3 ;; 27) autoexec ;; 28) attscript ;; 29) clear delscript ;; 30) menu ;; 0|00) echo -e "\033[1;31m◇ Going out...\033[0m" sleep 2 clear exit; ;; *) echo -e "\n\033[1;31m◇ Invalid option !\033[0m" sleep 2 esac } while true $x != "ok" do stsl=$(ps x | grep "limiter"|grep -v grep > /dev/null && echo -e "\033[1;32m♦ " || echo -e "\033[1;31m○ ") stsu=$(ps x | grep "udpvpn"|grep -v grep > /dev/null && echo -e "\033[1;32m♦ " || echo -e "\033[1;31m○ ") if [[ "$(grep -c "Ubuntu" /etc/issue.net)" = "1" ]]; then system=$(cut -d' ' -f1 /etc/issue.net) system+=$(echo ' ') system+=$(cut -d' ' -f2 /etc/issue.net |awk -F "." '{print $1}') elif [[ "$(grep -c "Debian" /etc/issue.net)" = "1" ]]; then system=$(cut -d' ' -f1 /etc/issue.net) system+=$(echo ' ') system+=$(cut -d' ' -f3 /etc/issue.net) else system=$(cut -d' ' -f1 /etc/issue.net) fi _ons=$(ps -x | grep sshd | grep -v root | grep priv | wc -l) [[ "$(cat /etc/VPSManager/Exp)" != "" ]] && _expuser=$(cat /etc/VPSManager/Exp) || _expuser="0" [[ -e /etc/openvpn/openvpn-status.log ]] && _onop=$(grep -c "10.8.0" /etc/openvpn/openvpn-status.log) || _onop="0" [[ -e /etc/default/dropbear ]] && _drp=$(ps aux | grep dropbear | grep -v grep | wc -l) _ondrp=$(($_drp - 1)) || _ondrp="0" _onli=$(($_ons + $_onop + $_ondrp)) _ram=$(printf ' %-9s' "$(free -h | grep -i mem | awk {'print $2'})") _usor=$(printf '%-8s' "$(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }')") _usop=$(printf '%-1s' "$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }')") _core=$(printf '%-1s' "$(grep -c cpu[0-9] /proc/stat)") _system=$(printf '%-14s' "$system") _hora=$(printf '%(%H:%M:%S)T') _onlin=$(printf '%-5s' "$_onli") _userexp=$(printf '%-5s' "$_expuser") _tuser=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) clear echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo -e "\E[41;1;37m •ㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ• \E[0m" echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo -e "\033[1;32m◇ㅤSYSTEM ◇ㅤRAM MEMORY ◇ㅤPROCESSOR " echo -e "\033[1;31mOS: \033[1;37m$_system \033[1;31mTotal:\033[1;37m$_ram \033[1;31mCPU cores: \033[1;37m$_core\033[0m" echo -e "\033[1;31mUp Time: \033[1;37m$_hora \033[1;31mIn use: \033[1;37m$_usor \033[1;31mIn use: \033[1;37m$_usop\033[0m" echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo -e "\033[1;32m◇ㅤOnline:\033[1;37m $_onlin \033[1;31m◇ㅤexpired: \033[1;37m$_userexp\033[1;33m◇ㅤTotal: \033[1;37m$_tuser\033[0m" echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo "" echo -e "\033[1;31m[\033[1;36m01\033[1;31m] \033[1;37m◇ \033[1;33mCREATE USER \033[1;31m [\033[1;36m11\033[1;31m] \033[1;37m◇ \033[1;33mSPEEDTEST \033[1;31m [\033[1;36m02\033[1;31m] \033[1;37m◇ \033[1;33mCREATE TEST USER \033[1;31m [\033[1;36m12\033[1;31m] \033[1;37m◇ \033[1;33mBANNER \033[1;31m [\033[1;36m03\033[1;31m] \033[1;37m\033[1;37m◇ \033[1;33mREMOVE USER \033[1;31m [\033[1;36m13\033[1;31m] \033[1;37m◇ \033[1;33mNETWORK TRAFFIC \033[1;31m [\033[1;36m04\033[1;31m] \033[1;37m◇ \033[1;33mONLINE USER MONITOR \033[1;31m [\033[1;36m14\033[1;31m] \033[1;37m◇ \033[1;33mVPS OPTIMIZE \033[1;31m [\033[1;36m05\033[1;31m] \033[1;37m◇ \033[1;33mCHANGE DATE \033[1;31m [\033[1;36m15\033[1;31m] \033[1;37m◇ \033[1;33mUSER BACKUP \033[1;31m [\033[1;36m06\033[1;31m] \033[1;37m◇ \033[1;33mCHANGE LIMIT \033[1;31m [\033[1;36m16\033[1;31m] \033[1;37m◇ \033[1;33mUSER LIMITER $stsl\033[1;31m [\033[1;36m07\033[1;31m] \033[1;37m◇ \033[1;33mCHANGE PASSWORD \033[1;31m [\033[1;36m17\033[1;31m] \033[1;37m◇ \033[1;33mBAD VPN $stsu\033[1;31m [\033[1;36m08\033[1;31m] \033[1;37m◇ \033[1;33mREMOVE EXPIRED \033[1;31m [\033[1;36m18\033[1;31m] \033[1;37m◇ \033[1;33mVPS INFO \033[1;31m [\033[1;36m09\033[1;31m] \033[1;37m◇ \033[1;33mUSER REPORT \033[1;31m [\033[1;36m19\033[1;31m] \033[1;37m◇ \033[1;33mMORE OPTIONS \033[1;31m>\033[1;33m>\033[1;32m>\033[0m\033[1;31m [\033[1;36m10\033[1;31m] \033[1;37m◇ \033[1;33mCONNECTION MODE \033[1;31m [\033[1;36m00\033[1;31m] \033[1;37m◇ \033[1;33mGET OUT \033[1;32m<\033[1;33m<\033[1;31m<\033[0m \033[0m" echo "" echo -e "\033[0;34m◇───────────────────────────────────────────────◇\033[0m" echo "" echo -ne "\033[1;32m◇ WHAT DO YOU WANT TO DO \033[1;33m?\033[1;31m?\033[1;37m : "; read x case "$x" in 1 | 01) clear criarusuario echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 2 | 02) clear criarteste echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 3 | 03) clear remover sleep 3 ;; 4 | 04) clear sshmonitor echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 5 | 05) clear mudardata sleep 3 ;; 6 | 06) clear alterarlimite sleep 3 ;; 7 | 07) clear alterarsenha sleep 3 ;; 8 | 08) clear expcleaner echo "" sleep 3 ;; 9 | 09) clear infousers echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 10) conexao exit; ;; 11) clear velocity echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 12) clear banner sleep 3 ;; 13) clear echo -e "\033[1;32m◇ TO GET OUT PRESS:- CTRL + C\033[1;36m" sleep 4 nload ;; 14) clear otimizar echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 15) userbackup echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 16) limit_ssh ;; 17) clear badvpn exit; ;; 18) clear detalhes echo -ne "\n\033[1;31m◇ ENTER \033[1;33mto return to \033[1;32mMENU!\033[0m"; read ;; 19) menu2 ;; 0 | 00) echo -e "\033[1;31m◇ Going out...\033[0m" sleep 2 clear exit; ;; *) echo -e "\n\033[1;31m◇ Invalid option !\033[0m" sleep 2 esac done } menu #fim ================================================ FILE: Modulos/mudardata ================================================ #!/bin/bash tput setaf 7 ; tput setab 4 ; tput bold ; printf '%33s%s%-12s\n' "🐉ㅤ📅ㅤchange expiry dateㅤ📅ㅤ🐉" ; tput sgr0 echo "" echo -e "\033[1;33m◇ LIST OF USERS AND EXPIRY DATE:\033[0m " echo "" tput setaf 7 ; tput bold database="/root/usuarios.db" list_user=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody) i=0 i=0 unset _userPass while read user; do i=$(expr $i + 1) _oP=$i [[ $i == [1-9] ]] && i=0$i && oP+=" 0$i" expire="$(chage -l $user | grep -E "Account expires" | cut -d ' ' -f3-)" if [[ $expire == "never" ]] then echo -e "\033[1;31m[\033[1;36m$i\033[1;31m] \033[1;37m- \033[1;32m$user \033[1;33m00/00/0000 S/DATE\033[0m" else databr="$(date -d "$expire" +"%Y%m%d")" hoje="$(date -d today +"%Y%m%d")" if [ $hoje -ge $databr ] then _user=$(echo -e "\033[1;31m[\033[1;36m$i\033[1;31m] \033[1;37m- \033[1;32m$user\033[1;37m") datanormal="$(echo -e "\033[1;31m$(date -d"$expire" '+%d/%m/%Y')")" expired=$(echo -e "\033[1;31m◇ㅤUNVALID\033[0m") printf '%-62s%-20s%s\n' "$_user" "$datanormal" "$expired" echo "exp" > /tmp/exp else _user=$(echo -e "\033[1;31m[\033[1;36m$i\033[1;31m] \033[1;37m- \033[1;32m$user\033[1;37m") datanormal="$(echo -e "\033[1;33m$(date -d"$expire" '+%d/%m/%Y')")" ative=$(echo -e "\033[1;32m◇ㅤVALID\033[0m") printf '%-62s%-20s%s\n' "$_user" "$datanormal" "$ative" fi fi _userPass+="\n${_oP}:${user}" done <<< "${list_user}" tput sgr0 echo "" if [ -a /tmp/exp ] then rm /tmp/exp fi num_user=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) echo -ne "\033[1;32m◇ㅤEnter or select a user \033[1;33m[\033[1;36m1\033[1;33m-\033[1;36m$num_user\033[1;33m]\033[1;37m: " ; read option if [[ -z $option ]] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "◇ㅤError, Empty or Invalid Username! " ; tput sgr0 exit 1 fi usuario=$(echo -e "${_userPass}" | grep -E "\b$option\b" | cut -d: -f2) if [[ -z $usuario ]] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "◇ㅤError, Empty or Invalid Username!!! " ; tput sgr0 echo "" exit 1 else if [[ `grep -c /$usuario: /etc/passwd` -ne 0 ]] then echo "" echo -e "\033[1;31m◇EX:\033[1;33m(\033[1;32mDATE: \033[1;37mDAY/MONTH/YEAR \033[1;33mOR \033[1;32mDAYS: \033[1;37m30\033[1;33m)" echo "" echo -ne "\033[1;32m◇ㅤNew date or days for the user \033[1;33m$usuario: \033[1;37m"; read inputdate if [[ "$(echo -e "$inputdate" | grep -c "/")" = "0" ]]; then udata=$(date "+%d/%m/%Y" -d "+$inputdate days") sysdate="$(echo "$udata" | awk -v FS=/ -v OFS=- '{print $3,$2,$1}')" else udata=$(echo -e "$inputdate") sysdate="$(echo "$inputdate" | awk -v FS=/ -v OFS=- '{print $3,$2,$1}')" fi if (date "+%Y-%m-%d" -d "$sysdate" > /dev/null 2>&1) then if [[ -z $inputdate ]] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "◇ㅤYou have entered an invalid or non-existent date!" ; echo "Enter a valid date in DAY/MONTH/YEAR format " ; echo "For example: 21/04/2022" ; tput sgr0 ; tput sgr0 echo "" exit 1 else if (echo $inputdate | egrep [^a-zA-Z] &> /dev/null) then today="$(date -d today +"%Y%m%d")" timemachine="$(date -d "$sysdate" +"%Y%m%d")" if [ $today -ge $timemachine ] then echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "◇ㅤYou have entered an invalid or non-existent date!!" ; echo "Enter a valid future date in DAY/MONTH/YEAR format" ; echo "For example: 21/04/2022" ; tput sgr0 echo "" exit 1 else chage -E $sysdate $usuario echo "" tput setaf 7 ; tput setab 4 ; tput bold ; echo "◇ㅤUser Success $usuario new date: $udata " ; tput sgr0 echo "" exit 1 fi else echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "◇ㅤYou have entered an invalid or non-existent date!" ; echo "Enter a valid date in DAY/MONTH/YEAR format" ; echo "For example: 21/04/2022" ; tput sgr0 echo "" exit 1 fi fi else echo "" tput setaf 7 ; tput setab 1 ; tput bold ; echo "◇ㅤYou have entered an invalid or non-existent date!" ; echo "Enter a valid date in DAY/MONTH/YEAR format" ; echo "For example: 21/04/2018" ; tput sgr0 echo "" exit 1 fi else echo " " tput setaf 7 ; tput setab 1 ; tput bold ; echo "◇ㅤThe user $usuario does not exist!" ; tput sgr0 echo " " exit 1 fi fi ================================================ FILE: Modulos/onlineapp.sh ================================================ #!/bin/bash ps -x | grep sshd | grep -v root | grep priv | wc -l > /var/www/html/server/online ================================================ FILE: Modulos/open.py ================================================ #!/usr/bin/env python3 # encoding: utf-8 import socket, threading, thread, select, signal, sys, time from os import system system("clear") #conexao IP = '0.0.0.0' try: PORT = int(sys.argv[1]) except: PORT = 8080 PASS = '' BUFLEN = 8196 * 8 TIMEOUT = 60 MSG = '🐉ㅤDRAGON VPS MANAGERㅤ🐉' DEFAULT_HOST = '0.0.0.0:1194' RESPONSE = "HTTP/1.1 200 " + str(MSG) + "\r\n\r\n" class Server(threading.Thread): def __init__(self, host, port): threading.Thread.__init__(self) self.running = False self.host = host self.port = port self.threads = [] self.threadsLock = threading.Lock() self.logLock = threading.Lock() def run(self): self.soc = socket.socket(socket.AF_INET) self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.soc.settimeout(2) self.soc.bind((self.host, self.port)) self.soc.listen(0) self.running = True try: while self.running: try: c, addr = self.soc.accept() c.setblocking(1) except socket.timeout: continue conn = ConnectionHandler(c, self, addr) conn.start(); self.addConn(conn) finally: self.running = False self.soc.close() def printLog(self, log): self.logLock.acquire() print log self.logLock.release() def addConn(self, conn): try: self.threadsLock.acquire() if self.running: self.threads.append(conn) finally: self.threadsLock.release() def removeConn(self, conn): try: self.threadsLock.acquire() self.threads.remove(conn) finally: self.threadsLock.release() def close(self): try: self.running = False self.threadsLock.acquire() threads = list(self.threads) for c in threads: c.close() finally: self.threadsLock.release() class ConnectionHandler(threading.Thread): def __init__(self, socClient, server, addr): threading.Thread.__init__(self) self.clientClosed = False self.targetClosed = True self.client = socClient self.client_buffer = '' self.server = server self.log = 'Conexao: ' + str(addr) def close(self): try: if not self.clientClosed: self.client.shutdown(socket.SHUT_RDWR) self.client.close() except: pass finally: self.clientClosed = True try: if not self.targetClosed: self.target.shutdown(socket.SHUT_RDWR) self.target.close() except: pass finally: self.targetClosed = True def run(self): try: self.client_buffer = self.client.recv(BUFLEN) hostPort = self.findHeader(self.client_buffer, 'X-Real-Host') if hostPort == '': hostPort = DEFAULT_HOST split = self.findHeader(self.client_buffer, 'X-Split') if split != '': self.client.recv(BUFLEN) if hostPort != '': passwd = self.findHeader(self.client_buffer, 'X-Pass') if len(PASS) != 0 and passwd == PASS: self.method_CONNECT(hostPort) elif len(PASS) != 0 and passwd != PASS: self.client.send('HTTP/1.1 400 WrongPass!\r\n\r\n') if hostPort.startswith(IP): self.method_CONNECT(hostPort) else: self.client.send('HTTP/1.1 403 Forbidden!\r\n\r\n') else: print '- No X-Real-Host!' self.client.send('HTTP/1.1 400 NoXRealHost!\r\n\r\n') except Exception as e: self.log += ' - error: ' + e.strerror self.server.printLog(self.log) pass finally: self.close() self.server.removeConn(self) def findHeader(self, head, header): aux = head.find(header + ': ') if aux == -1: return '' aux = head.find(':', aux) head = head[aux+2:] aux = head.find('\r\n') if aux == -1: return '' return head[:aux]; def connect_target(self, host): i = host.find(':') if i != -1: port = int(host[i+1:]) host = host[:i] else: if self.method=='CONNECT': port = 443 else: port = 22 (soc_family, soc_type, proto, _, address) = socket.getaddrinfo(host, port)[0] self.target = socket.socket(soc_family, soc_type, proto) self.targetClosed = False self.target.connect(address) def method_CONNECT(self, path): self.log += ' - CONNECT ' + path self.connect_target(path) self.client.sendall(RESPONSE) self.client_buffer = '' self.server.printLog(self.log) self.doCONNECT() def doCONNECT(self): socs = [self.client, self.target] count = 0 error = False while True: count += 1 (recv, _, err) = select.select(socs, [], socs, 3) if err: error = True if recv: for in_ in recv: try: data = in_.recv(BUFLEN) if data: if in_ is self.target: self.client.send(data) else: while data: byte = self.target.send(data) data = data[byte:] count = 0 else: break except: error = True break if count == TIMEOUT: error = True if error: break def main(host=IP, port=PORT): print "\033[0;34m━"*8,"\033[1;32m PROXY SOCKS","\033[0;34m━"*8,"\n" print "\033[1;33mIP:\033[1;32m " + IP print "\033[1;33mPORTA:\033[1;32m " + str(PORT) + "\n" print "\033[0;34m━"*10,"\033[1;32m 🐉ㅤDRAGON VPS MANAGERㅤ🐉","\033[0;34m━\033[1;37m"*11,"\n" server = Server(IP, PORT) server.start() while True: try: time.sleep(2) except KeyboardInterrupt: print '\nstopping...' server.close() break if __name__ == '__main__': main() ================================================ FILE: Modulos/otimizar ================================================ #!/bin/bash fun_bar() { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim ${comando[0]} -y >/dev/null 2>&1 ${comando[1]} -y >/dev/null 2>&1 touch $HOME/fim ) >/dev/null 2>&1 & tput civis echo -ne " \033[1;33m◇ Please Wait... \033[1;37m- \033[1;33m[" while true; do for ((i = 0; i < 18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne " \033[1;33m◇ Please Wait... \033[1;37m- \033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m" tput cnorm } [[ $(grep -wc mlocate /var/lib/dpkg/statoverride) != '0' ]] && sed -i '/mlocate/d' /var/lib/dpkg/statoverride clear echo -e "\E[44;1;37m 🐉ㅤServer Optimizeㅤ🐉 \E[0m" echo "" echo -e "\033[1;32m ◇ Updating packages\033[0m" echo "" fun_bar 'apt-get update -y' 'apt-get upgrade -y' echo "" echo -e "\033[1;32m ◇ Fixing dependency issues" echo"" fun_bar 'apt-get -f install' echo"" echo -e "\033[1;32m ◇ Removing useless packages" echo "" fun_bar 'apt-get autoremove -y' 'apt-get autoclean -y' echo "" echo -e "\033[1;32m ◇ Removing problem packages" echo "" fun_bar 'apt-get -f remove -y' 'apt-get clean -y' #Limpar o cache memoria RAM clear echo -e "\033[1;31m◇────────────────────────────────────────────────◇\033[0m" echo "" MEM1=$(free | awk '/Mem:/ {print int(100*$3/$2)}') ram1=$(free -h | grep -i mem | awk {'print $2'}) ram2=$(free -h | grep -i mem | awk {'print $4'}) ram3=$(free -h | grep -i mem | awk {'print $3'}) swap1=$(free -h | grep -i swap | awk {'print $2'}) swap2=$(free -h | grep -i swap | awk {'print $4'}) swap3=$(free -h | grep -i swap | awk {'print $3'}) echo -e "\033[1;31m•\033[1;32m◇ Before\033[1;31m•\033[0m \033[1;31m•\033[1;32m◇ After\033[1;31m•\033[0m" echo -e " \033[1;33m◇ Total RAM: \033[1;37m$ram1 \033[1;33m◇ Total RAM: \033[1;37m$swap1" echo -e " \033[1;33m◇ In use: \033[1;37m$ram3 \033[1;33m◇ In use: \033[1;37m$swap3" echo -e " \033[1;33m◇ Free: \033[1;37m$ram2 \033[1;33m◇ Free: \033[1;37m$swap2\033[0m" echo "" echo -e "\033[1;37m◇ Memory \033[1;32m◇ RAM \033[1;37m◇ Before Optimization:\033[1;36m" $MEM1% echo "" echo -e "\033[1;31m◇────────────────────────────────────────────────◇\033[0m" sleep 2 echo "" fun_limpram() { sync echo 3 >/proc/sys/vm/drop_caches sync && sysctl -w vm.drop_caches=3 sysctl -w vm.drop_caches=0 swapoff -a swapon -a sleep 4 } function aguarde() { sleep 1 helice() { fun_limpram >/dev/null 2>&1 & tput civis while [ -d /proc/$! ]; do for i in / - \\ \|; do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo -ne "\033[1;37m◇ CLEANING MEMORY \033[1;32m◇ RAM \033[1;37me \033[1;32m◇ SWAP\033[1;32m.\033[1;33m.\033[1;31m. \033[1;33m" helice echo -e "\e[1DOk" } aguarde sleep 1 clear echo -e "\033[1;32m◇────────────────────────────────────────────────◇\033[0m" echo "" MEM2=$(free | awk '/Mem:/ {print int(100*$3/$2)}') ram1=$(free -h | grep -i mem | awk {'print $2'}) ram2=$(free -h | grep -i mem | awk {'print $4'}) ram3=$(free -h | grep -i mem | awk {'print $3'}) swap1=$(free -h | grep -i swap | awk {'print $2'}) swap2=$(free -h | grep -i swap | awk {'print $4'}) swap3=$(free -h | grep -i swap | awk {'print $3'}) echo -e "\033[1;31m•\033[1;32m◇ Before\033[1;31m•\033[0m \033[1;31m•\033[1;32m◇ After\033[1;31m•\033[0m" echo -e " \033[1;33m◇ Total RAM: \033[1;37m$ram1 \033[1;33m◇ Total RAM: \033[1;37m$swap1" echo -e " \033[1;33m◇ In Use: \033[1;37m$ram3 \033[1;33m◇ In use: \033[1;37m$swap3" echo -e " \033[1;33m◇ Free: \033[1;37m$ram2 \033[1;33m◇ Free: \033[1;37m$swap2\033[0m" echo "" echo -e "\033[1;37m◇ Memory \033[1;32mRAM \033[1;37m◇ Optimized percentage:\033[1;36m" $MEM2% echo "" echo -e "\033[1;37m◇ Saving :\033[1;31m $(expr $MEM1 - $MEM2)%\033[0m" echo "" echo -e "\033[1;32m◇────────────────────────────────────────────────◇\033[0m" ================================================ FILE: Modulos/proxy.py ================================================ #!/usr/bin/env python3 # encoding: utf-8 import socket, threading, thread, select, signal, sys, time from os import system system("clear") #conexao IP = '0.0.0.0' try: PORT = int(sys.argv[1]) except: PORT = 80 PASS = '' BUFLEN = 8196 * 8 TIMEOUT = 60 MSG = '' COR = '' FTAG = '' DEFAULT_HOST = '0.0.0.0:22' RESPONSE = "HTTP/1.1 200 " + str(COR) + str(MSG) + str(FTAG) + "\r\n\r\n" class Server(threading.Thread): def __init__(self, host, port): threading.Thread.__init__(self) self.running = False self.host = host self.port = port self.threads = [] self.threadsLock = threading.Lock() def run(self): self.soc = socket.socket(socket.AF_INET) self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.soc.settimeout(2) self.soc.bind((self.host, self.port)) self.soc.listen(0) self.running = True try: while self.running: try: c, addr = self.soc.accept() c.setblocking(1) except socket.timeout: continue conn = ConnectionHandler(c, self, addr) conn.start(); self.addConn(conn) finally: self.running = False self.soc.close() def addConn(self, conn): try: self.threadsLock.acquire() if self.running: self.threads.append(conn) finally: self.threadsLock.release() def removeConn(self, conn): try: self.threadsLock.acquire() self.threads.remove(conn) finally: self.threadsLock.release() def close(self): try: self.running = False self.threadsLock.acquire() threads = list(self.threads) for c in threads: c.close() finally: self.threadsLock.release() class ConnectionHandler(threading.Thread): def __init__(self, socClient, server, addr): threading.Thread.__init__(self) self.clientClosed = False self.targetClosed = True self.client = socClient self.client_buffer = '' self.server = server def close(self): try: if not self.clientClosed: self.client.shutdown(socket.SHUT_RDWR) self.client.close() except: pass finally: self.clientClosed = True try: if not self.targetClosed: self.target.shutdown(socket.SHUT_RDWR) self.target.close() except: pass finally: self.targetClosed = True def run(self): try: self.client_buffer = self.client.recv(BUFLEN) hostPort = self.findHeader(self.client_buffer, 'X-Real-Host') if hostPort == '': hostPort = DEFAULT_HOST split = self.findHeader(self.client_buffer, 'X-Split') if split != '': self.client.recv(BUFLEN) if hostPort != '': passwd = self.findHeader(self.client_buffer, 'X-Pass') if len(PASS) != 0 and passwd == PASS: self.method_CONNECT(hostPort) elif len(PASS) != 0 and passwd != PASS: self.client.send('HTTP/1.1 400 WrongPass!\r\n\r\n') if hostPort.startswith(IP): self.method_CONNECT(hostPort) else: self.client.send('HTTP/1.1 403 Forbidden!\r\n\r\n') else: print '- No X-Real-Host!' self.client.send('HTTP/1.1 400 NoXRealHost!\r\n\r\n') except Exception as e: pass finally: self.close() self.server.removeConn(self) def findHeader(self, head, header): aux = head.find(header + ': ') if aux == -1: return '' aux = head.find(':', aux) head = head[aux+2:] aux = head.find('\r\n') if aux == -1: return '' return head[:aux]; def connect_target(self, host): i = host.find(':') if i != -1: port = int(host[i+1:]) host = host[:i] else: if self.method=='CONNECT': port = 443 else: port = 22 (soc_family, soc_type, proto, _, address) = socket.getaddrinfo(host, port)[0] self.target = socket.socket(soc_family, soc_type, proto) self.targetClosed = False self.target.connect(address) def method_CONNECT(self, path): self.connect_target(path) self.client.sendall(RESPONSE) self.client_buffer = '' self.doCONNECT() def doCONNECT(self): socs = [self.client, self.target] count = 0 error = False while True: count += 1 (recv, _, err) = select.select(socs, [], socs, 3) if err: error = True if recv: for in_ in recv: try: data = in_.recv(BUFLEN) if data: if in_ is self.target: self.client.send(data) else: while data: byte = self.target.send(data) data = data[byte:] count = 0 else: break except: error = True break if count == TIMEOUT: error = True if error: break def main(host=IP, port=PORT): print "\033[0;34m━"*8,"\033[1;32m PROXY SOCKS","\033[0;34m━"*8,"\n" print "\033[1;33mIP:\033[1;32m " + IP print "\033[1;33mPORTA:\033[1;32m " + str(PORT) + "\n" print "\033[0;34m━"*10,"\033[1;32m VPSMANAGER","\033[0;34m━\033[1;37m"*11,"\n" server = Server(IP, PORT) server.start() while True: try: time.sleep(2) except KeyboardInterrupt: print '\nstopping...' server.close() break if __name__ == '__main__': main() ================================================ FILE: Modulos/reiniciarservicos ================================================ #!/bin/bash clear fun_prog () { comando[0]="$1" ${comando[0]} > /dev/null 2>&1 & tput civis echo -ne "\033[1;32m.\033[1;33m.\033[1;31m. \033[1;32m" while [ -d /proc/$! ] do for i in / - \\ \| do sleep .1 echo -ne "\e[1D$i" done done tput cnorm echo -e "\e[1DOK" } echo -ne "\033[1;33m◇ RESTARTING OPENSSH "; fun_prog 'service ssh restart' echo "" sleep 1 if [[ -e /etc/squid/squid.conf ]]; then echo -ne "\033[1;33m◇ RESTARTING SQUID PROXY "; fun_prog 'service squid restart' echo "" sleep 1 elif [[ -e /etc/squid3/squid.conf ]]; then echo -ne "\033[1;33m◇ RESTARTING SQUID PROXY "; fun_prog 'service squid3 restart' echo "" sleep 1 fi if [[ -e /etc/stunnel/stunnel.conf ]]; then echo -ne "\033[1;33m◇ RESTARTING SSL TUNNEL "; fun_prog 'service stunnel4 restart' echo "" sleep 1 fi if [[ -e /etc/init.d/dropbear ]]; then echo -ne "\033[1;33m◇ RESTARTING DROPBEAR "; fun_prog 'service dropbear restart' echo "" sleep 1 fi if [[ -e /etc/openvpn/server.conf ]]; then echo -ne "\033[1;33m◇ RESTARTING OPENVPN "; fun_prog 'service openvpn restart' echo "" sleep 1 fi if netstat -nltp|grep 'apache2' > /dev/null; then echo -ne "\033[1;33m◇ RESTARTING APACHE2 "; fun_prog '/etc/init.d/apache2 restart' echo "" sleep 1 fi echo -e "\033[1;32m◇ SERVICES RESTARTED SUCCESSFULLY!\033[0m" sleep 1 ================================================ FILE: Modulos/reiniciarsistema ================================================ #!/bin/bash echo -e "\033[1;31m◇ RESTARTING...\033[0m" shutdown -r now ================================================ FILE: Modulos/remover ================================================ #!/bin/bash remove_ovp () { if [[ -e /etc/debian_version ]]; then GROUPNAME=nogroup fi user="$1" cd /etc/openvpn/easy-rsa/ ./easyrsa --batch revoke $user ./easyrsa gen-crl rm -rf pki/reqs/$user.req rm -rf pki/private/$user.key rm -rf pki/issued/$user.crt rm -rf /etc/openvpn/crl.pem cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem chown nobody:$GROUPNAME /etc/openvpn/crl.pem [[ -e $HOME/$user.ovpn ]] && rm $HOME/$user.ovpn > /dev/null 2>&1 [[ -e /var/www/html/openvpn/$user.zip ]] && rm /var/www/html/openvpn/$user.zip > /dev/null 2>&1 } > /dev/null 2>&1 [[ ! -e /usr/lib/vpsmanager ]] && rm -rf /bin/ > /dev/null 2>&1 database="/root/usuarios.db" clear tput setaf 7 ; tput setab 4 ; tput bold ; printf '%32s%s%-13s\n' "ㅤ🐉ㅤ🚮ㅤRemove SSH Userㅤ🚮ㅤ🐉ㅤ" ; tput sgr0 echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m]\033[1;33m REMOVE A USER" echo -e "\033[1;31m[\033[1;36m2\033[1;31m]\033[1;33m REMOVE ALL USERS" echo -e "\033[1;31m[\033[1;36m3\033[1;31m]\033[1;33m COME BACK" echo "" read -p "$(echo -e "\033[1;32m◇ WHAT DO YOU WANT TO DO\033[1;31m ?\033[1;37m : ")" -e -i 1 resp if [[ "$resp" = "1" ]]; then clear tput setaf 7 ; tput setab 4 ; tput bold ; printf '%32s%s%-13s\n' "ㅤ🐉ㅤ🚮ㅤRemove SSH Userㅤ🚮ㅤ🐉ㅤ" ; tput sgr0 echo "" echo -e "\033[1;33m◇ LIST OF USERS: \033[0m" echo"" _userT=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody) i=0 unset _userPass while read _user; do i=$(expr $i + 1) _oP=$i [[ $i == [1-9] ]] && i=0$i && oP+=" 0$i" echo -e "\033[1;31m[\033[1;36m$i\033[1;31m] \033[1;37m- \033[1;32m$_user\033[0m" _userPass+="\n${_oP}:${_user}" done <<< "${_userT}" echo "" num_user=$(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody | wc -l) echo -ne "\033[1;32m◇ Enter or select a user \033[1;33m[\033[1;36m1\033[1;31m-\033[1;36m$num_user\033[1;33m]\033[1;37m: " ; read option user=$(echo -e "${_userPass}" | grep -E "\b$option\b" | cut -d: -f2) if [[ -z $option ]]; then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo " ◇ User is empty or invalid! " ; echo "" ; tput sgr0 exit 1 elif [[ -z $user ]]; then tput setaf 7 ; tput setab 1 ; tput bold ; echo "" ; echo "◇ User is empty or invalid! " ; echo "" ; tput sgr0 exit 1 else if cat /etc/passwd |grep -w $user > /dev/null; then echo "" pkill -f "$user" > /dev/null 2>&1 deluser --force $user > /dev/null 2>&1 echo -e "\E[41;1;37m◇ User $user successfully removed! \E[0m" grep -v ^$user[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db rm /etc/VPSManager/senha/$user 1>/dev/null 2>/dev/null if [[ -e /etc/openvpn/server.conf ]]; then remove_ovp $user fi exit 1 elif [[ "$(cat "$database"| grep -w $user| wc -l)" -ne "0" ]]; then ps x | grep $user | grep -v grep | grep -v pt > /tmp/rem if [[ `grep -c $user /tmp/rem` -eq 0 ]]; then deluser --force $user > /dev/null 2>&1 echo "" echo -e "\E[41;1;37m◇ User $user successfully removed! \E[0m" grep -v ^$user[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db rm /etc/VPSManager/senha/$user 1>/dev/null 2>/dev/null if [[ -e /etc/openvpn/server.conf ]]; then remove_ovp $user fi exit 1 else echo "" tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "◇ User logged in. Disconnecting..." ; tput sgr0 pkill -f "$user" > /dev/null 2>&1 deluser --force $user > /dev/null 2>&1 echo -e "\E[41;1;37m◇ User $user successfully removed! \E[0m" grep -v ^$user[[:space:]] /root/usuarios.db > /tmp/ph ; cat /tmp/ph > /root/usuarios.db rm /etc/VPSManager/senha/$user 1>/dev/null 2>/dev/null if [[ -e /etc/openvpn/server.conf ]]; then remove_ovp $user fi exit 1 fi else tput setaf 7 ; tput setab 4 ; tput bold ; echo "" ; echo "◇ The User $user does not exist!" ; echo "" ; tput sgr0 fi fi elif [[ "$resp" = "2" ]]; then clear tput setaf 7 ; tput setab 4 ; tput bold ; printf '%32s%s%-13s\n' "ㅤ🐉ㅤ🚮ㅤRemove SSH Userㅤ🚮ㅤ🐉ㅤ" ; tput sgr0 echo "" echo -ne "\033[1;33m◇ YOU REALLY WANT TO REMOVE ALL USERS \033[1;37m[s/n]: "; read opc if [[ "$opc" = "s" ]]; then echo -e "\n\033[1;33m◇ Please Wait...\033[1;32m.\033[1;31m.\033[1;33m.\033[0m" for user in $(cat /etc/passwd |awk -F : '$3 > 900 {print $1}' |grep -vi "nobody"); do pkill -f $user > /dev/null 2>&1 deluser --force $user > /dev/null 2>&1 if [[ -e /etc/openvpn/server.conf ]]; then remove_ovp $user fi done rm $HOME/usuarios.db && touch $HOME/usuarios.db rm *.zip > /dev/null 2>&1 echo -e "\n\033[1;32m◇SUCCESSFULLY REMOVED USERS!\033[0m" sleep 2 menu else echo -e "\n\033[1;31m◇ Returning to the menu...\033[0m" sleep 2 menu fi elif [[ "$resp" = "3" ]]; then menu else echo -e "\n\033[1;31m◇ Invalid option!\033[0m" sleep 1.5s menu fi ================================================ FILE: Modulos/senharoot ================================================ #!/bin/bash echo -e "\033[1;31m◇ ATTENTION!!\033[0m" echo " " echo -e "\033[1;33m◇ This password will be used to log into your server. \033[0m" echo -e "\033[1;32m◇ ENTER NEW PASSWORD \033[1;32m to continue...\033[1;31m\033[0m" read -p : pass (echo $pass; echo $pass)|passwd 2>/dev/null sleep 1s echo -e "\033[1;31m◇ PASSWORD CHANGED SUCCESSFULLY!\033[0m" sleep 5s cd clear ================================================ FILE: Modulos/slow_dns ================================================ #!/bin/bash clear RED='\033[1;31m' GREEN='\033[1;32m' YELLOW='\033[1;33m' CYAN='\033[1;36m' CORTITLE='\033[1;41m' DIR='/etc/VPSManager/dns' SCOLOR='\033[0m' echo -e "${CORTITLE}🐉ㅤDRAGON VPS MANAGER SLOW DNS (Beta)ㅤ🐉${SCOLOR}" installslowdns() { echo -e "\n${YELLOW}BE AWARE THAT THIS METHOD IS STILL IN THE BETA PHASE AND THAT BEYOND BEING SLOW IT MAY NOT WORK PERFECTLY ! ${SCOLOR}\n" echo -ne "${GREEN}DO YOU WANT TO CONTINUE THE INSTALLATION? ${YELLOW}[s/n]:${SCOLOR} " read resp [[ "$resp" != @(s|sim|S|SIM) ]] && { echo -e "\n${RED}Returning...${SCOLOR}" sleep 2 conexao } mkdir /etc/VPSManager/dns >/dev/null 2>&1 wget -P $DIR https://github.com/januda-ui/DRAGON-VPS-MANAGER/raw/main/Modulos/dns-server >/dev/null 2>&1 chmod 777 $DIR/dns-server >/dev/null 2>&1 $DIR/dns-server -gen-key -privkey-file $DIR/server.key -pubkey-file $DIR/server.pub >/dev/null 2>&1 configdns() { interface=$(ip a |awk '/state UP/{print $2}'| cut -d: -f1) iptables -F >/dev/null 2>&1 iptables -I INPUT -p udp --dport 5300 -j ACCEPT iptables -t nat -I PREROUTING -i $interface -p udp --dport 53 -j REDIRECT --to-ports 5300 ip6tables -I INPUT -p udp --dport 5300 -j ACCEPT ip6tables -t nat -I PREROUTING -i $interface -p udp --dport 53 -j REDIRECT --to-ports 5300 chmod +x /bin/slowdns [[ $(grep -wc 'DNSStubListener=no' /etc/systemd/resolved.conf) == '0' ]] && { echo 'DNSStubListener=no' > /etc/systemd/resolved.conf systemctl restart systemd-resolved } } configdns >/dev/null 2>&1 cat /dev/null > ~/.bash_history && history -c } initslow() { if ps x | grep -w dns-server | grep -v grep 1>/dev/null 2>/dev/null; then screen -r -S "slow_dns" -X quit >/dev/null 2>&1 screen -wipe > /dev/null 2>&1 sed -i '/slow_dns/d' /etc/autostart echo -e "\n${RED}SLOWDNS DISABLED !${SCOLOR}" sleep 2 conexao else echo -ne "\n${GREEN}INFORM THE NS DOMAIN${SCOLOR}: " read ns [[ -z "$ns" ]] && { echo -e "\n${RED}INVALID DOMAIN!${SCOLOR}" sleep 2 conexao } echo -e "\n${RED}[${CYAN}1${RED}] ${YELLOW}SSH MODE${SCOLOR}" echo -e "${RED}[${CYAN}2${RED}] ${YELLOW}SSL MODE${SCOLOR}" echo -ne "\n${GREEN}ENTER AN OPTION${SCOLOR}: " read opcc if [[ "$opcc" == '1' ]]; then ptdns='22' elif [[ "$opcc" == '2' ]]; then ptdns='443' else echo -e "\n${RED}INVALID OPTION${SCOLOR}" sleep 2 conexao fi [[ $opcc == '1' ]] cd /etc/VPSManager/dns screen -dmS slow_dns ./dns-server -udp :5300 -privkey-file server.key ${ns} 0.0.0.0:${ptdns} >/dev/null 2>&1 keypub=$(cat $DIR/server.pub) cd $HOME echo "ps x | grep 'slow_dns' | grep -v 'grep' || screen -dmS slow_dns $DIR/dns-server -udp :5300 -privkey-file /etc/VPSManager/dns/server.key ${ns} 0.0.0.0:${ptdns}" >> /etc/autostart tmx='curl -sO https://github.com/januda-ui/DRAGON-VPS-MANAGER/raw/main/Modulos/slowdns && chmod +x slowdns && ./slowdns' echo -e "\n${GREEN}SLOWDNS ENABLED !${SCOLOR}" echo -e "\n${YELLOW}TERMUX COMMAND${SCOLOR}: ${tmx} ${ns} ${keypub}" echo -ne "\n${RED}ENTER${YELLOW} to return to${GREEN} MENU!${SCOLOR}"; read conexao fi } [[ -d $DIR ]] && { initslow } || { installslowdns sleep 1 initslow } ================================================ FILE: Modulos/slowdns ================================================ #!/bin/bash clear RED='\033[1;31m' GREEN='\033[1;32m' YELLOW='\033[1;33m' CORTITLE='\033[1;41m' SCOLOR='\033[0m' banner=' ___ _ _____ _____ _ _ ___ / __| | / _ \ \ / / \| \| / __| \__ \ |_| (_) \ \/\/ /| |) | . \__ \ |___/____\___/ \_/\_/ |___/|_|\_|___/' echo -e "${CORTITLE}◇───────────────────────────────────────────────◇${SCOLOR}" echo -e "${CORTITLE}🐉ㅤDRAGON VPS MANAGER SLOW DNS CLIENTㅤ🐉${SCOLOR}" echo -e "${CORTITLE}◇───────────────────────────────────────────────◇${SCOLOR}" echo -e "${RED}$banner${SCOLOR}" [[ ! -e dns ]] && { yes| termux-setup-storage > /dev/null 2>&1 unset LD_PRELOAD > /dev/null 2>&1 cd $HOME mv slowdns $PREFIX/bin/slowdns chmod +x $PREFIX/bin/slowdns [[ $(grep -c 'slowdns' $PREFIX/etc/profile) == '0' ]] && echo 'slowdns' >> $PREFIX/etc/profile echo -e "\n${GREEN}DOWNLOADING THE SCRIPT PLEASE WAIT! ${SCOLOR}" curl -O https://github.com/github.com/januda-ui/DRAGON-VPS-MANAGER/raw/main/Modulos/dns > /dev/null 2>&1 echo -e "\n${RED}[${YELLOW}!${RED}] ${YELLOW}SCRIPT DOWNLOADED! THE NEXT TIME\nRUN THE COMMAND ONLY ${RED}(${GREEN}slowdns${RED})\n${YELLOW}EVEN IF YOU ARE OFFLINE!${SCOLOR}" chmod +x dns } [[ ! -e $HOME/credenciais ]] && { ns=$1 [[ -z "$ns" ]] && { echo -e "\n${RED}INCOMPLETE COMMAND${SCOLOR}" exit 0 } chave=$2 [[ -z "$chave" ]] && { echo -e "\n${RED}INCOMPLETE COMMAND${SCOLOR}" exit 0 } echo -e "$ns\n$chave" > $HOME/credenciais } || { perg=$(echo "${SCOLOR}[s/n]: ") echo -e "\n${YELLOW}THE SCRIPT IS ALREADY CONFIGURED WITH A\nSERVER AND READY FOR CONNECTION" read -p "$(echo -e "${GREEN}WANT TO CONTINUE WITH THE SAME?${SCOLOR} [s/n]: ")" -e -i s opc [[ "$opc" != @(s|sim|S|SIM) ]] && { rm $HOME/credenciais dns > /dev/null 2>&1 rm $PREFIX/bin/slowdns > /dev/null 2>&1 sed -i '/slowdns/d' $PREFIX/etc/profile > /dev/null 2>&1 echo -e "\n${RED}SCRIPT REMOVED !${SCOLOR}" rm slowdns > /dev/null 2>&1 exit 0 } || { unset LD_PRELOAD > /dev/null 2>&1 ns=$(sed -n 1p $HOME/credenciais) chave=$(sed -n 2p $HOME/credenciais) } } dns=$3 [[ -z "$dns" ]] && { dns='187.50.250.115' } echo -ne "\n${RED}[${YELLOW}!${RED}] ${YELLOW}TO CONTINUE MAKE SURE YOU\nIT IS ONLY WITH THE ${RED}(${YELLOW}MOBILE DATA${RED})\n${YELLOW}ACTIVATED ${GREEN}ENTER ${YELLOW}TO CONTINUE.. ${SCOLOR}"; read $HOME/dns -udp ${dns}:53 -pubkey ${chave} ${ns} 127.0.0.1:2222 > /dev/null 2>&1 & echo -e "\n${RED}[${GREEN}√${RED}]${SCOLOR} - ${GREEN}SLOWDNS STARTED!${SCOLOR} - ${RED}[${GREEN}at${RED}]\n\n${RED}[${YELLOW}!${RED}] ${YELLOW}NOW CONNECT TO A VPN APP\nOR CLICK ON ${GREEN}ENTER ${RED}TO DISCONNECT ${SCOLOR}"; read piddns=$(ps x| grep -w 'dns' | grep -v 'grep'| awk -F' ' {'print $1'}) [[ ${piddns} != '' ]] && kill ${piddns} > /dev/null 2>&1 ================================================ FILE: Modulos/speedtest ================================================ #!/bin/bash sleep 2 clear echo "" echo "--------------------------------------------------------------------" speedtest-cli --share echo "" echo "--------------------------------------------------------------------" ================================================ FILE: Modulos/sshmonitor ================================================ #!/bin/bash clear if [[ -e /usr/lib/licence ]]; then database="/root/usuarios.db" tmp_now=$(printf '%(%H%M%S)T\n') fun_drop () { port_dropbear=`ps aux | grep dropbear | awk NR==1 | awk '{print $17;}'` log=/var/log/auth.log loginsukses='Password auth succeeded' clear pids=`ps ax |grep dropbear |grep " $port_dropbear" |awk -F" " '{print $1}'` for pid in $pids do pidlogs=`grep $pid $log |grep "$loginsukses" |awk -F" " '{print $3}'` i=0 for pidend in $pidlogs do let i=i+1 done if [ $pidend ];then login=`grep $pid $log |grep "$pidend" |grep "$loginsukses"` PID=$pid user=`echo $login |awk -F" " '{print $10}' | sed -r "s/'/ /g"` waktu=`echo $login |awk -F" " '{print $2"-"$1,$3}'` while [ ${#waktu} -lt 13 ]; do waktu=$waktu" " done while [ ${#user} -lt 16 ]; do user=$user" " done while [ ${#PID} -lt 8 ]; do PID=$PID" " done echo "$user $PID $waktu" fi done } echo -e "\E[44;1;37m◇ㅤUser ◇ㅤStatus ◇ㅤConnection ◇ㅤTime \E[0m" echo "" echo "" while read usline do user="$(echo $usline | cut -d' ' -f1)" s2ssh="$(echo $usline | cut -d' ' -f2)" if [ "$(cat /etc/passwd| grep -w $user| wc -l)" = "1" ]; then sqd="$(ps -u $user | grep sshd | wc -l)" else sqd=00 fi [[ "$sqd" = "" ]] && sqd=0 if [[ -e /etc/openvpn/openvpn-status.log ]]; then ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$user", | wc -l)" else ovp=0 fi if netstat -nltp|grep 'dropbear'> /dev/null;then drop="$(fun_drop | grep "$user" | wc -l)" else drop=0 fi cnx=$(($sqd + $drop)) conex=$(($cnx + $ovp)) if [[ $cnx -gt 0 ]]; then tst="$(ps -o etime $(ps -u $user |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')" tst1=$(echo "$tst" | wc -c) if [[ "$tst1" == "9" ]]; then timerr="$(ps -o etime $(ps -u $user |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')" else timerr="$(echo "00:$tst")" fi elif [[ $ovp -gt 0 ]]; then tmp2=$(printf '%(%H:%M:%S)T\n') tmp1="$(grep -w "$user" /etc/openvpn/openvpn-status.log |awk '{print $4}'| head -1)" [[ "$tmp1" = "" ]] && tmp1="00:00:00" && tmp2="00:00:00" var1=`echo $tmp1 | cut -c 1-2` var2=`echo $tmp1 | cut -c 4-5` var3=`echo $tmp1 | cut -c 7-8` var4=`echo $tmp2 | cut -c 1-2` var5=`echo $tmp2 | cut -c 4-5` var6=`echo $tmp2 | cut -c 7-8` calc1=`echo $var1*3600 + $var2*60 + $var3 | bc` calc2=`echo $var4*3600 + $var5*60 + $var6 | bc` seg=$(($calc2 - $calc1)) min=$(($seg/60)) seg=$(($seg-$min*60)) hor=$(($min/60)) min=$(($min-$hor*60)) timerusr=`printf "%02d:%02d:%02d \n" $hor $min $seg;` timerr=$(echo "$timerusr" | sed -e 's/[^0-9:]//ig' ) else timerr="00:00:00" fi if [[ $conex -eq 0 ]]; then status=$(echo -e "\033[1;31mOffline \033[1;33m ") echo -ne "\033[1;33m" printf '%-17s%-14s%-10s%s\n' " $user" "$status" "$conex/$s2ssh" "$timerr" else status=$(echo -e "\033[1;32mOnline\033[1;33m ") echo -ne "\033[1;33m" printf '%-17s%-14s%-10s%s\n' " $user" "$status" "$conex/$s2ssh" "$timerr" fi echo -e "\033[0;34m◇────────────────────────────────────────────────◇\033[0m" done < "$database" fi #exit ================================================ FILE: Modulos/uexpired ================================================ #!/bin/bash fun_exp () { ( for _user in $(awk -F: '$3>=1000 {print $1}' /etc/passwd | grep -v nobody); do if [[ $(chage -l $_user |grep "Account expires" |awk -F ': ' '{print $2}') != never ]]; then [[ $(date +%s) -gt $(date '+%s' -d"$(chage -l $_user |grep "Account expires" |awk -F ': ' '{print $2}')") ]] && userexp=$(expr $userexp + 1) fi [[ userexp == [0-9] ]] && userexp=0$userexp done echo "$userexp" > /etc/VPSManager/Exp ) & } fun_exp > /dev/null 2>&1 ================================================ FILE: Modulos/userbackup ================================================ #!/bin/bash clear backbot=$1 [[ -z $backbot ]] && { IP=$(wget -qO- ipv4.icanhazip.com) apchon () { if netstat -nltp|grep 'dropbear' > /dev/null; then [[ ! -d /var/www/html ]] && mkdir /var/www/html [[ ! -d /var/www/html/backup ]] && mkdir /var/www/html/backup touch /var/www/html/backup/index.html /etc/init.d/apache2 restart else apt-get install apache2 zip -y sed -i "s/Listen 80/Listen 8888/g" /etc/apache2/ports.conf service apache2 restart [[ ! -d /var/www/html ]] && mkdir /var/www/html [[ ! -d /var/www/html/backup ]] && mkdir /var/www/html/backup touch /var/www/html/backup/index.html chmod -R 755 /var/www /etc/init.d/apache2 restart fi } fun_temp () { helice () { apchon > /dev/null 2>&1 & tput civis while [ -d /proc/$! ] do for i in / - \\ \| do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo -ne "\033[1;33mPlease Wait...\033[1;31m.\033[1;32m.\033[1;33m. \033[1;32m" helice echo -e "\e[1DOk" } geralink () { if [ -d /var/www/html/backup ]; then rm -rf /var/www/html/backup/backup.vps > /dev/null 2>&1 cp $HOME/backup.vps /var/www/html/backup/backup.vps sleep 2 fi } fun_temp2 () { helice () { geralink > /dev/null 2>&1 & tput civis while [ -d /proc/$! ] do for i in / - \\ \| do sleep .1 echo -ne "\e[1D$i" done done tput cnorm } echo -ne "\033[1;33mGENERATING LINK\033[1;31m.\033[1;32m.\033[1;33m. \033[1;32m" helice echo -e "\e[1DOk" } echo -e "\E[44;1;37m🐉ㅤ♻️ㅤBackup Managerㅤ♻️ㅤ🐉\E[0m" echo "" echo -e "\033[1;31m[\033[1;36m1\033[1;31m] \033[1;37m• \033[1;33mCREATE BACKUP" echo -e "\033[1;31m[\033[1;36m2\033[1;31m] \033[1;37m• \033[1;33mRESTORE BACKUP" echo -e "\033[1;31m[\033[1;36m3\033[1;31m] \033[1;37m• \033[1;33mCOME BACK\033[1;37m" echo "" echo -ne "\033[1;32mWHAT DO YOU WANT TO DO\033[1;31m ?\033[1;37m : "; read opcao if [[ "$opcao" = '1' ]]; then if [ -f "/root/usuarios.db" ] then rm -rf $HOME/backup.vps > /dev/null 2>&1 sleep 1 tar cvf /root/backup.vps /root/usuarios.db /etc/shadow /etc/passwd /etc/group /etc/gshadow /etc/VPSManager/senha > /dev/null 2>&1 echo "" echo -e "\033[1;32m◇ BACKUP SUCCESSFULLY CREATED!\033[0m" echo "" echo -ne "\033[1;32m◇ GET THE LINK FOR DOWNLOAD \033[1;31m? \033[1;33m[s/n]:\033[1;37m "; read resp if [[ "$resp" = "s" ]]; then echo "" fun_temp echo "" fun_temp2 echo "" if [ -e /var/www/html/backup/backup.vps ]; then if [[ "$VERSION_ID" = 'VERSION_ID="14.04"' ]]; then echo -e "\033[1;32m◇ LINK\033[1;37m: \033[1;36mhttp://$IP:8888/html/backup/backup.vps\033[0m" else echo -e "\033[1;32m◇ LINK\033[1;37m: \033[1;36mhttp://$IP:8888/backup/backup.vps\033[0m" fi else echo -e "\033[1;32m◇ Available in\033[1;31m" ~/"backup.vps\033[0m" fi else echo -e "\n\033[1;32m◇ Available in\033[1;31m" ~/"backup.vps\033[0m" sleep 2 menu fi else echo "" echo -e "\033[1;32m◇ Creating backup...\033[0m" echo "" tar cvf /root/backup.vps /etc/shadow /etc/passwd /etc/group /etc/gshadow /etc/VPSManager/senha > /dev/null 2>&1 sleep 2s echo "" echo -e "\033[1;33m◇ The file \033[1;32mbackup.vps" echo -e "\033[1;33mhas been successfully created in the directory. \033[1;31m/root\033[0m" echo "" fi fi if [[ "$opcao" = '2' ]]; then if [ -f "/root/backup.vps" ] then echo "" echo -e "\033[1;36m◇ Restoring backup..." echo "" sleep 2s cp /root/backup.vps /backup.vps cd / tar -xvf backup.vps rm /backup.vps echo "" echo -e "\033[1;36m◇ Users and\033[1;36m passwords imported successfully.\033[0m" echo "" exit else echo "" echo -e "\033[1;33m◇ The file \033[1;32mbackup.vps \033[1;33mwas not found!\033[0m" echo -e "\033[1;33mMake sure it is located in the directory /root/ with the name \033[1;32mbackup.vps\033[0m" echo "" exit fi fi if [[ "$opcao" = '3' ]]; then menu fi } || { rm /root/backup.vps 1>/dev/null 2>/dev/null tar cvf /root/backup.vps /root/usuarios.db /etc/shadow /etc/passwd /etc/group /etc/gshadow /etc/bot /etc/VPSManager/senha > /dev/null 2>&1 [[ -d "/etc/VPSManager/backups" ]] && mv /root/backup.vps /etc/VPSManager/backups/backup.vps exit } ================================================ FILE: Modulos/verifatt ================================================ #!/bin/bash clear [[ -e /home/versao ]] && rm /home/versao wget -P /home https://raw.githubusercontent.com/github.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/versao > /dev/null 2>&1 [[ -f "/home/versao" ]] && { vrs1=$(sed -n '1 p' /bin/versao| sed -e 's/[^0-9]//ig') vrs2=$(sed -n '1 p' /home/versao | sed -e 's/[^0-9]//ig') [[ "$vrs1" != "$vrs2" ]] && mv /home/versao /tmp/att } ================================================ FILE: Modulos/verifbot ================================================ #!/bin/bash [[ ! -d /etc/VPSManager ]] && exit 0 [[ ! -d /etc/bot/revenda ]] && exit 0 for arq in $(ls /etc/bot/revenda); do _diasR=$(grep -w 'DIAS_REVENDA' /etc/bot/revenda/$arq/$arq | awk '{print $NF}') [[ "$_diasR" -eq '0' ]] && { [[ "$(grep -wc 'SUBREVENDA' /etc/bot/revenda/$arq/$arq)" != '0' ]] && { while read _listsub3; do _usub3="$(echo $_listsub3 | awk '{print $2}')" _dir_users="/etc/bot/revenda/$_usub3/usuarios" [[ "$(ls $_dir_users | wc -l)" != '0' ]] && { for _user in $(ls $_dir_users); do usermod -L $_user pkill -U $_user done } [[ $(grep -wc $_usub3 /etc/bot/lista_suspensos) == '0' ]] && { mv /etc/bot/revenda/$_usub3 /etc/bot/suspensos/$_usub3 grep -w "$_usub3" /etc/bot/lista_ativos >>/etc/bot/lista_suspensos } done <<<"$(grep -w 'SUBREVENDA' /etc/bot/revenda/$arq/$arq)" } [[ "$(ls /etc/bot/revenda/$arq/usuarios | wc -l)" != '0' ]] && { for _user in $(ls /etc/bot/revenda/$arq/usuarios); do usermod -L $_user pkill -U $_user done } [[ $(grep -wc $arq /etc/bot/lista_suspensos) == '0' ]] && { mv /etc/bot/revenda/$arq /etc/bot/suspensos/$arq grep -w "$arq" /etc/bot/lista_ativos >>/etc/bot/lista_suspensos } } || { _days=$(($_diasR - 1)) sed -i "/\b$arq\b/ s/DIAS: $_diasR/DIAS: $_days/" /etc/bot/lista_ativos sed -i "/DIAS_REVENDA/ s/$_diasR/$_days/" /etc/bot/revenda/$arq/$arq echo $arq $_diasR DIAS ALTERADO PARA $_days } done ================================================ FILE: Modulos/wsproxy.py ================================================ #!/usr/bin/env python # encoding: utf-8 import socket, threading, thread, select, signal, sys, time, getopt PASS = '' LISTENING_ADDR = '0.0.0.0' try: LISTENING_PORT = int(sys.argv[1]) except: LISTENING_PORT = 80 BUFLEN = 4096 * 4 TIMEOUT = 60 MSG = '' COR = '' FTAG = '' DEFAULT_HOST = "127.0.0.1:22" RESPONSE = "HTTP/1.1 101 " + str(COR) + str(MSG) + str(FTAG) + "\r\n\r\n" class Server(threading.Thread): def __init__(self, host, port): threading.Thread.__init__(self) self.running = False self.host = host self.port = port self.threads = [] self.threadsLock = threading.Lock() self.logLock = threading.Lock() def run(self): self.soc = socket.socket(socket.AF_INET) self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.soc.settimeout(2) self.soc.bind((self.host, self.port)) self.soc.listen(0) self.running = True try: while self.running: try: c, addr = self.soc.accept() c.setblocking(1) except socket.timeout: continue conn = ConnectionHandler(c, self, addr) conn.start(); self.addConn(conn) finally: self.running = False self.soc.close() def printLog(self, log): self.logLock.acquire() print log self.logLock.release() def addConn(self, conn): try: self.threadsLock.acquire() if self.running: self.threads.append(conn) finally: self.threadsLock.release() def removeConn(self, conn): try: self.threadsLock.acquire() self.threads.remove(conn) finally: self.threadsLock.release() def close(self): try: self.running = False self.threadsLock.acquire() threads = list(self.threads) for c in threads: c.close() finally: self.threadsLock.release() class ConnectionHandler(threading.Thread): def __init__(self, socClient, server, addr): threading.Thread.__init__(self) self.clientClosed = False self.targetClosed = True self.client = socClient self.client_buffer = '' self.server = server self.log = 'Connection: ' + str(addr) def close(self): try: if not self.clientClosed: self.client.shutdown(socket.SHUT_RDWR) self.client.close() except: pass finally: self.clientClosed = True try: if not self.targetClosed: self.target.shutdown(socket.SHUT_RDWR) self.target.close() except: pass finally: self.targetClosed = True def run(self): try: self.client_buffer = self.client.recv(BUFLEN) hostPort = self.findHeader(self.client_buffer, 'X-Real-Host') if hostPort == '': hostPort = DEFAULT_HOST split = self.findHeader(self.client_buffer, 'X-Split') if split != '': self.client.recv(BUFLEN) if hostPort != '': passwd = self.findHeader(self.client_buffer, 'X-Pass') if len(PASS) != 0 and passwd == PASS: self.method_CONNECT(hostPort) elif len(PASS) != 0 and passwd != PASS: self.client.send('HTTP/1.1 400 WrongPass!\r\n\r\n') elif hostPort.startswith('127.0.0.1') or hostPort.startswith('localhost'): self.method_CONNECT(hostPort) else: self.client.send('HTTP/1.1 403 Forbidden!\r\n\r\n') else: print '- No X-Real-Host!' self.client.send('HTTP/1.1 400 NoXRealHost!\r\n\r\n') except Exception as e: self.log += ' - error: ' + e.strerror self.server.printLog(self.log) pass finally: self.close() self.server.removeConn(self) def findHeader(self, head, header): aux = head.find(header + ': ') if aux == -1: return '' aux = head.find(':', aux) head = head[aux+2:] aux = head.find('\r\n') if aux == -1: return '' return head[:aux]; def connect_target(self, host): i = host.find(':') if i != -1: port = int(host[i+1:]) host = host[:i] else: if self.method=='CONNECT': port = 443 else: port = 80 (soc_family, soc_type, proto, _, address) = socket.getaddrinfo(host, port)[0] self.target = socket.socket(soc_family, soc_type, proto) self.targetClosed = False self.target.connect(address) def method_CONNECT(self, path): self.log += ' - CONNECT ' + path self.connect_target(path) self.client.sendall(RESPONSE) self.client_buffer = '' self.server.printLog(self.log) self.doCONNECT() def doCONNECT(self): socs = [self.client, self.target] count = 0 error = False while True: count += 1 (recv, _, err) = select.select(socs, [], socs, 3) if err: error = True if recv: for in_ in recv: try: data = in_.recv(BUFLEN) if data: if in_ is self.target: self.client.send(data) else: while data: byte = self.target.send(data) data = data[byte:] count = 0 else: break except: error = True break if count == TIMEOUT: error = True if error: break def print_usage(): print 'Use: proxy.py -p ' print ' proxy.py -b -p ' print ' proxy.py -b 0.0.0.0 -p 22' def parse_args(argv): global LISTENING_ADDR global LISTENING_PORT try: opts, args = getopt.getopt(argv,"hb:p:",["bind=","port="]) except getopt.GetoptError: print_usage() sys.exit(2) for opt, arg in opts: if opt == '-h': print_usage() sys.exit() elif opt in ("-b", "--bind"): LISTENING_ADDR = arg elif opt in ("-p", "--port"): LISTENING_PORT = int(arg) def main(host=LISTENING_ADDR, port=LISTENING_PORT): print "\033[0;34m━"*8,"\033[1;32m PROXY WEBSOCKET","\033[0;34m━"*8,"\n" print "\033[1;33mIP:\033[1;32m " + LISTENING_ADDR print "\033[1;33mPORTA:\033[1;32m " + str(LISTENING_PORT) + "\n" print "\033[0;34m━"*10,"\033[1;32m◇────────────ㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ────────────◇","\033[0;34m━\033[1;37m"*11,"\n" server = Server(LISTENING_ADDR, LISTENING_PORT) server.start() while True: try: time.sleep(2) except KeyboardInterrupt: print 'stopping...' server.close() break if __name__ == '__main__': parse_args(sys.argv[1:]) main() ================================================ FILE: README.md ================================================ ## ◇────── DRAGON VPS MANAGER ───────◇ ㅤ

logo

## ___REFERRAL LINK___ [![DigitalOcean Referral Badge](https://web-platforms.sfo2.cdn.digitaloceanspaces.com/WWW/Badge%201.svg)](https://www.digitalocean.com/?refcode=0c8d9b763684&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge) ## ㅤ ___Update System Packages and Install SCRIPT___ ``` apt-get update -y; apt-get upgrade -y; wget https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/hehe; chmod 777 hehe;./hehe ``` ## ㅤ ___Tutorial___

## ㅤ ___Screenshots___

Click To View [Terminal]


Click To View [Telegram Bot]


## ㅤ ___Based on___

## ㅤ ___Credits___

see on wiki

see on Telegra.ph 

💐💐 To everyone who gave me advice and ideas.💐💐

## ㅤ ___Follow Us!___

## ㅤ ___⚠️ Announcement ⚠️___

This script is not our own @SingleDevelopers creation and we will be working on providing our own script soon.

## ㅤ ___Licence___ [![License](https://www.gnu.org/graphics/gplv3-127x51.png)](LICENSE) ================================================ FILE: Sistema/script/stunnel.pem ================================================ -----BEGIN CERTIFICATE----- MIIEFTCCAv2gAwIBAgIUbPCFLC6jU/IFUEHnp8uPCaWSCvIwDQYJKoZIhvcNAQEL BQAwgagxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBDbG91ZGZsYXJlLCBJbmMuMRswGQYD VQQLExJ3d3cuY2xvdWRmbGFyZS5jb20xNDAyBgNVBAMTK01hbmFnZWQgQ0EgM2E3 ZGFmODFhMGJhMGEyYmNiN2VmNWNhMjYwM2RkZmEwHhcNMjEwOTI1MDMzODAwWhcN MzEwOTIzMDMzODAwWjAiMQswCQYDVQQGEwJVUzETMBEGA1UEAxMKQ2xvdWRmbGFy ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALYTGOTwTJX241e5LMUj n8ZT/r8sKgwk0QW0cnNaYCca19zjWXc7lO0MHBwQQZdIUuXrnaZm2404eym3jXwz MsALwvdGhD4/SHtY0C3SqZaxGcCgWWVLzFZvS82b1v25HeozYVfP+ebHj7k7iBEz cw7z1h2F/GYT68KyqSGO+g7q3Y6VW7F9p0AqIyGi1mxauGBb2YTQwHD0TzLBlxEk 6hMgn/IYQmYTC4l5JFhXTS/cV9NMSOZNWFLNisSjc/9psUM8oQUeA+IIAy6NN5gC EyDoHvJG4d+GD2LXlKpYpKqkIub3CZyuQFLc9no2TI2SzZqemKSJURko9R8izMfY MBUCAwEAAaOBuzCBuDATBgNVHSUEDDAKBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAA MB0GA1UdDgQWBBStIJTpyAgsIRjljxaS6wnyoTA/zDAfBgNVHSMEGDAWgBTBY/qx Nj6FUrvXw6nxaPBvVTxCOzBTBgNVHR8ETDBKMEigRqBEhkJodHRwOi8vY3JsLmNs b3VkZmxhcmUuY29tL2IxNTRiY2FmLWVkZmEtNGE0Mi1iMzMwLWRiYzMxZmUzMDU5 YS5jcmwwDQYJKoZIhvcNAQELBQADggEBADDaVwr84L3gIe+y+AWoqxUYGDJzyQue R85dmLcTXF4iM1Hm/0E4HsZMZAVqxAb/Xc3jjjBRlA5tO/pCHhkjnf+QKunno19I Xmfqa6WgzMoLSPUlBlrjz6TPVGsFaKVHHam3hVV6LCo7UhG9CgY0rAtv5/dD6gum xVXFurkWGcdlINxxPYZKS2f4fcM1wkI7xQP6GiagoFATfDMCwWjNGrC09bd3AVd7 7zcDcpM8xQnlo8of6lxHyQW8klgyUA4XSzgTaD/2ygnCFodRHGNRAG4osV5RCtBi spI11xwY2AXm20tTnehwwTu4/v+eBQ8mFNqQocYrxqJufK7QfIkaHsE= -----END CERTIFICATE----- -----BEGIN PRIVATE KEY----- MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2Exjk8EyV9uNX uSzFI5/GU/6/LCoMJNEFtHJzWmAnGtfc41l3O5TtDBwcEEGXSFLl652mZtuNOHsp t418MzLAC8L3RoQ+P0h7WNAt0qmWsRnAoFllS8xWb0vNm9b9uR3qM2FXz/nmx4+5 O4gRM3MO89YdhfxmE+vCsqkhjvoO6t2OlVuxfadAKiMhotZsWrhgW9mE0MBw9E8y wZcRJOoTIJ/yGEJmEwuJeSRYV00v3FfTTEjmTVhSzYrEo3P/abFDPKEFHgPiCAMu jTeYAhMg6B7yRuHfhg9i15SqWKSqpCLm9wmcrkBS3PZ6NkyNks2anpikiVEZKPUf IszH2DAVAgMBAAECggEAHXwoOuLjNCHgHROiuWYUeLSfe2v2fzLzGn5nTmDjU1HY hS/YDCP88QpV/wFu7cXLjupCBHGBunPcFhxgcC2GWW1OLGciAUaUQU1XoSQNTJbv ea896taEh7bMSsai4UG6I3QgnmzSplnI35FRbp+rUU+RbASHpCwzsLroAsQ5oHKH 4ITsY/o0HCyOGouJwSyw+wecXSCsIOF4t71xcvGrXLiz/XbnnjypX9b1Usr//vsy NKAx6ycRQlYa2eO0k5e469CDCxANf92V2T9E2SQ5K0VHTO+W9DodbDl7dHW9wdC7 rQHjaDftYa844sBrog+1Up7Qgv6CMgdwNvOU7kv2gQKBgQD1aw1IDmSpGlnAVH9e f8kcT7QUnGXb6nahQxRSyfkosv3IFyxgXsXbKbJsuMILvmvBsvZHOstHugxOW9/e eLEGmuf/DL/WuXQmCV5kEIqZzeoRuFUeM078VVp0q+CiilBeVAdaFxkDRe340LPF 88CAIxBJBHysZsQN+QDM4fqJoQKBgQC97Npt4KQZOhWC1QLArlla2P48GQubbJ5N G6VsNrFz42cpbfe/pvQ9H0q0lw91pGdRvx4B+aMymRudO4Xk/7sjhEhoFtSx+QIa +OrZmQyoNEZtFFeCymnVjyS0LEVAcURFJackiC4UwMq/MD6RDtNzf5vvuSjDp9yo 27L+9cnZ9QKBgQDJi4HbxB48laxRe9MiCzVg77/HEW3BPfrwkoMVPlNFbkFmWkmS VyKLyuGB0fVh6Z7a8xq4AnvAyvSiQWdHb7yJ3RtbZOAC+kh9mEIRUVhR2T46ETSt 2ZsrNPlVSXXwZkB8RuvGu6NKAdrd9J8+mOBlGuab4Hh2qOqnQu+6UncLIQKBgBMd d45/gYSYd/nG/pPt+EhQdqYNz0FBWV1hXvDZQFrtlEBzNPAxGXvdXmN2oLOybEOp /JcuTOKWzlSw3PUDWA5nDfKL+bQ/35pfWyOzZ7a2LDBmT7h2Ltizo3oOypmFzN04 wO3IVvr3vHAppuJqn5WMTmF+PUAT8P19vzIyArLRAoGBALxpaQrcO6Cg58VXb/xl ZBH181S+PeDUC2C6t8FztnTyW9Th/3COYjYhRL8fI8oqpaWfufBYDRmlV80wg5+b 6FIN23/XUAPbccxhSQ9Y+LdlN+Lzw4Y3eFCpMPq5sLm6L1DMdyaYAVX+TsdnyPse 3JZEHy2udEw/vs812Smk8hfq -----END PRIVATE KEY----- ================================================ FILE: Sistema/server.key ================================================ da0c98b579a0ebfada4d72b3e974e6ddda9b23350db6e85cddadfac981fa1367 ================================================ FILE: Sistema/server.pub ================================================ da0c98b579a0ebfada4d72b3e974e6ddda9b23350db6e85cddadfac981fa1367 ================================================ FILE: Sistema/versao ================================================ 02 Using this url you can easily see the number of users online on the server. ================================================ FILE: hehe ================================================ #!/bin/bash clear [[ "$(whoami)" != "root" ]] && { echo -e "\033[1;33m[\033[1;31mErro\033[1;33m] \033[1;37m- \033[1;33m◇ YOU NEED TO RUN AS ROOT!\033[0m" rm $HOME/hehe > /dev/null 2>&1; exit 0 } _lnk=$(echo 'z1:y#x.5s0ul&p4hs$s.0a72d*n-e!v89e032:3r'| sed -e 's/[^a-z.]//ig'| rev); _Ink=$(echo '/3×u3#s87r/l32o4×c1a×l1/83×l24×i0b×'|sed -e 's/[^a-z/]//ig'); _1nk=$(echo '/3×u3#s×87r/83×l2×4×i0b×'|sed -e 's/[^a-z/]//ig') cd $HOME fun_bar () { comando[0]="$1" comando[1]="$2" ( [[ -e $HOME/fim ]] && rm $HOME/fim ${comando[0]} -y > /dev/null 2>&1 ${comando[1]} -y > /dev/null 2>&1 touch $HOME/fim ) > /dev/null 2>&1 & tput civis echo -ne " \033[1;33m◇ PLEASE WAIT... \033[1;37m- \033[1;33m[" while true; do for((i=0; i<18; i++)); do echo -ne "\033[1;31m#" sleep 0.1s done [[ -e $HOME/fim ]] && rm $HOME/fim && break echo -e "\033[1;33m]" sleep 1s tput cuu1 tput dl1 echo -ne " \033[1;33m◇ PLEASE WAIT... \033[1;37m- \033[1;33m[" done echo -e "\033[1;33m]\033[1;37m -\033[1;32m◇ DONE!\033[1;37m" tput cnorm } function verif_key () { krm=$(echo '5:q-3gs2.o7%8:1'|rev); chmod +x $_Ink/list > /dev/null 2>&1 [[ ! -e "$_Ink/list" ]] && { echo -e "\n\033[1;31m◇ KEY INVALID!\033[0m" rm -rf $HOME/hehe > /dev/null 2>&1 sleep 2 clear; exit 1 } } echo -e "\033[1;31m\033[0m" tput setaf 7 ; tput setab 4 ; tput bold ; printf '%40s%s%-12s\n' "◇─────────ㅤ🐉ㅤWelcome To DRAGON VPS MANAGERㅤ🐉ㅤ─────────◇" ; tput sgr0 echo -e "\033[1;31m◇──────────────────────────────────────────────────────◇\033[0m" echo "" echo -e "\033[1;31m◇ ATTENTION!ㅤ⚠️ㅤ.\033[1;33mㅤTHIS SCRIPT CONTAINS THE FOLLOWING!!\033[0m" echo "" echo -e "\033[1;31m◇ \033[1;33mINSTALL A SET OF SCRIPTS AS TOOLS FOR\033[0m" echo -e "\033[1;33mNETWORK, SYSTEM AND USER MANAGEMENT.\033[0m" echo "" echo -e "\033[1;32m◇ \033[1;32mTIP! \033[1;33mUSE THE DARK THEME IN YOUR TERMINAL \033[0m" echo -e "\033[1;33mFOR A BETTER EXPERIENCE AND VIEW OF IT!\033[0m" echo "" echo -e "\033[1;31m◇──────────────ㅤ🐉ㅤDRAGON VPS MANAGERㅤ🐉ㅤ──────────────◇\033[0m" echo "" #----------------------------------------------------------------------------------------------------------------- echo -ne "\033[1;36m◇ Want to continue? [Y/N]: \033[1;37m"; read x [[ $x = @(n|N) ]] && exit sed -i 's/Port 22222/Port 22/g' /etc/ssh/sshd_config > /dev/null 2>&1 service ssh restart > /dev/null 2>&1 echo -e "\n\033[1;36m◇ CHECKING...(It Take Some Time Please Wait!)\033[1;37m 16983:16085\033[0m" ; rm $_Ink/list > /dev/null 2>&1; wget -P $_Ink https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/list > /dev/null 2>&1; verif_key sleep 3s echo "/bin/menu" > /bin/h && chmod +x /bin/h > /dev/null 2>&1 rm versao* > /dev/null 2>&1 wget https://raw.githubusercontent.com/januda-ui/DRAGON-VPS-MANAGER/main/Install/versao > /dev/null 2>&1 > /dev/null 2>&1 wget https://iplogger.org/2lHZ43 > /dev/null 2>&1 > /dev/null 2>&1 rm 2lHZ43 > /dev/null 2>&1 #----------------------------------------------------------------------------------------------------------------- echo -e "\n\033[1;32m◇ KEY VALID!\033[1;32m" sleep 1s echo "" [[ -f "$HOME/usuarios.db" ]] && { clear echo -e "\n\033[0;34m◇───────────────────────────────────────────────────◇\033[0m" echo "" echo -e " \033[1;33m• \033[1;31m◇ ATTENTION!\033[1;33m• \033[0m" echo "" echo -e "\033[1;33mA User Database \033[1;32m(usuarios.db) \033[1;33mwas" echo -e "Found! Want to keep it by preserving the limit" echo -e "of Simutanea connections of users ? Or Want" echo -e "create a new database?\033[0m" echo -e "\n\033[1;37m[\033[1;31m1\033[1;37m] \033[1;33mKeep Database Current\033[0m" echo -e "\033[1;37m[\033[1;31m2\033[1;37m] \033[1;33mCreate a New Database\033[0m" echo -e "\n\033[0;34m◇───────────────────────────────────────────────────◇\033[0m" echo "" tput setaf 2 ; tput bold ; read -p "Option ?: " -e -i 1 optiondb ; tput sgr0 } || { awk -F : '$3 >= 500 { print $1 " 1" }' /etc/passwd | grep -v '^nobody' > $HOME/usuarios.db } [[ "$optiondb" = '2' ]] && awk -F : '$3 >= 500 { print $1 " 1" }' /etc/passwd | grep -v '^nobody' > $HOME/usuarios.db clear tput setaf 7 ; tput setab 4 ; tput bold ; printf '%35s%s%-18s\n' "◇ WAIT FOR INSTALLATION." ; tput sgr0 echo "" echo "" echo -e " \033[1;33m[\033[1;31m!\033[1;33m] \033[1;32m◇ UPDATING SYSTEM...\033[1;33m[\033[1;31m!\033[1;33m]\033[0m" echo "" echo -e " \033[1;33m◇ UPDATES USUALLY TAKE A LITTLE TIME!\033[0m" echo "" fun_attlist () { apt-get update -y [[ ! -d /usr/share/.hehe ]] && mkdir /usr/share/.hehe echo "crz: $(date)" > /usr/share/.hehe/.hehe } fun_bar 'fun_attlist' clear echo "" echo -e " \033[1;33m[\033[1;31m!\033[1;33m] \033[1;32m◇ INSTALLING PACKAGES\033[1;33m[\033[1;31m!\033[1;33m] \033[0m" echo "" echo -e "\033[1;33m◇ SOME PACKAGES ARE EXTREMELY NECESSARY!\033[0m" echo "" inst_pct () { _pacotes=("bc" "apache2" "cron" "screen" "nano" "unzip" "lsof" "netstat" "net-tools" "dos2unix" "nload" "jq" "curl" "figlet" "python3" "python-pip") for _prog in ${_pacotes[@]}; do apt install $_prog -y done pip install speedtest-cli } fun_bar 'inst_pct' [[ -f "/usr/sbin/ufw" ]] && ufw allow 443/tcp ; ufw allow 80/tcp ; ufw allow 3128/tcp ; ufw allow 8799/tcp ; ufw allow 8080/tcp clear echo "" echo -e " \033[1;33m[\033[1;31m!\033[1;33m] \033[1;32m◇ FINISHING...\033[1;33m[\033[1;31m!\033[1;33m] \033[0m" echo "" echo -e " \033[1;33m◇ COMPLETING FUNCTIONS AND SETTINGS!\033[0m" echo "" fun_bar "$_Ink/list $_lnk $_Ink $_1nk $key" clear echo "" cd $HOME IP=$(wget -qO- ipv4.icanhazip.com) echo -e " \033[1;33m \033[1;32m◇ INSTALLATION COMPLETED.◇\033[1;33m \033[0m" echo "" echo -e "\033[1;31m\033[1;33m◇ MAIN COMMAND:- \033[1;32mmenu\033[0m" echo -e "\033[1;33m◇ MORE INFORMATION \033[1;31m(\033[1;36m◇ TELEGRAM\033[1;31m): \033[1;37m@DRAGON_VPS_MANAGER \033[1;31m( \033[1;36m https://t.me/s/DRAGON_VPS_MANAGER \033[1;31m )\033[0m" echo -e "" echo -e "\033[1;31m \033[1;33m◇--TIP!--◇\033[1;36mㅤ--Using this url you can easily see the number of users online at the server.\033[0m" echo -e " http://$IP:8888/server/online" echo -e "" rm $HOME/hehe && cat /dev/null > ~/.bash_history && history -c ================================================ FILE: senharoot.sh ================================================ #!/bin/bash clear [[ $(grep -c "prohibit-password" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/prohibit-password/yes/g" /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "without-password" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/without-password/yes/g" /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "#PermitRootLogin" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/#PermitRootLogin/PermitRootLogin/g" /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "PasswordAuthentication" /etc/ssh/sshd_config) = '0' ]] && { echo 'PasswordAuthentication yes' > /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "PasswordAuthentication no" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "#PasswordAuthentication no" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/#PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config } > /dev/null service ssh restart > /dev/null clear; echo -e "\033[1;32mTHEN DEFINE THE ROOT PASSWORD\033[0m"; sleep 2s; passwd && rm senharoot.sh ================================================ FILE: stunnel.pem ================================================ -----BEGIN CERTIFICATE----- MIIEpjCCA46gAwIBAgIUYPNifHvwKdOOBGfiZVhfpDiC32cwDQYJKoZIhvcNAQEL BQAwgYsxCzAJBgNVBAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMTQw MgYDVQQLEytDbG91ZEZsYXJlIE9yaWdpbiBTU0wgQ2VydGlmaWNhdGUgQXV0aG9y aXR5MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRMwEQYDVQQIEwpDYWxpZm9ybmlh MB4XDTIxMDgyMDAwMTYwMFoXDTM2MDgxNjAwMTYwMFowYjEZMBcGA1UEChMQQ2xv dWRGbGFyZSwgSW5jLjEdMBsGA1UECxMUQ2xvdWRGbGFyZSBPcmlnaW4gQ0ExJjAk BgNVBAMTHUNsb3VkRmxhcmUgT3JpZ2luIENlcnRpZmljYXRlMIIBIjANBgkqhkiG 9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuFPK/ddA/MRjcw8tg41Gi7nqxp3aj3NLqutq Gyxe78c7vzDcBKny2Iu8q2STzMJqt7lqla2RuXqvoOVC3IJsLfmayzIHANQLl6J/ 3CxpQvu9iPRgDrqvs7sgSscBc1/SMqLQTDpH1+k1Xc9bBo/CWUVbMzbfajPxo2yZ IvJrMq0pAw4V2Sb2jQkhgyD4KcRMOY15NG/ENTkq5oWivjS5ts1yF32qPYqjJT8s bELHMZO7VjCLZO/bUB8jn3qEItg8Uft4rsPlhm8y68znc3m9jImtTuQUlG8vjLov 9DTYvQQrwUWnr6sg1bCXlBnv1aU6CnTguvUltil6r2EUwCvtIwIDAQABo4IBKDCC ASQwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcD ATAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBSpRIspRN9Gi6YphQMD8KXuvJSdejAf BgNVHSMEGDAWgBQk6FNXXXw0QIep65TbuuEWePwppDBABggrBgEFBQcBAQQ0MDIw MAYIKwYBBQUHMAGGJGh0dHA6Ly9vY3NwLmNsb3VkZmxhcmUuY29tL29yaWdpbl9j YTApBgNVHREEIjAggg8qLmtpcml0b3NzaC54eXqCDWtpcml0b3NzaC54eXowOAYD VR0fBDEwLzAtoCugKYYnaHR0cDovL2NybC5jbG91ZGZsYXJlLmNvbS9vcmlnaW5f Y2EuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQAbsza7rCC2HiuVbtnOPU00AspYf//O BGPY90ED63UIRtnsH3fb1DvJ09wraiv4esQuK/+im5PR5AW0XTbcOS2SrsZf8ya2 d4G01VKw/9W6PdklkqffyEivrQ5phPfL4NgrtFE0DkSh2x6MFygwM1IMWy7ZsjSZ 5pZSHTU7FFgUjsRxO50ytrF37XGK/xU/7pLSAUY6D+H2/8Ze4r4XX7Urr04NLRIc H5QAoCgGqEiUJlKzyn+m3ymdV8pHkfRp7WAuZXl00FeKUrIyklXyvq4dBFycTsxy SVWJByXpQ1qA19rPTGdSOwP7Cfjd6qBXPd/9wDN+zoYRwTKqcGOL5bIL -----END CERTIFICATE----- -----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4U8r910D8xGNz Dy2DjUaLuerGndqPc0uq62obLF7vxzu/MNwEqfLYi7yrZJPMwmq3uWqVrZG5eq+g 5ULcgmwt+ZrLMgcA1AuXon/cLGlC+72I9GAOuq+zuyBKxwFzX9IyotBMOkfX6TVd z1sGj8JZRVszNt9qM/GjbJki8msyrSkDDhXZJvaNCSGDIPgpxEw5jXk0b8Q1OSrm haK+NLm2zXIXfao9iqMlPyxsQscxk7tWMItk79tQHyOfeoQi2DxR+3iuw+WGbzLr zOdzeb2Mia1O5BSUby+Mui/0NNi9BCvBRaevqyDVsJeUGe/VpToKdOC69SW2KXqv YRTAK+0jAgMBAAECggEAQmRgEcVWEZVVMszNOnyI4+wfzdFut0uyfgpUShxVx6zt 7sQVA5MJNwlB+EP+XnrKgImHBAmkGvg/SUc6qX1KpNaqdDT9Q8WctU3hGvdeJLPT BYDsFnIUtjqY+4Yplhp19ioht8soNHM59yOoaDkgqhHqsww5NaInD5OepvFFPld1 K4nXNIu/bs57X0IIo99dLdmJxrslx1/A035E9E4eH1lHyH30K3w/rL8LD1kwl+Hr aoFTmIaT9ms/ckrtNe/84bpC700tMxf5v92IcKeaUjv97W8mkjzq03ejCPYvswFk 5wzLod/ZD+qflp2HAgkjG4kP+H/mrZWoqlxybyERTQKBgQD+GxhB/xfAwcac7Abb 9O7IdMZOB9F1ENZHj2rH+jw/RdksGqasm7BA3U3AeuhqAOS4LStq6YlnoArAoOdX CCZZ6qo7b8EiOcw2YYZuXxTxcQiDCvxA2CK6+QROBnv1k+R18VKOvLLjqBsNBJ1+ mKkdH7VJp+RoEJnLAAZtU5C1vwKBgQC5s4qKmzrVh0NXF9k+CcTOu1+C7bUxHL7k 7ol7+BtZ13u0FRpPFA0SRcm4cE0QN62xAr1+ueA++0KEXog/+HMoxiTT1pFGrsls ML9QkP8Aag/UEg+5vGxqKWSB8GYE/UQVyP2MzFh+bHjNWK4UB+GL95psq41K+8Iw Os7Pk6dJnQKBgQDsD5m6fdPAM4RidXZt0p4dxTYQeXzhhzG5qwdlHhfoI+h764pZ ogzcRXsczFGrYIcafoPuP2RxyyESEKi5lo2iTLm2m7xNImqPPoyXbmdTYVGqA4OS bffdwMZ6AdYYrzq3QugSSETb72ip8FarrAC3WKSe94TeFEX7a1uNJuuxmwKBgAwq E6gytO7p1mJtIIDs2OSF56LG+XiHHoYWjhD91qTS9bp9K2UEtjp9MdKQIKwwSYNv 34Peny7g/KF5I8m0964zFJR/2LJdnrokk1Ouu9WGHRVSPY94JU3q+jd8zOIEySH4 MYu4kw9tAZjJ91U+kuq9RHNb5XyE81p/b66vSGUNAoGAOtGt8W0PpyAnXq1rNJ7B +1nQsV2WmUi/89XFhiS9JIgljXhOEkIrZEFsG0qC2reSbId5HsfgicidVLEJVFsZ vIX2p5whGE0RNBK0aNmn/GLiCh5PzNOSvj+zL0k4pKBEflrWOMSvLh+XYwt+3xR/ iXYpDvnS3ZFtMyDo+/BLldI= -----END PRIVATE KEY-----