Kalix1 3 vuotta sitten
vanhempi
sitoutus
25663ea895

+ 2081 - 0
LACASITAMX-v8.9x/Des/protocolos/C-SSR.sh

@@ -0,0 +1,2081 @@
+#!/bin/bash
+#25/01/2021
+clear
+clear
+msg -bar
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+SCPdir="/etc/VPS-MX" && [[ ! -d ${SCPdir} ]] && exit 1
+SCPusr="${SCPdir}/controlador" && [[ ! -d ${SCPusr} ]] && mkdir ${SCPusr}
+SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
+SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
+
+BARRA1="\e[0;31m--------------------------------------------------------------------\e[0m"
+
+sh_ver="1.0.26"
+filepath=$(cd "$(dirname "$0")"; pwd)
+file=$(echo -e "${filepath}"|awk -F "$0" '{print $1}')
+ssr_folder="/usr/local/shadowsocksr"
+config_file="${ssr_folder}/config.json"
+config_user_file="${ssr_folder}/user-config.json"
+config_user_api_file="${ssr_folder}/userapiconfig.py"
+config_user_mudb_file="${ssr_folder}/mudb.json"
+ssr_log_file="${ssr_folder}/ssserver.log"
+Libsodiumr_file="/usr/local/lib/libsodium.so"
+Libsodiumr_ver_backup="1.0.16"
+Server_Speeder_file="/serverspeeder/bin/serverSpeeder.sh"
+LotServer_file="/appex/bin/serverSpeeder.sh"
+BBR_file="${file}/bbr.sh"
+jq_file="${ssr_folder}/jq"
+
+Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
+Info="${Green_font_prefix}[ INFORMACION ]${Font_color_suffix}"
+Error="${Red_font_prefix}[# ERROR #]${Font_color_suffix}"
+Tip="${Green_font_prefix}[ NOTA ]${Font_color_suffix}"
+Separator_1="——————————————————————————————"
+
+check_root(){
+	[[ $EUID != 0 ]] && echo -e "${Error} La cuenta actual no es ROOT (no tiene permiso ROOT), no puede continuar la operacion, por favor ${Green_background_prefix} sudo su ${Font_color_suffix} Venga a ROOT (le pedire que ingrese la contraseña de la cuenta actual despues de la ejecucion)" && exit 1
+}
+check_sys(){
+	if [[ -f /etc/redhat-release ]]; then
+		release="centos"
+	elif cat /etc/issue | grep -q -E -i "debian"; then
+		release="debian"
+	elif cat /etc/issue | grep -q -E -i "ubuntu"; then
+		release="ubuntu"
+	elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
+		release="centos"
+	elif cat /proc/version | grep -q -E -i "debian"; then
+		release="debian"
+	elif cat /proc/version | grep -q -E -i "ubuntu"; then
+		release="ubuntu"
+	elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
+		release="centos"
+    fi
+	bit=`uname -m`
+}
+check_pid(){
+	PID=`ps -ef |grep -v grep | grep server.py |awk '{print $2}'`
+}
+check_crontab(){
+	[[ ! -e "/usr/bin/crontab" ]] && echo -e "${Error}Falta de dependencia Crontab, Por favor, intente instalar manualmente CentOS: yum install crond -y , Debian/Ubuntu: apt-get install cron -y !" && exit 1
+}
+SSR_installation_status(){
+	[[ ! -e ${ssr_folder} ]] && echo -e "${Error}\nShadowsocksR No se encontro la carpeta, por favor verifique\n$(msg -bar)" && exit 1
+}
+Server_Speeder_installation_status(){
+	[[ ! -e ${Server_Speeder_file} ]] && echo -e "${Error}No instalado (Server Speeder), Por favor compruebe!" && exit 1
+}
+LotServer_installation_status(){
+	[[ ! -e ${LotServer_file} ]] && echo -e "${Error}No instalado LotServer, Por favor revise!" && exit 1
+}
+BBR_installation_status(){
+	if [[ ! -e ${BBR_file} ]]; then
+		echo -e "${Error} No encontre el script de BBR, comience a descargar ..."
+		cd "${file}"
+		if ! wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/bbr.sh; then
+			echo -e "${Error} BBR script descargar!" && exit 1
+		else
+			echo -e "${Info} BBR script descarga completa!"
+			chmod +x bbr.sh
+		fi
+	fi
+}
+#Establecer reglas de firewall
+Add_iptables(){
+	if [[ ! -z "${ssr_port}" ]]; then
+		iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${ssr_port} -j ACCEPT
+		iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${ssr_port} -j ACCEPT
+		ip6tables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${ssr_port} -j ACCEPT
+		ip6tables -I INPUT -m state --state NEW -m udp -p udp --dport ${ssr_port} -j ACCEPT
+	fi
+}
+Del_iptables(){
+	if [[ ! -z "${port}" ]]; then
+		iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport ${port} -j ACCEPT
+		iptables -D INPUT -m state --state NEW -m udp -p udp --dport ${port} -j ACCEPT
+		ip6tables -D INPUT -m state --state NEW -m tcp -p tcp --dport ${port} -j ACCEPT
+		ip6tables -D INPUT -m state --state NEW -m udp -p udp --dport ${port} -j ACCEPT
+	fi
+}
+Save_iptables(){
+	if [[ ${release} == "centos" ]]; then
+		service iptables save
+		service ip6tables save
+	else
+		iptables-save > /etc/iptables.up.rules
+		ip6tables-save > /etc/ip6tables.up.rules
+	fi
+}
+Set_iptables(){
+	if [[ ${release} == "centos" ]]; then
+		service iptables save
+		service ip6tables save
+		chkconfig --level 2345 iptables on
+		chkconfig --level 2345 ip6tables on
+	else
+		iptables-save > /etc/iptables.up.rules
+		ip6tables-save > /etc/ip6tables.up.rules
+		echo -e '#!/bin/bash\n/sbin/iptables-restore < /etc/iptables.up.rules\n/sbin/ip6tables-restore < /etc/ip6tables.up.rules' > /etc/network/if-pre-up.d/iptables
+		chmod +x /etc/network/if-pre-up.d/iptables
+	fi
+}
+#Leer la informaci�n de configuraci�n
+Get_IP(){
+	ip=$(wget -qO- -t1 -T2 ipinfo.io/ip)
+	if [[ -z "${ip}" ]]; then
+		ip=$(wget -qO- -t1 -T2 api.ip.sb/ip)
+		if [[ -z "${ip}" ]]; then
+			ip=$(wget -qO- -t1 -T2 members.3322.org/dyndns/getip)
+			if [[ -z "${ip}" ]]; then
+				ip="VPS_IP"
+			fi
+		fi
+	fi
+}
+Get_User_info(){
+	Get_user_port=$1
+	user_info_get=$(python mujson_mgr.py -l -p "${Get_user_port}")
+	match_info=$(echo "${user_info_get}"|grep -w "### user ")
+	if [[ -z "${match_info}" ]]; then
+		echo -e "${Error}La adquisicion de informacion del usuario fallo ${Green_font_prefix}[Puerto: ${ssr_port}]${Font_color_suffix} " && exit 1
+	fi
+	user_name=$(echo "${user_info_get}"|grep -w "user :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	port=$(echo "${user_info_get}"|grep -w "port :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	password=$(echo "${user_info_get}"|grep -w "passwd :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	method=$(echo "${user_info_get}"|grep -w "method :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	protocol=$(echo "${user_info_get}"|grep -w "protocol :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	protocol_param=$(echo "${user_info_get}"|grep -w "protocol_param :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	[[ -z ${protocol_param} ]] && protocol_param="0(Ilimitado)"
+msg -bar
+	obfs=$(echo "${user_info_get}"|grep -w "obfs :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	#transfer_enable=$(echo "${user_info_get}"|grep -w "transfer_enable :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}'|awk -F "ytes" '{print $1}'|sed 's/KB/ KB/;s/MB/ MB/;s/GB/ GB/;s/TB/ TB/;s/PB/ PB/')
+	#u=$(echo "${user_info_get}"|grep -w "u :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+	#d=$(echo "${user_info_get}"|grep -w "d :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+	forbidden_port=$(echo "${user_info_get}"|grep -w "Puerto prohibido :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+	[[ -z ${forbidden_port} ]] && forbidden_port="Permitir todo"
+msg -bar
+	speed_limit_per_con=$(echo "${user_info_get}"|grep -w "speed_limit_per_con :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	speed_limit_per_user=$(echo "${user_info_get}"|grep -w "speed_limit_per_user :"|sed 's/[[:space:]]//g'|awk -F ":" '{print $NF}')
+msg -bar
+	Get_User_transfer "${port}"
+}
+Get_User_transfer(){
+	transfer_port=$1
+	#echo "transfer_port=${transfer_port}"
+	all_port=$(${jq_file} '.[]|.port' ${config_user_mudb_file})
+	#echo "all_port=${all_port}"
+	port_num=$(echo "${all_port}"|grep -nw "${transfer_port}"|awk -F ":" '{print $1}')
+	#echo "port_num=${port_num}"
+	port_num_1=$(expr ${port_num} - 1)
+	#echo "port_num_1=${port_num_1}"
+	transfer_enable_1=$(${jq_file} ".[${port_num_1}].transfer_enable" ${config_user_mudb_file})
+	#echo "transfer_enable_1=${transfer_enable_1}"
+	u_1=$(${jq_file} ".[${port_num_1}].u" ${config_user_mudb_file})
+	#echo "u_1=${u_1}"
+	d_1=$(${jq_file} ".[${port_num_1}].d" ${config_user_mudb_file})
+	#echo "d_1=${d_1}"
+	transfer_enable_Used_2_1=$(expr ${u_1} + ${d_1})
+	#echo "transfer_enable_Used_2_1=${transfer_enable_Used_2_1}"
+	transfer_enable_Used_1=$(expr ${transfer_enable_1} - ${transfer_enable_Used_2_1})
+	#echo "transfer_enable_Used_1=${transfer_enable_Used_1}"
+	
+	
+	if [[ ${transfer_enable_1} -lt 1024 ]]; then
+		transfer_enable="${transfer_enable_1} B"
+	elif [[ ${transfer_enable_1} -lt 1048576 ]]; then
+		transfer_enable=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_1}'/'1024'}')
+		transfer_enable="${transfer_enable} KB"
+	elif [[ ${transfer_enable_1} -lt 1073741824 ]]; then
+		transfer_enable=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_1}'/'1048576'}')
+		transfer_enable="${transfer_enable} MB"
+	elif [[ ${transfer_enable_1} -lt 1099511627776 ]]; then
+		transfer_enable=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_1}'/'1073741824'}')
+		transfer_enable="${transfer_enable} GB"
+	elif [[ ${transfer_enable_1} -lt 1125899906842624 ]]; then
+		transfer_enable=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_1}'/'1099511627776'}')
+		transfer_enable="${transfer_enable} TB"
+	fi
+	#echo "transfer_enable=${transfer_enable}"
+	if [[ ${u_1} -lt 1024 ]]; then
+		u="${u_1} B"
+	elif [[ ${u_1} -lt 1048576 ]]; then
+		u=$(awk 'BEGIN{printf "%.2f\n",'${u_1}'/'1024'}')
+		u="${u} KB"
+	elif [[ ${u_1} -lt 1073741824 ]]; then
+		u=$(awk 'BEGIN{printf "%.2f\n",'${u_1}'/'1048576'}')
+		u="${u} MB"
+	elif [[ ${u_1} -lt 1099511627776 ]]; then
+		u=$(awk 'BEGIN{printf "%.2f\n",'${u_1}'/'1073741824'}')
+		u="${u} GB"
+	elif [[ ${u_1} -lt 1125899906842624 ]]; then
+		u=$(awk 'BEGIN{printf "%.2f\n",'${u_1}'/'1099511627776'}')
+		u="${u} TB"
+	fi
+	#echo "u=${u}"
+	if [[ ${d_1} -lt 1024 ]]; then
+		d="${d_1} B"
+	elif [[ ${d_1} -lt 1048576 ]]; then
+		d=$(awk 'BEGIN{printf "%.2f\n",'${d_1}'/'1024'}')
+		d="${d} KB"
+	elif [[ ${d_1} -lt 1073741824 ]]; then
+		d=$(awk 'BEGIN{printf "%.2f\n",'${d_1}'/'1048576'}')
+		d="${d} MB"
+	elif [[ ${d_1} -lt 1099511627776 ]]; then
+		d=$(awk 'BEGIN{printf "%.2f\n",'${d_1}'/'1073741824'}')
+		d="${d} GB"
+	elif [[ ${d_1} -lt 1125899906842624 ]]; then
+		d=$(awk 'BEGIN{printf "%.2f\n",'${d_1}'/'1099511627776'}')
+		d="${d} TB"
+	fi
+	#echo "d=${d}"
+	if [[ ${transfer_enable_Used_1} -lt 1024 ]]; then
+		transfer_enable_Used="${transfer_enable_Used_1} B"
+	elif [[ ${transfer_enable_Used_1} -lt 1048576 ]]; then
+		transfer_enable_Used=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_1}'/'1024'}')
+		transfer_enable_Used="${transfer_enable_Used} KB"
+	elif [[ ${transfer_enable_Used_1} -lt 1073741824 ]]; then
+		transfer_enable_Used=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_1}'/'1048576'}')
+		transfer_enable_Used="${transfer_enable_Used} MB"
+	elif [[ ${transfer_enable_Used_1} -lt 1099511627776 ]]; then
+		transfer_enable_Used=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_1}'/'1073741824'}')
+		transfer_enable_Used="${transfer_enable_Used} GB"
+	elif [[ ${transfer_enable_Used_1} -lt 1125899906842624 ]]; then
+		transfer_enable_Used=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_1}'/'1099511627776'}')
+		transfer_enable_Used="${transfer_enable_Used} TB"
+	fi
+	#echo "transfer_enable_Used=${transfer_enable_Used}"
+	if [[ ${transfer_enable_Used_2_1} -lt 1024 ]]; then
+		transfer_enable_Used_2="${transfer_enable_Used_2_1} B"
+	elif [[ ${transfer_enable_Used_2_1} -lt 1048576 ]]; then
+		transfer_enable_Used_2=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_2_1}'/'1024'}')
+		transfer_enable_Used_2="${transfer_enable_Used_2} KB"
+	elif [[ ${transfer_enable_Used_2_1} -lt 1073741824 ]]; then
+		transfer_enable_Used_2=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_2_1}'/'1048576'}')
+		transfer_enable_Used_2="${transfer_enable_Used_2} MB"
+	elif [[ ${transfer_enable_Used_2_1} -lt 1099511627776 ]]; then
+		transfer_enable_Used_2=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_2_1}'/'1073741824'}')
+		transfer_enable_Used_2="${transfer_enable_Used_2} GB"
+	elif [[ ${transfer_enable_Used_2_1} -lt 1125899906842624 ]]; then
+		transfer_enable_Used_2=$(awk 'BEGIN{printf "%.2f\n",'${transfer_enable_Used_2_1}'/'1099511627776'}')
+		transfer_enable_Used_2="${transfer_enable_Used_2} TB"
+	fi
+	#echo "transfer_enable_Used_2=${transfer_enable_Used_2}"
+}
+urlsafe_base64(){
+	date=$(echo -n "$1"|base64|sed ':a;N;s/\n/ /g;ta'|sed 's/ //g;s/=//g;s/+/-/g;s/\//_/g')
+	echo -e "${date}"
+}
+ss_link_qr(){
+	SSbase64=$(urlsafe_base64 "${method}:${password}@${ip}:${port}")
+	SSurl="ss://${SSbase64}"
+	SSQRcode="http://www.codigos-qr.com/qr/php/qr_img.php?d=${SSurl}"
+	ss_link=" SS    Link :\n ${Green_font_prefix}${SSurl}${Font_color_suffix} \n Codigo QR SS:\n ${Green_font_prefix}${SSQRcode}${Font_color_suffix}"
+}
+ssr_link_qr(){
+	SSRprotocol=$(echo ${protocol} | sed 's/_compatible//g')
+	SSRobfs=$(echo ${obfs} | sed 's/_compatible//g')
+	SSRPWDbase64=$(urlsafe_base64 "${password}")
+	SSRbase64=$(urlsafe_base64 "${ip}:${port}:${SSRprotocol}:${method}:${SSRobfs}:${SSRPWDbase64}")
+	SSRurl="ssr://${SSRbase64}"
+	SSRQRcode="http://www.codigos-qr.com/qr/php/qr_img.php?d=${SSRurl}"
+	ssr_link=" SSR   Link :\n ${Red_font_prefix}${SSRurl}${Font_color_suffix} \n Codigo QR SSR:\n ${Red_font_prefix}${SSRQRcode}${Font_color_suffix}"
+}
+ss_ssr_determine(){
+	protocol_suffix=`echo ${protocol} | awk -F "_" '{print $NF}'`
+	obfs_suffix=`echo ${obfs} | awk -F "_" '{print $NF}'`
+	if [[ ${protocol} = "origin" ]]; then
+		if [[ ${obfs} = "plain" ]]; then
+			ss_link_qr
+			ssr_link=""
+		else
+			if [[ ${obfs_suffix} != "compatible" ]]; then
+				ss_link=""
+			else
+				ss_link_qr
+			fi
+		fi
+	else
+		if [[ ${protocol_suffix} != "compatible" ]]; then
+			ss_link=""
+		else
+			if [[ ${obfs_suffix} != "compatible" ]]; then
+				if [[ ${obfs_suffix} = "plain" ]]; then
+					ss_link_qr
+				else
+					ss_link=""
+				fi
+			else
+				ss_link_qr
+			fi
+		fi
+	fi
+	ssr_link_qr
+}
+# Display configuration information
+View_User(){
+clear
+	SSR_installation_status
+	List_port_user
+	while true
+	do
+		echo -e "Ingrese el puerto de usuario para ver la informacion\nde la cuenta completa"
+msg -bar
+		stty erase '^H' && read -p "(Predeterminado: cancelar):" View_user_port
+		[[ -z "${View_user_port}" ]] && echo -e "Cancelado ...\n$(msg -bar)" && exit 1
+		View_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${View_user_port}"',')
+		if [[ ! -z ${View_user} ]]; then
+			Get_User_info "${View_user_port}"
+			View_User_info
+			break
+		else
+			echo -e "${Error} Por favor ingrese el puerto correcto !"
+		fi
+	done
+#read -p "Enter para continuar" enter
+}
+View_User_info(){
+	ip=$(cat ${config_user_api_file}|grep "SERVER_PUB_ADDR = "|awk -F "[']" '{print $2}')
+	[[ -z "${ip}" ]] && Get_IP
+	ss_ssr_determine
+	clear 
+	echo -e " Usuario [{user_name}] Informacion de Cuenta:"
+msg -bar
+    echo -e " PANEL VPS-MX"
+	
+	echo -e " IP : ${Green_font_prefix}${ip}${Font_color_suffix}"
+
+	echo -e " Puerto : ${Green_font_prefix}${port}${Font_color_suffix}"
+
+	echo -e " Contraseña : ${Green_font_prefix}${password}${Font_color_suffix}"
+
+	echo -e " Encriptacion : ${Green_font_prefix}${method}${Font_color_suffix}"
+
+	echo -e " Protocol : ${Red_font_prefix}${protocol}${Font_color_suffix}"
+
+	echo -e " Obfs : ${Red_font_prefix}${obfs}${Font_color_suffix}"
+
+	echo -e " Limite de dispositivos: ${Green_font_prefix}${protocol_param}${Font_color_suffix}"
+
+	echo -e " Velocidad de subproceso Unico: ${Green_font_prefix}${speed_limit_per_con} KB/S${Font_color_suffix}"
+
+	echo -e " Velocidad Maxima del Usuario: ${Green_font_prefix}${speed_limit_per_user} KB/S${Font_color_suffix}"
+
+	echo -e " Puertos Prohibido: ${Green_font_prefix}${forbidden_port} ${Font_color_suffix}"
+
+	echo -e " Consumo de sus Datos:\n Carga: ${Green_font_prefix}${u}${Font_color_suffix} + Descarga: ${Green_font_prefix}${d}${Font_color_suffix} = ${Green_font_prefix}${transfer_enable_Used_2}${Font_color_suffix}"
+	
+         echo -e " Trafico Restante: ${Green_font_prefix}${transfer_enable_Used} ${Font_color_suffix}"
+msg -bar
+	echo -e " Trafico Total del Usuario: ${Green_font_prefix}${transfer_enable} ${Font_color_suffix}"
+msg -bar
+	echo -e "${ss_link}"
+msg -bar
+	echo -e "${ssr_link}"
+msg -bar
+	echo -e " ${Green_font_prefix} Nota: ${Font_color_suffix}
+ En el navegador, abra el enlace del codigo QR, puede\n ver la imagen del codigo QR."
+msg -bar
+}
+#Configuracion de la informacion de configuracion
+Set_config_user(){
+msg -bar
+	echo -ne "\e[92m 1) Ingrese un nombre al usuario que desea Configurar\n (No repetir, o se marcara incorrectamente!)\n"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: VPS-MX):" ssr_user
+	[[ -z "${ssr_user}" ]] && ssr_user="VPS-MX"
+	echo && echo -e "	Nombre de usuario : ${Green_font_prefix}${ssr_user}${Font_color_suffix}" && echo
+}
+Set_config_port(){
+msg -bar
+	while true
+	do
+	echo -e "\e[92m 2) Por favor ingrese un Puerto para el Usuario "
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: 2525):" ssr_port
+	[[ -z "$ssr_port" ]] && ssr_port="2525"
+	expr ${ssr_port} + 0 &>/dev/null
+	if [[ $? == 0 ]]; then
+		if [[ ${ssr_port} -ge 1 ]] && [[ ${ssr_port} -le 65535 ]]; then
+			echo && echo -e "	Port : ${Green_font_prefix}${ssr_port}${Font_color_suffix}" && echo
+			break
+		else
+			echo -e "${Error} Por favor ingrese el numero correcto (1-65535)"
+		fi
+	else
+		echo -e "${Error} Por favor ingrese el numero correcto (1-65535)"
+	fi
+	done
+}
+Set_config_password(){
+msg -bar
+	echo -e "\e[92m 3) Por favor ingrese una contrasena para el Usuario"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: VPS-MX):" ssr_password
+	[[ -z "${ssr_password}" ]] && ssr_password="VPS-MX"
+	echo && echo -e "	contrasena : ${Green_font_prefix}${ssr_password}${Font_color_suffix}" && echo
+}
+Set_config_method(){
+msg -bar
+	echo -e "\e[92m 4) Seleccione tipo de Encriptacion para el Usuario\e[0m
+$(msg -bar)
+ ${Green_font_prefix} 1.${Font_color_suffix} Ninguno
+ ${Green_font_prefix} 2.${Font_color_suffix} rc4
+ ${Green_font_prefix} 3.${Font_color_suffix} rc4-md5
+ ${Green_font_prefix} 4.${Font_color_suffix} rc4-md5-6
+ ${Green_font_prefix} 5.${Font_color_suffix} aes-128-ctr
+ ${Green_font_prefix} 6.${Font_color_suffix} aes-192-ctr
+ ${Green_font_prefix} 7.${Font_color_suffix} aes-256-ctr
+ ${Green_font_prefix} 8.${Font_color_suffix} aes-128-cfb
+ ${Green_font_prefix} 9.${Font_color_suffix} aes-192-cfb
+ ${Green_font_prefix}10.${Font_color_suffix} aes-256-cfb
+ ${Green_font_prefix}11.${Font_color_suffix} aes-128-cfb8
+ ${Green_font_prefix}12.${Font_color_suffix} aes-192-cfb8
+ ${Green_font_prefix}13.${Font_color_suffix} aes-256-cfb8
+ ${Green_font_prefix}14.${Font_color_suffix} salsa20
+ ${Green_font_prefix}15.${Font_color_suffix} chacha20
+ ${Green_font_prefix}16.${Font_color_suffix} chacha20-ietf
+ 
+ ${Red_font_prefix}17.${Font_color_suffix} xsalsa20
+ ${Red_font_prefix}18.${Font_color_suffix} xchacha20
+$(msg -bar)
+ ${Tip} Para salsa20/chacha20-*:\n Porfavor instale libsodium:\n Opcion 4 en menu principal SSRR"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: 16. chacha20-ietf):" ssr_method
+msg -bar
+	[[ -z "${ssr_method}" ]] && ssr_method="16"
+	if [[ ${ssr_method} == "1" ]]; then
+		ssr_method="Ninguno"
+	elif [[ ${ssr_method} == "2" ]]; then
+		ssr_method="rc4"
+	elif [[ ${ssr_method} == "3" ]]; then
+		ssr_method="rc4-md5"
+	elif [[ ${ssr_method} == "4" ]]; then
+		ssr_method="rc4-md5-6"
+	elif [[ ${ssr_method} == "5" ]]; then
+		ssr_method="aes-128-ctr"
+	elif [[ ${ssr_method} == "6" ]]; then
+		ssr_method="aes-192-ctr"
+	elif [[ ${ssr_method} == "7" ]]; then
+		ssr_method="aes-256-ctr"
+	elif [[ ${ssr_method} == "8" ]]; then
+		ssr_method="aes-128-cfb"
+	elif [[ ${ssr_method} == "9" ]]; then
+		ssr_method="aes-192-cfb"
+	elif [[ ${ssr_method} == "10" ]]; then
+		ssr_method="aes-256-cfb"
+	elif [[ ${ssr_method} == "11" ]]; then
+		ssr_method="aes-128-cfb8"
+	elif [[ ${ssr_method} == "12" ]]; then
+		ssr_method="aes-192-cfb8"
+	elif [[ ${ssr_method} == "13" ]]; then
+		ssr_method="aes-256-cfb8"
+	elif [[ ${ssr_method} == "14" ]]; then
+		ssr_method="salsa20"
+	elif [[ ${ssr_method} == "15" ]]; then
+		ssr_method="chacha20"
+	elif [[ ${ssr_method} == "16" ]]; then
+		ssr_method="chacha20-ietf"
+	elif [[ ${ssr_method} == "17" ]]; then
+		ssr_method="xsalsa20"
+	elif [[ ${ssr_method} == "18" ]]; then
+		ssr_method="xchacha20"
+	else
+		ssr_method="aes-256-cfb"
+	fi
+	echo && echo -e "	Encriptacion: ${Green_font_prefix}${ssr_method}${Font_color_suffix}" && echo
+}
+Set_config_protocol(){
+msg -bar
+	echo -e "\e[92m 5) Por favor, seleccione un Protocolo
+$(msg -bar)
+ ${Green_font_prefix}1.${Font_color_suffix} origin
+ ${Green_font_prefix}2.${Font_color_suffix} auth_sha1_v4
+ ${Green_font_prefix}3.${Font_color_suffix} auth_aes128_md5
+ ${Green_font_prefix}4.${Font_color_suffix} auth_aes128_sha1
+ ${Green_font_prefix}5.${Font_color_suffix} auth_chain_a
+ ${Green_font_prefix}6.${Font_color_suffix} auth_chain_b
+
+ ${Red_font_prefix}7.${Font_color_suffix} auth_chain_c
+ ${Red_font_prefix}8.${Font_color_suffix} auth_chain_d
+ ${Red_font_prefix}9.${Font_color_suffix} auth_chain_e
+ ${Red_font_prefix}10.${Font_color_suffix} auth_chain_f
+$(msg -bar)
+ ${Tip}\n Si selecciona el protocolo de serie auth_chain_ *:\n Se recomienda establecer el metodo de cifrado en ninguno"
+msg -bar
+	stty erase '^H' && read -p "(Predterminado: 1. origin):" ssr_protocol
+msg -bar
+	[[ -z "${ssr_protocol}" ]] && ssr_protocol="1"
+	if [[ ${ssr_protocol} == "1" ]]; then
+		ssr_protocol="origin"
+	elif [[ ${ssr_protocol} == "2" ]]; then
+		ssr_protocol="auth_sha1_v4"
+	elif [[ ${ssr_protocol} == "3" ]]; then
+		ssr_protocol="auth_aes128_md5"
+	elif [[ ${ssr_protocol} == "4" ]]; then
+		ssr_protocol="auth_aes128_sha1"
+	elif [[ ${ssr_protocol} == "5" ]]; then
+		ssr_protocol="auth_chain_a"
+	elif [[ ${ssr_protocol} == "6" ]]; then
+		ssr_protocol="auth_chain_b"
+	elif [[ ${ssr_protocol} == "7" ]]; then
+		ssr_protocol="auth_chain_c"
+	elif [[ ${ssr_protocol} == "8" ]]; then
+		ssr_protocol="auth_chain_d"
+	elif [[ ${ssr_protocol} == "9" ]]; then
+		ssr_protocol="auth_chain_e"
+	elif [[ ${ssr_protocol} == "10" ]]; then
+		ssr_protocol="auth_chain_f"
+	else
+		ssr_protocol="origin"
+	fi
+	echo && echo -e "	Protocolo : ${Green_font_prefix}${ssr_protocol}${Font_color_suffix}" && echo
+	if [[ ${ssr_protocol} != "origin" ]]; then
+		if [[ ${ssr_protocol} == "auth_sha1_v4" ]]; then
+			stty erase '^H' && read -p "Set protocol plug-in to compatible mode(_compatible)?[Y/n]" ssr_protocol_yn
+			[[ -z "${ssr_protocol_yn}" ]] && ssr_protocol_yn="y"
+			[[ $ssr_protocol_yn == [Yy] ]] && ssr_protocol=${ssr_protocol}"_compatible"
+			echo
+		fi
+	fi
+}
+Set_config_obfs(){
+msg -bar
+	echo -e "\e[92m 6) Por favor, seleccione el metodo OBFS
+$(msg -bar)
+ ${Green_font_prefix}1.${Font_color_suffix} plain
+ ${Green_font_prefix}2.${Font_color_suffix} http_simple
+ ${Green_font_prefix}3.${Font_color_suffix} http_post
+ ${Green_font_prefix}4.${Font_color_suffix} random_head
+ ${Green_font_prefix}5.${Font_color_suffix} tls1.2_ticket_auth
+$(msg -bar)
+  Si elige tls1.2_ticket_auth, entonces el cliente puede\n  elegir tls1.2_ticket_fastauth!"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: 5. tls1.2_ticket_auth):" ssr_obfs
+	[[ -z "${ssr_obfs}" ]] && ssr_obfs="5"
+	if [[ ${ssr_obfs} == "1" ]]; then
+		ssr_obfs="plain"
+	elif [[ ${ssr_obfs} == "2" ]]; then
+		ssr_obfs="http_simple"
+	elif [[ ${ssr_obfs} == "3" ]]; then
+		ssr_obfs="http_post"
+	elif [[ ${ssr_obfs} == "4" ]]; then
+		ssr_obfs="random_head"
+	elif [[ ${ssr_obfs} == "5" ]]; then
+		ssr_obfs="tls1.2_ticket_auth"
+	else
+		ssr_obfs="tls1.2_ticket_auth"
+	fi
+	echo && echo -e "	obfs : ${Green_font_prefix}${ssr_obfs}${Font_color_suffix}" && echo
+	msg -bar
+	if [[ ${ssr_obfs} != "plain" ]]; then
+			stty erase '^H' && read -p "Configurar modo Compatible (Para usar SS)? [y/n]: " ssr_obfs_yn
+			[[ -z "${ssr_obfs_yn}" ]] && ssr_obfs_yn="y"
+			[[ $ssr_obfs_yn == [Yy] ]] && ssr_obfs=${ssr_obfs}"_compatible"
+	fi
+}
+Set_config_protocol_param(){
+msg -bar
+	while true
+	do
+	echo -e "\e[92m 7) Limitar Cantidad de Dispositivos Simultaneos\n  ${Green_font_prefix} auth_*La serie no es compatible con la version original. ${Font_color_suffix}"
+msg -bar
+	echo -e "${Tip} Limite de numero de dispositivos:\n Es el numero de clientes que usaran la cuenta\n el minimo recomendado 2."
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: Ilimitado):" ssr_protocol_param
+	[[ -z "$ssr_protocol_param" ]] && ssr_protocol_param="" && echo && break
+	expr ${ssr_protocol_param} + 0 &>/dev/null
+	if [[ $? == 0 ]]; then
+		if [[ ${ssr_protocol_param} -ge 1 ]] && [[ ${ssr_protocol_param} -le 9999 ]]; then
+			echo && echo -e "	Limite del dispositivo: ${Green_font_prefix}${ssr_protocol_param}${Font_color_suffix}" && echo
+			break
+		else
+			echo -e "${Error} Por favor ingrese el numero correcto (1-9999)"
+		fi
+	else
+		echo -e "${Error} Por favor ingrese el numero correcto (1-9999)"
+	fi
+	done
+}
+Set_config_speed_limit_per_con(){
+msg -bar
+	while true
+	do
+	echo -e "\e[92m 8) Introduzca un Limite de Velocidad x Hilo (en KB/S)"
+msg -bar
+	stty erase '^H' && read -p "(Predterminado: Ilimitado):" ssr_speed_limit_per_con
+msg -bar
+	[[ -z "$ssr_speed_limit_per_con" ]] && ssr_speed_limit_per_con=0 && echo && break
+	expr ${ssr_speed_limit_per_con} + 0 &>/dev/null
+	if [[ $? == 0 ]]; then
+		if [[ ${ssr_speed_limit_per_con} -ge 1 ]] && [[ ${ssr_speed_limit_per_con} -le 131072 ]]; then
+			echo && echo -e "	Velocidad de Subproceso Unico: ${Green_font_prefix}${ssr_speed_limit_per_con} KB/S${Font_color_suffix}" && echo
+			break
+		else
+			echo -e "${Error} Por favor ingrese el numero correcto (1-131072)"
+		fi
+	else
+		echo -e "${Error} Por favor ingrese el numero correcto (1-131072)"
+	fi
+	done
+}
+Set_config_speed_limit_per_user(){
+msg -bar
+	while true
+	do
+	echo -e "\e[92m 9) Introduzca un Limite de Velocidad Maxima (en KB/S)"
+msg -bar
+	echo -e "${Tip} Limite de Velocidad Maxima del Puerto :\n Es la velocidad maxima que ira el Usuario."
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: Ilimitado):" ssr_speed_limit_per_user
+	[[ -z "$ssr_speed_limit_per_user" ]] && ssr_speed_limit_per_user=0 && echo && break
+	expr ${ssr_speed_limit_per_user} + 0 &>/dev/null
+	if [[ $? == 0 ]]; then
+		if [[ ${ssr_speed_limit_per_user} -ge 1 ]] && [[ ${ssr_speed_limit_per_user} -le 131072 ]]; then
+			echo && echo -e "	Velocidad Maxima del Usuario : ${Green_font_prefix}${ssr_speed_limit_per_user} KB/S${Font_color_suffix}" && echo
+			break
+		else
+			echo -e "${Error} Por favor ingrese el numero correcto (1-131072)"
+		fi
+	else
+		echo -e "${Error} Por favor ingrese el numero correcto (1-131072)"
+	fi
+	done
+}
+Set_config_transfer(){
+msg -bar
+	while true
+	do
+	echo -e "\e[92m 10) Ingrese Cantidad Total de Datos para el Usuario\n   (en GB, 1-838868 GB)"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: Ilimitado):" ssr_transfer
+	[[ -z "$ssr_transfer" ]] && ssr_transfer="838868" && echo && break
+	expr ${ssr_transfer} + 0 &>/dev/null
+	if [[ $? == 0 ]]; then
+		if [[ ${ssr_transfer} -ge 1 ]] && [[ ${ssr_transfer} -le 838868 ]]; then
+			echo && echo -e "	Trafico Total Para El Usuario: ${Green_font_prefix}${ssr_transfer} GB${Font_color_suffix}" && echo
+			break
+		else
+			echo -e "${Error} Por favor ingrese el numero correcto (1-838868)"
+		fi
+	else
+		echo -e "${Error} Por favor ingrese el numero correcto (1-838868)"
+	fi
+	done
+}
+Set_config_forbid(){
+msg -bar
+	echo "PROIBIR PUERTOS"
+msg -bar
+	echo -e "${Tip} Puertos prohibidos:\n Por ejemplo, si no permite el acceso al puerto 25, los\n usuarios no podran acceder al puerto de correo 25 a\n traves del proxy de SSR. Si 80,443 esta desactivado,\n los usuarios no podran acceda a los sitios\n http/https normalmente."
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: permitir todo):" ssr_forbid
+	[[ -z "${ssr_forbid}" ]] && ssr_forbid=""
+	echo && echo -e "	Puerto prohibido: ${Green_font_prefix}${ssr_forbid}${Font_color_suffix}" && echo
+}
+Set_config_enable(){
+	user_total=$(expr ${user_total} - 1)
+	for((integer = 0; integer <= ${user_total}; integer++))
+	do
+		echo -e "integer=${integer}"
+		port_jq=$(${jq_file} ".[${integer}].port" "${config_user_mudb_file}")
+		echo -e "port_jq=${port_jq}"
+		if [[ "${ssr_port}" == "${port_jq}" ]]; then
+			enable=$(${jq_file} ".[${integer}].enable" "${config_user_mudb_file}")
+			echo -e "enable=${enable}"
+			[[ "${enable}" == "null" ]] && echo -e "${Error} Obtenga el puerto actual [${ssr_port}] Estado deshabilitado fallido!" && exit 1
+			ssr_port_num=$(cat "${config_user_mudb_file}"|grep -n '"puerto": '${ssr_port}','|awk -F ":" '{print $1}')
+			echo -e "ssr_port_num=${ssr_port_num}"
+			[[ "${ssr_port_num}" == "null" ]] && echo -e "${Error}Obtener actual Puerto [${ssr_port}] Numero de filas fallidas!" && exit 1
+			ssr_enable_num=$(expr ${ssr_port_num} - 5)
+			echo -e "ssr_enable_num=${ssr_enable_num}"
+			break
+		fi
+	done
+	if [[ "${enable}" == "1" ]]; then
+		echo -e "Puerto [${ssr_port}] El estado de la cuenta es: ${Green_font_prefix}Enabled ${Font_color_suffix} , Cambiar a ${Red_font_prefix}Disabled${Font_color_suffix} ?[Y/n]"
+		stty erase '^H' && read -p "(Predeterminado: Y):" ssr_enable_yn
+		[[ -z "${ssr_enable_yn}" ]] && ssr_enable_yn="y"
+		if [[ "${ssr_enable_yn}" == [Yy] ]]; then
+			ssr_enable="0"
+		else
+			echo -e "Cancelado...\n$(msg -bar)" && exit 0
+		fi
+	elif [[ "${enable}" == "0" ]]; then
+		echo -e "Port [${ssr_port}] El estado de la cuenta:${Green_font_prefix}Habilitado ${Font_color_suffix} , Cambie a ${Red_font_prefix}Deshabilitado${Font_color_suffix} ?[Y/n]"
+		stty erase '^H' && read -p "(Predeterminado: Y):" ssr_enable_yn
+		[[ -z "${ssr_enable_yn}" ]] && ssr_enable_yn = "y"
+		if [[ "${ssr_enable_yn}" == [Yy] ]]; then
+			ssr_enable="1"
+		else
+			echo "Cancelar ..." && exit 0
+		fi
+	else
+		echo -e "${Error} El actual estado de discapacidad de Puerto es anormal.[${enable}] !" && exit 1
+	fi
+}
+Set_user_api_server_pub_addr(){
+	addr=$1
+	if [[ "${addr}" == "Modify" ]]; then
+		server_pub_addr=$(cat ${config_user_api_file}|grep "SERVER_PUB_ADDR = "|awk -F "[']" '{print $2}')
+		if [[ -z ${server_pub_addr} ]]; then
+			echo -e "${Error} La IP del servidor o el nombre de dominio obtenidos fallaron!" && exit 1
+		else
+			echo -e "${Info} La IP del servidor o el nombre de dominio actualmente configurados es ${Green_font_prefix}${server_pub_addr}${Font_color_suffix}"
+		fi
+	fi
+	echo "Introduzca la IP del servidor o el nombre de dominio que se mostrara en la configuracion del usuario (cuando el servidor tiene varias IP, puede especificar la IP o el nombre de dominio que se muestra en la configuracion del usuario)"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado:Deteccion automatica de la red externa IP):" ssr_server_pub_addr
+	if [[ -z "${ssr_server_pub_addr}" ]]; then
+		Get_IP
+		if [[ ${ip} == "VPS_IP" ]]; then
+			while true
+			do
+			stty erase '^H' && read -p "${Error} La deteccion automatica de la IP de la red externa fallo, ingrese manualmente la IP del servidor o el nombre de dominio" ssr_server_pub_addr
+			if [[ -z "$ssr_server_pub_addr" ]]; then
+				echo -e "${Error}No puede estar vacio!"
+			else
+				break
+			fi
+			done
+		else
+			ssr_server_pub_addr="${ip}"
+		fi
+	fi
+	echo && msg -bar && echo -e "	IP o nombre de dominio: ${Green_font_prefix}${ssr_server_pub_addr}${Font_color_suffix}" && msg -bar && echo
+}
+Set_config_all(){
+	lal=$1
+	if [[ "${lal}" == "Modify" ]]; then
+		Set_config_password
+		Set_config_method
+		Set_config_protocol
+		Set_config_obfs
+		Set_config_protocol_param
+		Set_config_speed_limit_per_con
+		Set_config_speed_limit_per_user
+		Set_config_transfer
+		Set_config_forbid
+	else
+		Set_config_user
+		Set_config_port
+		Set_config_password
+		Set_config_method
+		Set_config_protocol
+		Set_config_obfs
+		Set_config_protocol_param
+		Set_config_speed_limit_per_con
+		Set_config_speed_limit_per_user
+		Set_config_transfer
+		Set_config_forbid
+	fi
+}
+#Modificar la informaci�n de configuraci�n
+Modify_config_password(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -k "${ssr_password}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} Fallo la modificacion de la contrasena del usuario ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} La contrasena del usuario se modifico correctamente ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Puede tardar unos 10 segundos aplicar la ultima configuracion)"
+	fi
+}
+Modify_config_method(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -m "${ssr_method}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} La modificacion del metodo de cifrado del usuario fallo ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Modo de cifrado de usuario ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Note: Nota: la configuracion mas reciente puede demorar unos 10 segundos)"
+	fi
+}
+Modify_config_protocol(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -O "${ssr_protocol}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} Fallo la modificacion del protocolo de usuario ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Acuerdo de usuario modificacion exito ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Nota: la configuracion m�s reciente puede demorar unos 10 segundos)"
+	fi
+}
+Modify_config_obfs(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -o "${ssr_obfs}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} La modificacion de la confusion del usuario fallo ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Confusion del usuario exito de modificacion ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Nota: La aplicacion de la ultima configuracion puede demorar unos 10 segundos)"
+	fi
+}
+Modify_config_protocol_param(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -G "${ssr_protocol_param}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} Fallo la modificacion del parametro del protocolo del usuario (numero de dispositivos limite) ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Parametros de negociaci�n del usuario (numero de dispositivos limite) modificados correctamente ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Nota: puede tomar aproximadamente 10 segundos aplicar la ultima configuracion)"
+	fi
+}
+Modify_config_speed_limit_per_con(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -s "${ssr_speed_limit_per_con}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} Fallo la modificacion de la velocidad de un solo hilo ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Modificacion de la velocidad de un solo hilo exitosa ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Nota: puede tomar aproximadamente 10 segundos aplicar la ultima configuracion)"
+	fi
+}
+Modify_config_speed_limit_per_user(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -S "${ssr_speed_limit_per_user}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} Usuario Puerto la modificaci�n del limite de velocidad total fallo ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Usuario Puerto limite de velocidad total modificado con exito ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Nota: la configuracion mas reciente puede demorar unos 10 segundos)"
+	fi
+}
+Modify_config_connect_verbose_info(){
+	sed -i 's/"connect_verbose_info": '"$(echo ${connect_verbose_info})"',/"connect_verbose_info": '"$(echo ${ssr_connect_verbose_info})"',/g' ${config_user_file}
+}
+Modify_config_transfer(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -t "${ssr_transfer}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} La modificacion de trafico total del usuario fallo ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Trafico total del usuario ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Nota: la configuracion mas reciente puede demorar unos 10 segundos)"
+	fi
+}
+Modify_config_forbid(){
+	match_edit=$(python mujson_mgr.py -e -p "${ssr_port}" -f "${ssr_forbid}"|grep -w "edit user ")
+	if [[ -z "${match_edit}" ]]; then
+		echo -e "${Error} La modificacion del puerto prohibido por el usuario ha fallado ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} " && exit 1
+	else
+		echo -e "${Info} Los puertos prohibidos por el usuario se modificaron correctamente ${Green_font_prefix}[Port: ${ssr_port}]${Font_color_suffix} (Nota: puede tomar aproximadamente 10 segundos aplicar la ultima configuracion)"
+	fi
+}
+Modify_config_enable(){
+	sed -i "${ssr_enable_num}"'s/"enable": '"$(echo ${enable})"',/"enable": '"$(echo ${ssr_enable})"',/' ${config_user_mudb_file}
+}
+Modify_user_api_server_pub_addr(){
+	sed -i "s/SERVER_PUB_ADDR = '${server_pub_addr}'/SERVER_PUB_ADDR = '${ssr_server_pub_addr}'/" ${config_user_api_file}
+}
+Modify_config_all(){
+	Modify_config_password
+	Modify_config_method
+	Modify_config_protocol
+	Modify_config_obfs
+	Modify_config_protocol_param
+	Modify_config_speed_limit_per_con
+	Modify_config_speed_limit_per_user
+	Modify_config_transfer
+	Modify_config_forbid
+}
+Check_python(){
+	python_ver=`python -h`
+	if [[ -z ${python_ver} ]]; then
+		echo -e "${Info} No instalo Python, comience a instalar ..."
+		if [[ ${release} == "centos" ]]; then
+			yum install -y python
+		else
+			apt-get install -y python
+		fi
+	fi
+}
+Centos_yum(){
+	yum update
+	cat /etc/redhat-release |grep 7\..*|grep -i centos>/dev/null
+	if [[ $? = 0 ]]; then
+		yum install -y vim unzip crond net-tools git
+	else
+		yum install -y vim unzip crond git
+	fi
+}
+Debian_apt(){
+	apt-get update
+	apt-get install -y vim unzip cron git net-tools
+}
+#Descargar ShadowsocksR
+Download_SSR(){
+	cd "/usr/local"
+	# wget -N --no-check-certificate "https://github.com/ToyoDAdoubi/shadowsocksr/archive/manyuser.zip"
+	#git config --global http.sslVerify false
+	git clone -b akkariiin/master https://github.com/shadowsocksrr/shadowsocksr.git
+	[[ ! -e ${ssr_folder} ]] && echo -e "${Error} Fallo la descarga del servidor ShadowsocksR!" && exit 1
+	# [[ ! -e "manyuser.zip" ]] && echo -e "${Error} Fallo la descarga del paquete de compresion lateral ShadowsocksR !" && rm -rf manyuser.zip && exit 1
+	# unzip "manyuser.zip"
+	# [[ ! -e "/usr/local/shadowsocksr-manyuser/" ]] && echo -e "${Error} Fallo la descompresi�n del servidor ShadowsocksR !" && rm -rf manyuser.zip && exit 1
+	# mv "/usr/local/shadowsocksr-manyuser/" "/usr/local/shadowsocksr/"
+	# [[ ! -e "/usr/local/shadowsocksr/" ]] && echo -e "${Error} Fallo el cambio de nombre del servidor ShadowsocksR!" && rm -rf manyuser.zip && rm -rf "/usr/local/shadowsocksr-manyuser/" && exit 1
+	# rm -rf manyuser.zip
+	cd "shadowsocksr"
+	cp "${ssr_folder}/config.json" "${config_user_file}"
+	cp "${ssr_folder}/mysql.json" "${ssr_folder}/usermysql.json"
+	cp "${ssr_folder}/apiconfig.py" "${config_user_api_file}"
+	[[ ! -e ${config_user_api_file} ]] && echo -e "${Error} Fallo la replicacion apiconfig.py del servidor ShadowsocksR!" && exit 1
+	sed -i "s/API_INTERFACE = 'sspanelv2'/API_INTERFACE = 'mudbjson'/" ${config_user_api_file}
+	server_pub_addr="127.0.0.1"
+	Modify_user_api_server_pub_addr
+	#sed -i "s/SERVER_PUB_ADDR = '127.0.0.1'/SERVER_PUB_ADDR = '${ip}'/" ${config_user_api_file}
+	sed -i 's/ \/\/ only works under multi-user mode//g' "${config_user_file}"
+	echo -e "${Info} Descarga del servidor ShadowsocksR completa!"
+}
+Service_SSR(){
+	if [[ ${release} = "centos" ]]; then
+		if ! wget --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/service/ssrmu_centos -O /etc/init.d/ssrmu; then
+			echo -e "${Error} Fallo la descarga de la secuencia de comandos de administracion de servicios de ShadowsocksR!" && exit 1
+		fi
+		chmod +x /etc/init.d/ssrmu
+		chkconfig --add ssrmu
+		chkconfig ssrmu on
+	else
+		if ! wget --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/service/ssrmu_debian -O /etc/init.d/ssrmu; then
+			echo -e "${Error} Fallo la descarga de la secuencia de comandos de administracion de servicio de ShadowsocksR!" && exit 1
+		fi
+		chmod +x /etc/init.d/ssrmu
+		update-rc.d -f ssrmu defaults
+	fi
+	echo -e "${Info} ShadowsocksR Service Management Script Descargar Descargar!"
+}
+#Instalar el analizador JQ
+JQ_install(){
+	if [[ ! -e ${jq_file} ]]; then
+		cd "${ssr_folder}"
+		if [[ ${bit} = "x86_64" ]]; then
+			# mv "jq-linux64" "jq"
+			wget --no-check-certificate "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64" -O ${jq_file}
+		else
+			# mv "jq-linux32" "jq"
+			wget --no-check-certificate "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux32" -O ${jq_file}
+		fi
+		[[ ! -e ${jq_file} ]] && echo -e "${Error} JQ parser, por favor!" && exit 1
+		chmod +x ${jq_file}
+		echo -e "${Info} La instalacion del analizador JQ se ha completado, continuar ..." 
+	else
+		echo -e "${Info} JQ parser esta instalado, continuar ..."
+	fi
+}
+#Instalacion
+Installation_dependency(){
+	if [[ ${release} == "centos" ]]; then
+		Centos_yum
+	else
+		Debian_apt
+	fi
+	[[ ! -e "/usr/bin/unzip" ]] && echo -e "${Error} Dependiente de la instalacion de descomprimir (paquete comprimido) fallo, en su mayoria problema, por favor verifique!" && exit 1
+	Check_python
+	#echo "nameserver 8.8.8.8" > /etc/resolv.conf
+	#echo "nameserver 8.8.4.4" >> /etc/resolv.conf
+	cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+	if [[ ${release} == "centos" ]]; then
+		/etc/init.d/crond restart
+	else
+		/etc/init.d/cron restart
+	fi
+}
+Install_SSR(){
+clear
+	check_root
+	msg -bar
+	[[ -e ${ssr_folder} ]] && echo -e "${Error}\nLa carpeta ShadowsocksR ha sido creada, por favor verifique\n(si la instalacion falla, desinstalela primero) !\n$(msg -bar)" && exit 1 
+	echo -e "${Info}\nComience la configuracion de la cuenta de ShadowsocksR..."
+msg -bar
+	Set_user_api_server_pub_addr
+	Set_config_all
+	echo -e "${Info} Comience a instalar / configurar las dependencias de ShadowsocksR ..."
+	Installation_dependency
+	echo -e "${Info} Iniciar descarga / Instalar ShadowsocksR File ..."
+	Download_SSR
+	echo -e "${Info} Iniciar descarga / Instalar ShadowsocksR Service Script(init)..."
+	Service_SSR
+	echo -e "${Info} Iniciar descarga / instalar JSNO Parser JQ ..."
+	JQ_install
+	echo -e "${Info} Comience a agregar usuario inicial ..."
+	Add_port_user "install"
+	echo -e "${Info} Empezar a configurar el firewall de iptables ..."
+	Set_iptables
+	echo -e "${Info} Comience a agregar reglas de firewall de iptables ..."
+	Add_iptables
+	echo -e "${Info} Comience a guardar las reglas del servidor de seguridad de iptables ..."
+	Save_iptables
+	echo -e "${Info} Todos los pasos para iniciar el servicio ShadowsocksR ..."
+	Start_SSR
+	Get_User_info "${ssr_port}"
+	View_User_info
+
+}
+Update_SSR(){
+	SSR_installation_status
+	# echo -e "Debido a que el beb� roto actualiza el servidor ShadowsocksR, entonces."
+	cd ${ssr_folder}
+	git pull
+	Restart_SSR
+
+}
+Uninstall_SSR(){
+	[[ ! -e ${ssr_folder} ]] && echo -e "${Error} ShadowsocksR no esta instalado, por favor, compruebe!\n$(msg -bar)" && exit 1
+	echo "Desinstalar ShadowsocksR [y/n]"
+msg -bar 
+	stty erase '^H' && read -p "(Predeterminado: n):" unyn
+msg -bar
+	[[ -z ${unyn} ]] && unyn="n"
+	if [[ ${unyn} == [Yy] ]]; then
+		check_pid
+		[[ ! -z "${PID}" ]] && kill -9 ${PID}
+		user_info=$(python mujson_mgr.py -l)
+		user_total=$(echo "${user_info}"|wc -l)
+		if [[ ! -z ${user_info} ]]; then
+			for((integer = 1; integer <= ${user_total}; integer++))
+			do
+				port=$(echo "${user_info}"|sed -n "${integer}p"|awk '{print $4}')
+				Del_iptables
+			done
+		fi
+		if [[ ${release} = "centos" ]]; then
+			chkconfig --del ssrmu
+		else
+			update-rc.d -f ssrmu remove
+		fi
+		rm -rf ${ssr_folder} && rm -rf /etc/init.d/ssrmu
+		echo && echo " Desinstalacion de ShadowsocksR completada!" && echo
+	else
+		echo && echo "Desinstalar cancelado ..." && echo
+	fi
+
+}
+Check_Libsodium_ver(){
+	echo -e "${Info} Descargando la ultima version de libsodium"
+	#Libsodiumr_ver=$(wget -qO- "https://github.com/jedisct1/libsodium/tags"|grep "/jedisct1/libsodium/releases/tag/"|head -1|sed -r 's/.*tag\/(.+)\">.*/\1/')
+	Libsodiumr_ver=1.0.17
+	[[ -z ${Libsodiumr_ver} ]] && Libsodiumr_ver=${Libsodiumr_ver_backup}
+	echo -e "${Info} La ultima version de libsodium es ${Green_font_prefix}${Libsodiumr_ver}${Font_color_suffix} !"
+}
+Install_Libsodium(){
+	if [[ -e ${Libsodiumr_file} ]]; then
+		echo -e "${Error} libsodium ya instalado, quieres actualizar?[y/N]"
+		stty erase '^H' && read -p "(Default: n):" yn
+		[[ -z ${yn} ]] && yn="n"
+		if [[ ${yn} == [Nn] ]]; then
+			echo -e "Cancelado...\n$(msg -bar)" && exit 1
+		fi
+	else
+		echo -e "${Info} libsodium no instalado, instalacion iniciada ..."
+	fi
+	Check_Libsodium_ver
+	if [[ ${release} == "centos" ]]; then
+		yum -y actualizacion
+		echo -e "${Info} La instalacion depende de ..."
+		yum -y groupinstall "Herramientas de desarrollo"
+		echo -e "${Info} Descargar ..."
+		wget  --no-check-certificate -N "https://github.com/jedisct1/libsodium/releases/download/${Libsodiumr_ver}/libsodium-${Libsodiumr_ver}.tar.gz"
+		echo -e "${Info} Descomprimir ..."
+		tar -xzf libsodium-${Libsodiumr_ver}.tar.gz && cd libsodium-${Libsodiumr_ver}
+		echo -e "${Info} Compilar e instalar ..."
+		./configure --disable-maintainer-mode && make -j2 && make install
+		echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
+	else
+		apt-get update
+		echo -e "${Info} La instalacion depende de ..."
+		apt-get install -y build-essential
+		echo -e "${Info} Descargar ..."
+		wget  --no-check-certificate -N "https://github.com/jedisct1/libsodium/releases/download/${Libsodiumr_ver}/libsodium-${Libsodiumr_ver}.tar.gz"
+		echo -e "${Info} Descomprimir ..."
+		tar -xzf libsodium-${Libsodiumr_ver}.tar.gz && cd libsodium-${Libsodiumr_ver}
+		echo -e "${Info} Compilar e instalar ..."
+		./configure --disable-maintainer-mode && make -j2 && make install
+	fi
+	ldconfig
+	cd .. && rm -rf libsodium-${Libsodiumr_ver}.tar.gz && rm -rf libsodium-${Libsodiumr_ver}
+	[[ ! -e ${Libsodiumr_file} ]] && echo -e "${Error} libsodium Instalacion fallida!" && exit 1
+	echo && echo -e "${Info} libsodium exito de instalacion!" && echo
+msg -bar
+}
+#Mostrar informaci�n de conexi�n
+debian_View_user_connection_info(){
+	format_1=$1
+	user_info=$(python mujson_mgr.py -l)
+	user_total=$(echo "${user_info}"|wc -l)
+	[[ -z ${user_info} ]] && echo -e "${Error} No encontro, por favor compruebe!" && exit 1
+	IP_total=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp6' |awk '{print $5}' |awk -F ":" '{print $1}' |sort -u |wc -l`
+	user_list_all=""
+	for((integer = 1; integer <= ${user_total}; integer++))
+	do
+		user_port=$(echo "${user_info}"|sed -n "${integer}p"|awk '{print $4}')
+		user_IP_1=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp6' |grep ":${user_port} " |awk '{print $5}' |awk -F ":" '{print $1}' |sort -u`
+		if [[ -z ${user_IP_1} ]]; then
+			user_IP_total="0"
+		else
+			user_IP_total=`echo -e "${user_IP_1}"|wc -l`
+			if [[ ${format_1} == "IP_address" ]]; then
+				get_IP_address
+			else
+				user_IP=`echo -e "\n${user_IP_1}"`
+			fi
+		fi
+		user_list_all=${user_list_all}"Puerto: ${Green_font_prefix}"${user_port}"${Font_color_suffix}, El numero total de IPs vinculadas: ${Green_font_prefix}"${user_IP_total}"${Font_color_suffix}, Current linked IP: ${Green_font_prefix}${user_IP}${Font_color_suffix}\n"
+		user_IP=""
+	done
+	echo -e "Numero total de usuarios: ${Green_background_prefix} "${user_total}" ${Font_color_suffix} Numero total de IPs vinculadas: ${Green_background_prefix} "${IP_total}" ${Font_color_suffix}\n"
+	echo -e "${user_list_all}"
+msg -bar 
+}
+centos_View_user_connection_info(){
+	format_1=$1
+	user_info=$(python mujson_mgr.py -l)
+	user_total=$(echo "${user_info}"|wc -l)
+	[[ -z ${user_info} ]] && echo -e "${Error} No encontrado, por favor revise!" && exit 1
+	IP_total=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp' | grep '::ffff:' |awk '{print $5}' |awk -F ":" '{print $4}' |sort -u |wc -l`
+	user_list_all=""
+	for((integer = 1; integer <= ${user_total}; integer++))
+	do
+		user_port=$(echo "${user_info}"|sed -n "${integer}p"|awk '{print $4}')
+		user_IP_1=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp' |grep ":${user_port} "|grep '::ffff:' |awk '{print $5}' |awk -F ":" '{print $4}' |sort -u`
+		if [[ -z ${user_IP_1} ]]; then
+			user_IP_total="0"
+		else
+			user_IP_total=`echo -e "${user_IP_1}"|wc -l`
+			if [[ ${format_1} == "IP_address" ]]; then
+				get_IP_address
+			else
+				user_IP=`echo -e "\n${user_IP_1}"`
+			fi
+		fi
+		user_list_all=${user_list_all}"Puerto: ${Green_font_prefix}"${user_port}"${Font_color_suffix}, El numero total de IPs vinculadas: ${Green_font_prefix}"${user_IP_total}"${Font_color_suffix}, Current linked IP: ${Green_font_prefix}${user_IP}${Font_color_suffix}\n"
+		user_IP=""
+	done
+	echo -e "El numero total de usuarios: ${Green_background_prefix} "${user_total}" ${Font_color_suffix} El numero total de IPs vinculadas: ${Green_background_prefix} "${IP_total}" ${Font_color_suffix} "
+	echo -e "${user_list_all}"
+}
+View_user_connection_info(){
+clear
+	SSR_installation_status
+	msg -bar
+	 echo -e "Seleccione el formato para mostrar :
+$(msg -bar)
+ ${Green_font_prefix}1.${Font_color_suffix} Mostrar IP 
+
+ ${Green_font_prefix}2.${Font_color_suffix} Mostrar IP + Resolver el nombre DNS"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: 1):" ssr_connection_info
+msg -bar
+	[[ -z "${ssr_connection_info}" ]] && ssr_connection_info="1"
+	if [[ ${ssr_connection_info} == "1" ]]; then
+		View_user_connection_info_1 ""
+	elif [[ ${ssr_connection_info} == "2" ]]; then
+		echo -e "${Tip} Detectar IP (ipip.net)puede llevar mas tiempo si hay muchas IPs"
+msg -bar
+		View_user_connection_info_1 "IP_address"
+	else
+		echo -e "${Error} Ingrese el numero correcto(1-2)" && exit 1
+	fi
+}
+View_user_connection_info_1(){
+	format=$1
+	if [[ ${release} = "centos" ]]; then
+		cat /etc/redhat-release |grep 7\..*|grep -i centos>/dev/null
+		if [[ $? = 0 ]]; then
+			debian_View_user_connection_info "$format"
+		else
+			centos_View_user_connection_info "$format"
+		fi
+	else
+		debian_View_user_connection_info "$format"
+	fi
+}
+get_IP_address(){
+	#echo "user_IP_1=${user_IP_1}"
+	if [[ ! -z ${user_IP_1} ]]; then
+	#echo "user_IP_total=${user_IP_total}"
+		for((integer_1 = ${user_IP_total}; integer_1 >= 1; integer_1--))
+		do
+			IP=`echo "${user_IP_1}" |sed -n "$integer_1"p`
+			#echo "IP=${IP}"
+			IP_address=`wget -qO- -t1 -T2 http://freeapi.ipip.net/${IP}|sed 's/\"//g;s/,//g;s/\[//g;s/\]//g'`
+			#echo "IP_address=${IP_address}"
+			user_IP="${user_IP}\n${IP}(${IP_address})"
+			#echo "user_IP=${user_IP}"
+			sleep 1s
+		done
+	fi
+}
+#Modificar la configuraci�n del usuario
+Modify_port(){
+msg -bar
+	List_port_user
+	while true
+	do
+		echo -e "Por favor ingrese el usuario (Puerto) que tiene que ser modificado" 
+msg -bar
+		stty erase '^H' && read -p "(Predeterminado: cancelar):" ssr_port
+		[[ -z "${ssr_port}" ]] && echo -e "Cancelado ...\n$(msg -bar)" && exit 1
+		Modify_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${ssr_port}"',')
+		if [[ ! -z ${Modify_user} ]]; then
+			break
+		else
+			echo -e "${Error} Puerto Introduzca el Puerto correcto!"
+		fi
+	done
+}
+Modify_Config(){
+clear
+	SSR_installation_status
+	echo && echo -e "    ###¿Que desea realizar?###
+$(msg -bar)
+ ${Green_font_prefix}1.${Font_color_suffix}  Agregar y Configurar Usuario
+ ${Green_font_prefix}2.${Font_color_suffix}  Eliminar la Configuracion del Usuario
+————————— Modificar la Configuracion del Usuario ————
+ ${Green_font_prefix}3.${Font_color_suffix}  Modificar contrasena de Usuario
+ ${Green_font_prefix}4.${Font_color_suffix}  Modificar el metodo de Cifrado
+ ${Green_font_prefix}5.${Font_color_suffix}  Modificar el Protocolo
+ ${Green_font_prefix}6.${Font_color_suffix}  Modificar Ofuscacion
+ ${Green_font_prefix}7.${Font_color_suffix}  Modificar el Limite de Dispositivos
+ ${Green_font_prefix}8.${Font_color_suffix}  Modificar el Limite de Velocidad de un solo Hilo
+ ${Green_font_prefix}9.${Font_color_suffix}  Modificar limite de Velocidad Total del Usuario
+ ${Green_font_prefix}10.${Font_color_suffix} Modificar el Trafico Total del Usuario
+ ${Green_font_prefix}11.${Font_color_suffix} Modificar los Puertos Prohibidos Del usuario
+ ${Green_font_prefix}12.${Font_color_suffix} Modificar la Configuracion Completa
+————————— Otras Configuraciones —————————
+ ${Green_font_prefix}13.${Font_color_suffix} Modificar la IP o el nombre de dominio que\n se muestra en el perfil del usuario
+$(msg -bar)
+ ${Tip} El nombre de usuario y el puerto del usuario\n no se pueden modificar. Si necesita modificarlos, use\n el script para modificar manualmente la funcion !"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: cancelar):" ssr_modify
+	[[ -z "${ssr_modify}" ]] && echo -e "Cancelado ...\n$(msg -bar)" && exit 1
+	if [[ ${ssr_modify} == "1" ]]; then
+		Add_port_user
+	elif [[ ${ssr_modify} == "2" ]]; then
+		Del_port_user
+	elif [[ ${ssr_modify} == "3" ]]; then
+		Modify_port
+		Set_config_password
+		Modify_config_password
+	elif [[ ${ssr_modify} == "4" ]]; then
+		Modify_port
+		Set_config_method
+		Modify_config_method
+	elif [[ ${ssr_modify} == "5" ]]; then
+		Modify_port
+		Set_config_protocol
+		Modify_config_protocol
+	elif [[ ${ssr_modify} == "6" ]]; then
+		Modify_port
+		Set_config_obfs
+		Modify_config_obfs
+	elif [[ ${ssr_modify} == "7" ]]; then
+		Modify_port
+		Set_config_protocol_param
+		Modify_config_protocol_param
+	elif [[ ${ssr_modify} == "8" ]]; then
+		Modify_port
+		Set_config_speed_limit_per_con
+		Modify_config_speed_limit_per_con
+	elif [[ ${ssr_modify} == "9" ]]; then
+		Modify_port
+		Set_config_speed_limit_per_user
+		Modify_config_speed_limit_per_user
+	elif [[ ${ssr_modify} == "10" ]]; then
+		Modify_port
+		Set_config_transfer
+		Modify_config_transfer
+	elif [[ ${ssr_modify} == "11" ]]; then
+		Modify_port
+		Set_config_forbid
+		Modify_config_forbid
+	elif [[ ${ssr_modify} == "12" ]]; then
+		Modify_port
+		Set_config_all "Modify"
+		Modify_config_all
+	elif [[ ${ssr_modify} == "13" ]]; then
+		Set_user_api_server_pub_addr "Modify"
+		Modify_user_api_server_pub_addr
+	else
+		echo -e "${Error} Ingrese el numero correcto(1-13)" && exit 1
+	fi
+
+}
+List_port_user(){
+	user_info=$(python mujson_mgr.py -l)
+	user_total=$(echo "${user_info}"|wc -l)
+	[[ -z ${user_info} ]] && echo -e "${Error} No encontre al usuario, por favor verifica otra vez!" && exit 1
+	user_list_all=""
+	for((integer = 1; integer <= ${user_total}; integer++))
+	do
+		user_port=$(echo "${user_info}"|sed -n "${integer}p"|awk '{print $4}')
+		user_username=$(echo "${user_info}"|sed -n "${integer}p"|awk '{print $2}'|sed 's/\[//g;s/\]//g')
+		Get_User_transfer "${user_port}"
+		
+		user_list_all=${user_list_all}"Nombre de usuario: ${Green_font_prefix} "${user_username}"${Font_color_suffix}\nPort: ${Green_font_prefix}"${user_port}"${Font_color_suffix}\nUso del trafico (Usado + Restante = Total):\n ${Green_font_prefix}${transfer_enable_Used_2}${Font_color_suffix} + ${Green_font_prefix}${transfer_enable_Used}${Font_color_suffix} = ${Green_font_prefix}${transfer_enable}${Font_color_suffix}\n--------------------------------------------\n "
+	done
+	echo && echo -e "===== El numero total de usuarios ===== ${Green_background_prefix} "${user_total}" ${Font_color_suffix}\n--------------------------------------------"
+	echo -e ${user_list_all}
+}
+Add_port_user(){
+clear
+	lalal=$1
+	if [[ "$lalal" == "install" ]]; then
+		match_add=$(python mujson_mgr.py -a -u "${ssr_user}" -p "${ssr_port}" -k "${ssr_password}" -m "${ssr_method}" -O "${ssr_protocol}" -G "${ssr_protocol_param}" -o "${ssr_obfs}" -s "${ssr_speed_limit_per_con}" -S "${ssr_speed_limit_per_user}" -t "${ssr_transfer}" -f "${ssr_forbid}"|grep -w "add user info")
+	else
+		while true
+		do
+			Set_config_all
+			match_port=$(python mujson_mgr.py -l|grep -w "port ${ssr_port}$")
+			[[ ! -z "${match_port}" ]] && echo -e "${Error} El puerto [${ssr_port}] Ya existe, no lo agregue de nuevo !" && exit 1
+			match_username=$(python mujson_mgr.py -l|grep -w "Usuario \[${ssr_user}]")
+			[[ ! -z "${match_username}" ]] && echo -e "${Error} Nombre de usuario [${ssr_user}] Ya existe, no lo agregues de nuevo !" && exit 1
+			match_add=$(python mujson_mgr.py -a -u "${ssr_user}" -p "${ssr_port}" -k "${ssr_password}" -m "${ssr_method}" -O "${ssr_protocol}" -G "${ssr_protocol_param}" -o "${ssr_obfs}" -s "${ssr_speed_limit_per_con}" -S "${ssr_speed_limit_per_user}" -t "${ssr_transfer}" -f "${ssr_forbid}"|grep -w "add user info")
+			if [[ -z "${match_add}" ]]; then
+				echo -e "${Error} Usuario no se pudo agregar ${Green_font_prefix}[Nombre de usuario: ${ssr_user} , port: ${ssr_port}]${Font_color_suffix} "
+				break
+			else
+				Add_iptables
+				Save_iptables
+				msg -bar
+				echo -e "${Info} Usuario agregado exitosamente\n ${Green_font_prefix}[Nombre de usuario: ${ssr_user} , Puerto: ${ssr_port}]${Font_color_suffix} "
+				echo
+				stty erase '^H' && read -p "Continuar para agregar otro Usuario?[y/n]:" addyn
+				[[ -z ${addyn} ]] && addyn="y"
+				if [[ ${addyn} == [Nn] ]]; then
+					Get_User_info "${ssr_port}"
+					View_User_info
+					break
+				else
+					echo -e "${Info} Continuar agregando configuracion de usuario ..."
+				fi
+			fi
+		done
+	fi
+}
+Del_port_user(){
+
+	List_port_user
+	while true
+	do
+		msg -bar
+		echo -e "Por favor ingrese el puerto de usuario para ser eliminado"
+		stty erase '^H' && read -p "(Predeterminado: Cancelar):" del_user_port
+		msg -bar
+		[[ -z "${del_user_port}" ]] && echo -e "Cancelado...\n$(msg -bar)" && exit 1
+		del_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${del_user_port}"',')
+		if [[ ! -z ${del_user} ]]; then
+			port=${del_user_port}
+			match_del=$(python mujson_mgr.py -d -p "${del_user_port}"|grep -w "delete user ")
+			if [[ -z "${match_del}" ]]; then
+				echo -e "${Error} La eliminación del usuario falló ${Green_font_prefix}[Puerto: ${del_user_port}]${Font_color_suffix} "
+			else
+				Del_iptables
+				Save_iptables
+				echo -e "${Info} Usuario eliminado exitosamente ${Green_font_prefix}[Puerto: ${del_user_port}]${Font_color_suffix} "
+			fi
+			break
+		else
+			echo -e "${Error} Por favor ingrese el puerto correcto !"
+		fi
+	done
+	msg -bar
+}
+Manually_Modify_Config(){
+clear
+msg -bar
+	SSR_installation_status
+	nano ${config_user_mudb_file}
+	echo "Si reiniciar ShadowsocksR ahora?[Y/n]" && echo
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: y):" yn
+	[[ -z ${yn} ]] && yn="y"
+	if [[ ${yn} == [Yy] ]]; then
+		Restart_SSR
+	fi
+
+}
+Clear_transfer(){
+clear
+msg -bar
+	SSR_installation_status
+	 echo -e "Que quieres realizar?
+$(msg -bar)
+ ${Green_font_prefix}1.${Font_color_suffix}  Borrar el trafico de un solo usuario
+ ${Green_font_prefix}2.${Font_color_suffix}  Borrar todo el trafico de usuarios (irreparable)
+ ${Green_font_prefix}3.${Font_color_suffix}  Todo el trafico de usuarios se borra en el inicio
+ ${Green_font_prefix}4.${Font_color_suffix}  Deja de cronometrar todo el trafico de usuarios
+ ${Green_font_prefix}5.${Font_color_suffix}  Modificar la sincronizacion de todo el trafico de usuarios"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado:Cancelar):" ssr_modify
+	[[ -z "${ssr_modify}" ]] && echo "Cancelado ..." && exit 1
+	if [[ ${ssr_modify} == "1" ]]; then
+		Clear_transfer_one
+	elif [[ ${ssr_modify} == "2" ]]; then
+msg -bar
+		echo "Esta seguro de que desea borrar todo el trafico de usuario[y/n]" && echo
+msg -bar
+		stty erase '^H' && read -p "(Predeterminado: n):" yn
+		[[ -z ${yn} ]] && yn="n"
+		if [[ ${yn} == [Yy] ]]; then
+			Clear_transfer_all
+		else
+			echo "Cancelar ..."
+		fi
+	elif [[ ${ssr_modify} == "3" ]]; then
+		check_crontab
+		Set_crontab
+		Clear_transfer_all_cron_start
+	elif [[ ${ssr_modify} == "4" ]]; then
+		check_crontab
+		Clear_transfer_all_cron_stop
+	elif [[ ${ssr_modify} == "5" ]]; then
+		check_crontab
+		Clear_transfer_all_cron_modify
+	else
+		echo -e "${Error} Por favor numero de (1-5)" && exit 1
+	fi
+
+}
+Clear_transfer_one(){
+	List_port_user
+	while true
+	do
+	    msg -bar
+		echo -e "Por favor ingrese el puerto de usuario para borrar el tráfico usado"
+		stty erase '^H' && read -p "(Predeterminado: Cancelar):" Clear_transfer_user_port
+		[[ -z "${Clear_transfer_user_port}" ]] && echo -e "Cancelado...\n$(msg -bar)" && exit 1
+		Clear_transfer_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${Clear_transfer_user_port}"',')
+		if [[ ! -z ${Clear_transfer_user} ]]; then
+			match_clear=$(python mujson_mgr.py -c -p "${Clear_transfer_user_port}"|grep -w "clear user ")
+			if [[ -z "${match_clear}" ]]; then
+				echo -e "${Error} El usuario no ha podido utilizar la compensación de tráfico ${Green_font_prefix}[Puerto: ${Clear_transfer_user_port}]${Font_color_suffix} "
+			else
+				echo -e "${Info} El usuario ha eliminado con éxito el tráfico utilizando cero. ${Green_font_prefix}[Puerto: ${Clear_transfer_user_port}]${Font_color_suffix} "
+			fi
+			break
+		else
+			echo -e "${Error} Por favor ingrese el puerto correcto !"
+		fi
+	done
+}
+Clear_transfer_all(){
+clear
+	cd "${ssr_folder}"
+	user_info=$(python mujson_mgr.py -l)
+	user_total=$(echo "${user_info}"|wc -l)
+	[[ -z ${user_info} ]] && echo -e "${Error} No encontro, por favor compruebe!" && exit 1
+	for((integer = 1; integer <= ${user_total}; integer++))
+	do
+		user_port=$(echo "${user_info}"|sed -n "${integer}p"|awk '{print $4}')
+		match_clear=$(python mujson_mgr.py -c -p "${user_port}"|grep -w "clear user ")
+		if [[ -z "${match_clear}" ]]; then
+			echo -e "${Error} El usuario ha utilizado el trafico borrado fallido ${Green_font_prefix}[Port: ${user_port}]${Font_color_suffix} "
+		else
+			echo -e "${Info} El usuario ha utilizado el trafico para borrar con exito ${Green_font_prefix}[Port: ${user_port}]${Font_color_suffix} "
+		fi
+	done
+	echo -e "${Info} Se borra todo el trafico de usuarios!"
+}
+Clear_transfer_all_cron_start(){
+	crontab -l > "$file/crontab.bak"
+	sed -i "/ssrmu.sh/d" "$file/crontab.bak"
+	echo -e "\n${Crontab_time} /bin/bash $file/ssrmu.sh clearall" >> "$file/crontab.bak"
+	crontab "$file/crontab.bak"
+	rm -r "$file/crontab.bak"
+	cron_config=$(crontab -l | grep "ssrmu.sh")
+	if [[ -z ${cron_config} ]]; then
+		echo -e "${Error} Temporizacion de todo el trafico de usuarios borrado. !" && exit 1
+	else
+		echo -e "${Info} Programacion de todos los tiempos de inicio claro exitosos!"
+	fi
+}
+Clear_transfer_all_cron_stop(){
+	crontab -l > "$file/crontab.bak"
+	sed -i "/ssrmu.sh/d" "$file/crontab.bak"
+	crontab "$file/crontab.bak"
+	rm -r "$file/crontab.bak"
+	cron_config=$(crontab -l | grep "ssrmu.sh")
+	if [[ ! -z ${cron_config} ]]; then
+		echo -e "${Error} Temporizado Todo el trafico de usuarios se ha borrado Parado fallido!" && exit 1
+	else
+		echo -e "${Info} Timing All Clear Stop Stop Successful!!"
+	fi
+}
+Clear_transfer_all_cron_modify(){
+	Set_crontab
+	Clear_transfer_all_cron_stop
+	Clear_transfer_all_cron_start
+}
+Set_crontab(){
+clear
+
+		echo -e "Por favor ingrese el intervalo de tiempo de flujo
+ === Formato ===
+ * * * * * Mes * * * * *
+ ${Green_font_prefix} 0 2 1 * * ${Font_color_suffix} Representante 1er, 2:00, claro, trafico usado.
+$(msg -bar)
+ ${Green_font_prefix} 0 2 15 * * ${Font_color_suffix} Representativo El 1  2} representa el 15  2:00 minutos Punto de flujo usado despejado 0 minutos Borrar flujo usado�
+$(msg -bar)
+ ${Green_font_prefix} 0 2 */7 * * ${Font_color_suffix} Representante 7 dias 2: 0 minutos despeja el trafico usado.
+$(msg -bar)
+ ${Green_font_prefix} 0 2 * * 0 ${Font_color_suffix} Representa todos los domingos (7) para despejar el trafico utilizado.
+$(msg -bar)
+ ${Green_font_prefix} 0 2 * * 3 ${Font_color_suffix} Representante (3) Flujo de trafico usado despejado"
+msg -bar
+	stty erase '^H' && read -p "(Default: 0 2 1 * * 1 de cada mes 2:00):" Crontab_time
+	[[ -z "${Crontab_time}" ]] && Crontab_time="0 2 1 * *"
+}
+Start_SSR(){
+clear
+	SSR_installation_status
+	check_pid
+	[[ ! -z ${PID} ]] && echo -e "${Error} ShadowsocksR se esta ejecutando!" && exit 1
+	/etc/init.d/ssrmu start
+
+}
+Stop_SSR(){
+clear
+	SSR_installation_status
+	check_pid
+	[[ -z ${PID} ]] && echo -e "${Error} ShadowsocksR no esta funcionando!" && exit 1
+	/etc/init.d/ssrmu stop
+
+}
+Restart_SSR(){
+clear
+	SSR_installation_status
+	check_pid
+	[[ ! -z ${PID} ]] && /etc/init.d/ssrmu stop
+	/etc/init.d/ssrmu start
+
+}
+View_Log(){
+	SSR_installation_status
+	[[ ! -e ${ssr_log_file} ]] && echo -e "${Error} El registro de ShadowsocksR no existe!" && exit 1
+	echo && echo -e "${Tip} Presione ${Red_font_prefix}Ctrl+C ${Font_color_suffix} Registro de registro de terminacion" && echo
+	tail -f ${ssr_log_file}
+
+}
+#Afilado
+Configure_Server_Speeder(){
+clear
+msg -bar
+	echo && echo -e "Que vas a hacer
+${BARRA1}
+ ${Green_font_prefix}1.${Font_color_suffix} Velocidad aguda
+$(msg -bar)
+ ${Green_font_prefix}2.${Font_color_suffix} Velocidad aguda
+————————
+ ${Green_font_prefix}3.${Font_color_suffix} Velocidad aguda
+$(msg -bar)
+ ${Green_font_prefix}4.${Font_color_suffix} Velocidad aguda
+$(msg -bar)
+ ${Green_font_prefix}5.${Font_color_suffix} Reinicie la velocidad aguda
+$(msg -bar)
+ ${Green_font_prefix}6.${Font_color_suffix} Estado agudo
+ $(msg -bar)
+ Nota: Sharp y LotServer no se pueden instalar / iniciar al mismo tiempo"
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: Cancelar):" server_speeder_num
+	[[ -z "${server_speeder_num}" ]] && echo "Cancelado ..." && exit 1
+	if [[ ${server_speeder_num} == "1" ]]; then
+		Install_ServerSpeeder
+	elif [[ ${server_speeder_num} == "2" ]]; then
+		Server_Speeder_installation_status
+		Uninstall_ServerSpeeder
+	elif [[ ${server_speeder_num} == "3" ]]; then
+		Server_Speeder_installation_status
+		${Server_Speeder_file} start
+		${Server_Speeder_file} status
+	elif [[ ${server_speeder_num} == "4" ]]; then
+		Server_Speeder_installation_status
+		${Server_Speeder_file} stop
+	elif [[ ${server_speeder_num} == "5" ]]; then
+		Server_Speeder_installation_status
+		${Server_Speeder_file} restart
+		${Server_Speeder_file} status
+	elif [[ ${server_speeder_num} == "6" ]]; then
+		Server_Speeder_installation_status
+		${Server_Speeder_file} status
+	else
+		echo -e "${Error} Por favor numero(1-6)" && exit 1
+	fi
+}
+Install_ServerSpeeder(){
+	[[ -e ${Server_Speeder_file} ]] && echo -e "${Error} Server Speeder esta instalado!" && exit 1
+	#Prestamo de la version feliz de 91yun.rog
+	wget --no-check-certificate -qO /tmp/serverspeeder.sh https://raw.githubusercontent.com/91yun/serverspeeder/master/serverspeeder.sh
+	[[ ! -e "/tmp/serverspeeder.sh" ]] && echo -e "${Error} Prestamo de la version feliz de 91yun.rog!" && exit 1
+	bash /tmp/serverspeeder.sh
+	sleep 2s
+	PID=`ps -ef |grep -v grep |grep "serverspeeder" |awk '{print $2}'`
+	if [[ ! -z ${PID} ]]; then
+		rm -rf /tmp/serverspeeder.sh
+		rm -rf /tmp/91yunserverspeeder
+		rm -rf /tmp/91yunserverspeeder.tar.gz
+		echo -e "${Info} La instalacion del servidor Speeder esta completa!" && exit 1
+	else
+		echo -e "${Error} Fallo la instalacion de Server Speeder!" && exit 1
+	fi
+}
+Uninstall_ServerSpeeder(){
+clear
+msg -bar
+	echo "yes para desinstalar Speed ??Speed ??(Server Speeder)[y/N]" && echo
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: n):" unyn
+	[[ -z ${unyn} ]] && echo && echo "Cancelado ..." && exit 1
+	if [[ ${unyn} == [Yy] ]]; then
+		chattr -i /serverspeeder/etc/apx*
+		/serverspeeder/bin/serverSpeeder.sh uninstall -f
+		echo && echo "Server Speeder Desinstalacion completa!" && echo
+	fi
+}
+# LotServer
+Configure_LotServer(){
+clear
+msg -bar
+	echo && echo -e "Que vas a hacer?
+$(msg -bar)
+ ${Green_font_prefix}1.${Font_color_suffix} Instalar LotServer
+$(msg -bar)
+ ${Green_font_prefix}2.${Font_color_suffix} Desinstalar LotServer
+————————
+ ${Green_font_prefix}3.${Font_color_suffix} Iniciar LotServer
+$(msg -bar)
+ ${Green_font_prefix}4.${Font_color_suffix} Detener LotServer
+$(msg -bar)
+ ${Green_font_prefix}5.${Font_color_suffix} Reiniciar LotServer
+$(msg -bar)
+ ${Green_font_prefix}6.${Font_color_suffix} Ver el estado de LotServer
+${BARRA1}
+ 
+ Nota: Sharp y LotServer no se pueden instalar / iniciar al mismo tiempo"
+msg -bar
+
+	stty erase '^H' && read -p "(Predeterminado: Cancelar):" lotserver_num
+	[[ -z "${lotserver_num}" ]] && echo "Cancelado ..." && exit 1
+	if [[ ${lotserver_num} == "1" ]]; then
+		Install_LotServer
+	elif [[ ${lotserver_num} == "2" ]]; then
+		LotServer_installation_status
+		Uninstall_LotServer
+	elif [[ ${lotserver_num} == "3" ]]; then
+		LotServer_installation_status
+		${LotServer_file} start
+		${LotServer_file} status
+	elif [[ ${lotserver_num} == "4" ]]; then
+		LotServer_installation_status
+		${LotServer_file} stop
+	elif [[ ${lotserver_num} == "5" ]]; then
+		LotServer_installation_status
+		${LotServer_file} restart
+		${LotServer_file} status
+	elif [[ ${lotserver_num} == "6" ]]; then
+		LotServer_installation_status
+		${LotServer_file} status
+	else
+		echo -e "${Error} Por favor numero(1-6)" && exit 1
+	fi
+}
+Install_LotServer(){
+	[[ -e ${LotServer_file} ]] && echo -e "${Error} LotServer esta instalado!" && exit 1
+	#Github: https://github.com/0oVicero0/serverSpeeder_Install
+	wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh"
+	[[ ! -e "/tmp/appex.sh" ]] && echo -e "${Error} Fallo la descarga del script de instalacion de LotServer!" && exit 1
+	bash /tmp/appex.sh 'install'
+	sleep 2s
+	PID=`ps -ef |grep -v grep |grep "appex" |awk '{print $2}'`
+	if [[ ! -z ${PID} ]]; then
+		echo -e "${Info} La instalacion de LotServer esta completa!" && exit 1
+	else
+		echo -e "${Error} Fallo la instalacion de LotServer!" && exit 1
+	fi
+}
+Uninstall_LotServer(){
+clear
+msg -bar
+	echo "Desinstalar Para desinstalar LotServer[y/N]" && echo
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: n):" unyn
+msg -bar
+	[[ -z ${unyn} ]] && echo && echo "Cancelado ..." && exit 1
+	if [[ ${unyn} == [Yy] ]]; then
+		wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh" && bash /tmp/appex.sh 'uninstall'
+		echo && echo "La desinstalacion de LotServer esta completa!" && echo
+	fi
+}
+# BBR
+Configure_BBR(){
+clear
+msg -bar
+ echo -e "  Que vas a hacer?
+$(msg -bar)	
+ ${Green_font_prefix}1.${Font_color_suffix} Instalar BBR
+————————
+${Green_font_prefix}2.${Font_color_suffix} Iniciar BBR
+${Green_font_prefix}3.${Font_color_suffix} Dejar de BBR
+${Green_font_prefix}4.${Font_color_suffix} Ver el estado de BBR"
+msg -bar
+echo -e "${Green_font_prefix} [Por favor, preste atencion antes de la instalacion] ${Font_color_suffix}
+$(msg -bar)
+1. Abra BBR, reemplace, hay un error de reemplazo (despues de reiniciar)
+2. Este script solo es compatible con los nucleos de reemplazo de Debian / Ubuntu. OpenVZ y Docker no admiten el reemplazo de los nucleos.
+3. Debian reemplaza el proceso del kernel [Desea finalizar el kernel de desinstalacion], seleccione ${Green_font_prefix} NO ${Font_color_suffix}"
+	stty erase '^H' && read -p "(Predeterminado: Cancelar):" bbr_num
+msg -bar
+	[[ -z "${bbr_num}" ]] && echo -e "Cancelado...\n$(msg -bar)" && exit 1
+	if [[ ${bbr_num} == "1" ]]; then
+		Install_BBR
+	elif [[ ${bbr_num} == "2" ]]; then
+		Start_BBR
+	elif [[ ${bbr_num} == "3" ]]; then
+		Stop_BBR
+	elif [[ ${bbr_num} == "4" ]]; then
+		Status_BBR
+	else
+		echo -e "${Error} Por favor numero(1-4)" && exit 1
+	fi
+}
+Install_BBR(){
+	[[ ${release} = "centos" ]] && echo -e "${Error} Este script de instalacion del sistema CentOS. BBR !" && exit 1
+	BBR_installation_status
+	bash "${BBR_file}"
+}
+Start_BBR(){
+	BBR_installation_status
+	bash "${BBR_file}" start
+}
+Stop_BBR(){
+	BBR_installation_status
+	bash "${BBR_file}" stop
+}
+Status_BBR(){
+	BBR_installation_status
+	bash "${BBR_file}" status
+}
+BackUP_ssrr(){
+clear
+msg -bar
+msg -ama "$(fun_trans "HERRAMIENTA DE BACKUP SS-SSRR -BETA")"
+msg -bar
+msg -azu "CREANDO BACKUP" "RESTAURAR BACKUP"
+msg -bar
+rm -rf /root/mudb.json > /dev/null 2>&1
+cp /usr/local/shadowsocksr/mudb.json /root/mudb.json > /dev/null 2>&1
+msg -azu "$(fun_trans "Procedimiento Hecho con Exito, Guardado en:")"
+echo -e "\033[1;31mBACKUP > [\033[1;32m/root/mudb.json\033[1;31m]"
+msg -bar
+}
+RestaurarBackUp_ssrr(){
+clear
+msg -bar
+msg -ama "$(fun_trans "HERRAMIENTA DE RESTAURACION SS-SSRR -BETA")"
+msg -bar
+msg -azu "Recuerde tener minimo una cuenta ya creada"
+msg -azu "Copie el archivo mudb.json en la carpeta /root"
+read -p "     ►► Presione enter para continuar ◄◄"
+msg -bar
+msg -azu "$(fun_trans "Procedimiento Hecho con Exito")"
+read -p "  ►► Presione enter para Reiniciar Panel SSRR ◄◄"
+msg -bar
+mv /root/mudb.json /usr/local/shadowsocksr/mudb.json
+Restart_SSR
+msg -bar
+}
+
+# Otros
+Other_functions(){
+clear
+msg -bar
+	echo && echo -e "  Que vas a realizar?
+$(msg -bar)
+  ${Green_font_prefix}1.${Font_color_suffix} Configurar BBR
+  ${Green_font_prefix}2.${Font_color_suffix} Velocidad de configuracion (ServerSpeeder)
+  ${Green_font_prefix}3.${Font_color_suffix} Configurar LotServer (Rising Parent)
+  ${Tip} Sharp / LotServer / BBR no es compatible con OpenVZ!
+  ${Tip} Speed y LotServer no pueden coexistir!
+————————————
+  ${Green_font_prefix}4.${Font_color_suffix} Llave de bloqueo BT/PT/SPAM (iptables)
+  ${Green_font_prefix}5.${Font_color_suffix} Llave de desbloqueo BT/PT/SPAM (iptables)
+————————————
+  ${Green_font_prefix}6.${Font_color_suffix} Cambiar modo de salida de registro ShadowsocksR
+  —— Modo bajo o verboso..
+  ${Green_font_prefix}7.${Font_color_suffix} Supervisar el estado de ejecucion del servidor ShadowsocksR
+  —— NOTA: Esta funcion es adecuada para que el servidor SSR finalice los procesos regulares. Una vez que esta funcion esta habilitada, sera detectada cada minuto. Cuando el proceso no existe, el servidor SSR se inicia automaticamente.
+———————————— 
+ ${Green_font_prefix}8.${Font_color_suffix} Backup SSRR
+ ${Green_font_prefix}9.${Font_color_suffix} Restaurar Backup" && echo
+msg -bar
+	stty erase '^H' && read -p "(Predeterminado: cancelar):" other_num
+	[[ -z "${other_num}" ]] && echo -e "Cancelado...\n$(msg -bar)" && exit 1
+	if [[ ${other_num} == "1" ]]; then
+		Configure_BBR
+	elif [[ ${other_num} == "2" ]]; then
+		Configure_Server_Speeder
+	elif [[ ${other_num} == "3" ]]; then
+		Configure_LotServer
+	elif [[ ${other_num} == "4" ]]; then
+		BanBTPTSPAM
+	elif [[ ${other_num} == "5" ]]; then
+		UnBanBTPTSPAM
+	elif [[ ${other_num} == "6" ]]; then
+		Set_config_connect_verbose_info
+	elif [[ ${other_num} == "7" ]]; then
+		Set_crontab_monitor_ssr
+	elif [[ ${other_num} == "8" ]]; then
+		BackUP_ssrr
+	elif [[ ${other_num} == "9" ]]; then
+		RestaurarBackUp_ssrr
+	else
+		echo -e "${Error} Por favor numero [1-9]" && exit 1
+	fi
+
+}
+#Prohibido�BT PT SPAM
+BanBTPTSPAM(){
+	wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ban_iptables.sh && chmod +x ban_iptables.sh && bash ban_iptables.sh banall
+	rm -rf ban_iptables.sh
+}
+#Desbloquear BT PT SPAM
+UnBanBTPTSPAM(){
+	wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ban_iptables.sh && chmod +x ban_iptables.sh && bash ban_iptables.sh unbanall
+	rm -rf ban_iptables.sh
+}
+Set_config_connect_verbose_info(){
+clear
+msg -bar
+	SSR_installation_status
+	[[ ! -e ${jq_file} ]] && echo -e "${Error} JQ parser No, por favor, compruebe!" && exit 1
+	connect_verbose_info=`${jq_file} '.connect_verbose_info' ${config_user_file}`
+	if [[ ${connect_verbose_info} = "0" ]]; then
+		echo && echo -e "Modo de registro actual: ${Green_font_prefix}Registro de errores en modo simple${Font_color_suffix}"
+msg -bar
+		echo -e "yes para cambiar a ${Green_font_prefix}Modo detallado (registro de conexi�n + registro de errores)${Font_color_suffix}?[y/N]"
+msg -bar
+		stty erase '^H' && read -p "(Predeterminado: n):" connect_verbose_info_ny
+		[[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n"
+		if [[ ${connect_verbose_info_ny} == [Yy] ]]; then
+			ssr_connect_verbose_info="1"
+			Modify_config_connect_verbose_info
+			Restart_SSR
+		else
+			echo && echo "	Cancelado ..." && echo
+		fi
+	else
+		echo && echo -e "Modo de registro actual: ${Green_font_prefix}Modo detallado (conexion de conexion + registro de errores)${Font_color_suffix}"
+msg -bar
+		echo -e "yes para cambiar a ${Green_font_prefix}Modo simple ${Font_color_suffix}?[y/N]"
+		stty erase '^H' && read -p "(Predeterminado: n):" connect_verbose_info_ny
+		[[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n"
+		if [[ ${connect_verbose_info_ny} == [Yy] ]]; then
+			ssr_connect_verbose_info="0"
+			Modify_config_connect_verbose_info
+			Restart_SSR
+		else
+			echo && echo "	Cancelado ..." && echo
+		fi
+	fi
+}
+Set_crontab_monitor_ssr(){
+clear
+msg -bar
+	SSR_installation_status
+	crontab_monitor_ssr_status=$(crontab -l|grep "ssrmu.sh monitor")
+	if [[ -z "${crontab_monitor_ssr_status}" ]]; then
+		echo && echo -e "Modo de monitoreo actual: ${Green_font_prefix}No monitoreado${Font_color_suffix}"
+msg -bar
+		echo -e "Ok para abrir ${Green_font_prefix}Servidor ShadowsocksR ejecutando monitoreo de estado${Font_color_suffix} Funcion? (Cuando el proceso R lado SSR R)[Y/n]"
+msg -bar
+		stty erase '^H' && read -p "(Predeterminado: y):" crontab_monitor_ssr_status_ny
+		[[ -z "${crontab_monitor_ssr_status_ny}" ]] && crontab_monitor_ssr_status_ny="y"
+		if [[ ${crontab_monitor_ssr_status_ny} == [Yy] ]]; then
+			crontab_monitor_ssr_cron_start
+		else
+			echo && echo "	Cancelado ..." && echo
+		fi
+	else
+		echo && echo -e "Modo de monitoreo actual: ${Green_font_prefix}Abierto${Font_color_suffix}"
+msg -bar
+		echo -e "Ok para apagar ${Green_font_prefix}Servidor ShadowsocksR ejecutando monitoreo de estado${Font_color_suffix} Funcion? (procesar servidor SSR)[y/N]"
+msg -bar
+		stty erase '^H' && read -p "(Predeterminado: n):" crontab_monitor_ssr_status_ny
+		[[ -z "${crontab_monitor_ssr_status_ny}" ]] && crontab_monitor_ssr_status_ny="n"
+		if [[ ${crontab_monitor_ssr_status_ny} == [Yy] ]]; then
+			crontab_monitor_ssr_cron_stop
+		else
+			echo && echo "	Cancelado ..." && echo
+		fi
+	fi
+}
+crontab_monitor_ssr(){
+	SSR_installation_status
+	check_pid
+	if [[ -z ${PID} ]]; then
+		echo -e "${Error} [$(date "+%Y-%m-%d %H:%M:%S %u %Z")] Detectado que el servidor ShadowsocksR no esta iniciado, inicie..." | tee -a ${ssr_log_file}
+		/etc/init.d/ssrmu start
+		sleep 1s
+		check_pid
+		if [[ -z ${PID} ]]; then
+			echo -e "${Error} [$(date "+%Y-%m-%d %H:%M:%S %u %Z")] Fallo el inicio del servidor ShadowsocksR..." | tee -a ${ssr_log_file} && exit 1
+		else
+			echo -e "${Info} [$(date "+%Y-%m-%d %H:%M:%S %u %Z")] Inicio de inicio del servidor ShadowsocksR..." | tee -a ${ssr_log_file} && exit 1
+		fi
+	else
+		echo -e "${Info} [$(date "+%Y-%m-%d %H:%M:%S %u %Z")] El proceso del servidor ShadowsocksR se ejecuta normalmente..." exit 0
+	fi
+}
+crontab_monitor_ssr_cron_start(){
+	crontab -l > "$file/crontab.bak"
+	sed -i "/ssrmu.sh monitor/d" "$file/crontab.bak"
+	echo -e "\n* * * * * /bin/bash $file/ssrmu.sh monitor" >> "$file/crontab.bak"
+	crontab "$file/crontab.bak"
+	rm -r "$file/crontab.bak"
+	cron_config=$(crontab -l | grep "ssrmu.sh monitor")
+	if [[ -z ${cron_config} ]]; then
+		echo -e "${Error} Fallo el arranque del servidor ShadowsocksR!" && exit 1
+	else
+		echo -e "${Info} El servidor ShadowsocksR esta ejecutando la monitorizacion del estado con exito!"
+	fi
+}
+crontab_monitor_ssr_cron_stop(){
+	crontab -l > "$file/crontab.bak"
+	sed -i "/ssrmu.sh monitor/d" "$file/crontab.bak"
+	crontab "$file/crontab.bak"
+	rm -r "$file/crontab.bak"
+	cron_config=$(crontab -l | grep "ssrmu.sh monitor")
+	if [[ ! -z ${cron_config} ]]; then
+		echo -e "${Error} Fallo la detencion del servidor ShadowsocksR!" && exit 1
+	else
+		echo -e "${Info} La supervision del estado de ejecucion del servidor de ShadowsocksR se detiene correctamente!"
+	fi
+}
+Update_Shell(){
+clear
+msg -bar
+	echo -e "La version actual es [ ${sh_ver} ], Comienza a detectar la ultima version ..."
+	sh_new_ver=$(wget --no-check-certificate -qO- "https://raw.githubusercontent.com/hybtoy/ssrrmu/master/ssrrmu.sh"|grep 'sh_ver="'|awk -F "=" '{print $NF}'|sed 's/\"//g'|head -1) && sh_new_type="github"
+	[[ -z ${sh_new_ver} ]] && sh_new_ver=$(wget --no-check-certificate -qO- "https://raw.githubusercontent.com/hybtoy/ssrrmu/master/ssrrmu.sh"|grep 'sh_ver="'|awk -F "=" '{print $NF}'|sed 's/\"//g'|head -1) && sh_new_type="github"
+	[[ -z ${sh_new_ver} ]] && echo -e "${Error} Ultima version de deteccion !" && exit 0
+	if [[ ${sh_new_ver} != ${sh_ver} ]]; then
+		echo -e "Descubrir nueva version[ ${sh_new_ver} ], Esta actualizado?[Y/n]"
+msg -bar
+		stty erase '^H' && read -p "(Predeterminado: y):" yn
+		[[ -z "${yn}" ]] && yn="y"
+		if [[ ${yn} == [Yy] ]]; then
+			cd "${file}"
+			if [[ $sh_new_type == "github" ]]; then
+				wget -N --no-check-certificate https://raw.githubusercontent.com/hybtoy/ssrrmu/master/ssrrmu.sh && chmod +x ssrrmu.sh
+			fi
+			echo -e "El script ha sido actualizado a la ultima version.[ ${sh_new_ver} ] !"
+		else
+			echo && echo "	Cancelado ..." && echo
+		fi
+	else
+		echo -e "Actualmente es la ultima version.[ ${sh_new_ver} ] !"
+	fi
+	exit 0
+
+}
+# Mostrar el estado del menu
+menu_status(){
+msg -bar
+	if [[ -e ${ssr_folder} ]]; then
+		check_pid
+		if [[ ! -z "${PID}" ]]; then
+			echo -e "         VPS-MX \n Estado actual: ${Green_font_prefix}Instalado${Font_color_suffix} y ${Green_font_prefix}Iniciado${Font_color_suffix}"
+		else
+			echo -e " Estado actual: ${Green_font_prefix}Instalado${Font_color_suffix} pero ${Red_font_prefix}no comenzo${Font_color_suffix}"
+		fi
+		cd "${ssr_folder}"
+	else
+		echo -e " Estado actual: ${Red_font_prefix}No Instalado${Font_color_suffix}"
+	fi
+}
+check_sys
+[[ ${release} != "debian" ]] && [[ ${release} != "ubuntu" ]] && [[ ${release} != "centos" ]] && echo -e "${Error} el script no es compatible con el sistema actual ${release} !" && exit 1
+action=$1
+if [[ "${action}" == "clearall" ]]; then
+	Clear_transfer_all
+elif [[ "${action}" == "monitor" ]]; then
+	crontab_monitor_ssr
+else
+
+echo -e "$(msg -tit) " 
+echo -e "        Controlador de ShadowSock-R  ${Red_font_prefix}[v${sh_ver}]${Font_color_suffix}
+$(msg -bar)
+  ${Green_font_prefix}1.${Font_color_suffix} Instalar ShadowsocksR 
+  ${Green_font_prefix}2.${Font_color_suffix} Actualizar ShadowsocksR
+  ${Green_font_prefix}3.${Font_color_suffix} Desinstalar ShadowsocksR
+  ${Green_font_prefix}4.${Font_color_suffix} Instalar libsodium (chacha20)
+—————————————
+  ${Green_font_prefix}5.${Font_color_suffix} Verifique la informacion de la cuenta
+  ${Green_font_prefix}6.${Font_color_suffix} Mostrar la informacion de conexion 
+  ${Green_font_prefix}7.${Font_color_suffix} Agregar/Modificar/Eliminar la configuracion del usuario  
+  ${Green_font_prefix}8.${Font_color_suffix} Modificar manualmente la configuracion del usuario
+  ${Green_font_prefix}9.${Font_color_suffix} Borrar el trafico usado  
+——————————————
+ ${Green_font_prefix}10.${Font_color_suffix} Iniciar ShadowsocksR
+ ${Green_font_prefix}11.${Font_color_suffix} Detener ShadowsocksR
+ ${Green_font_prefix}12.${Font_color_suffix} Reiniciar ShadowsocksR
+ ${Green_font_prefix}13.${Font_color_suffix} Verificar Registro de ShadowsocksR
+—————————————
+ ${Green_font_prefix}14.${Font_color_suffix} Otras Funciones
+ ${Green_font_prefix}15.${Font_color_suffix} Actualizar Script 
+$(msg -bar)
+ ${Green_font_prefix}16.${Font_color_suffix}${Red_font_prefix} SALIR"
+	
+	menu_status
+	msg -bar
+    stty erase '^H' && read -p "Porfavor seleccione una opcion [1-16]:" num
+	msg -bar
+case "$num" in
+	1)
+	Install_SSR
+	;;
+	2)
+	Update_SSR
+	;;
+	3)
+	Uninstall_SSR
+	;;
+	4)
+	Install_Libsodium
+	;;
+	5)
+	View_User
+	;;
+	6)
+	View_user_connection_info
+	;;
+	7)
+	Modify_Config
+	;;
+	8)
+	Manually_Modify_Config
+	;;
+	9)
+	Clear_transfer
+	;;
+	10)
+	Start_SSR
+	;;
+	11)
+	Stop_SSR
+	;;
+	12)
+	Restart_SSR
+	;;
+	13)
+	View_Log
+	;;
+	14)
+	Other_functions
+	;;
+	15)
+	Update_Shell
+	;;
+     16)
+     exit 1
+      ;;
+	*)
+	echo -e "${Error} Porfavor use numeros del [1-16]"
+	msg -bar
+	;;
+esac
+fi

+ 267 - 0
LACASITAMX-v8.9x/Des/protocolos/PDirect.py

@@ -0,0 +1,267 @@
+import socket, threading, thread, select, signal, sys, time, getopt
+
+# Listen
+LISTENING_ADDR = '0.0.0.0'
+if sys.argv[1:]:
+  LISTENING_PORT = sys.argv[1]
+else:
+  LISTENING_PORT = 80  
+#Pass
+PASS = ''
+
+# CONST
+BUFLEN = 4096 * 4
+TIMEOUT = 60
+DEFAULT_HOST = '127.0.0.1:22'
+RESPONSE = 'HTTP/1.1 200 <strong>(<span style="color: #ff0000;"><strong><span style="color: #ff9900;">By</span>-<span style="color: #008000;">VPS</span>-MEX</strong></span>)</strong>\r\nContent-length: 0\r\n\r\nHTTP/1.1 200 conexion exitosa\r\n\r\n'
+#RESPONSE = 'HTTP/1.1 200 Hello_World!\r\nContent-length: 0\r\n\r\nHTTP/1.1 200 Connection established\r\n\r\n'  # lint:ok
+
+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)
+        intport = int(self.port)
+        self.soc.bind((self.host, intport))
+        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 = 22
+            else:
+                port = sys.argv[1]
+
+        (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 'Usage: proxy.py -p <port>'
+    print '       proxy.py -b <bindAddr> -p <port>'
+    print '       proxy.py -b 0.0.0.0 -p 80'
+
+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 "\n:-------PythonProxy-------:\n"
+    print "Listening addr: " + LISTENING_ADDR
+    print "Listening port: " + str(LISTENING_PORT) + "\n"
+    print ":-------------------------:\n"
+    server = Server(LISTENING_ADDR, LISTENING_PORT)
+    server.start()
+    while True:
+        try:
+            time.sleep(2)
+        except KeyboardInterrupt:
+            print 'Stopping...'
+            server.close()
+            break
+
+#######    parse_args(sys.argv[1:])
+if __name__ == '__main__':
+    main()

+ 682 - 0
LACASITAMX-v8.9x/Des/protocolos/PGet.py

@@ -0,0 +1,682 @@
+import sys, time, getopt, socket, threading, base64
+
+
+# CONFIG
+CONFIG_LISTENING = '0.0.0.0:8799'
+CONFIG_PASS = 'pwd.pwd'
+
+
+class Logger:
+
+    logLock = threading.Lock()
+    LOG_INFO = 1
+    LOG_WARN = 2
+    LOG_ERROR = 3
+
+    def printWarn(self, log):
+        self.log(log)
+
+    def printInfo(self, log):
+        self.log(log)
+
+    def printError(self, log):
+        self.log(log)
+
+    def printLog(self, log, logLevel):
+        if logLevel == Logger.LOG_INFO:
+            self.printInfo('<-> ' + log)
+        elif logLevel == Logger.LOG_WARN:
+            self.printWarn('<!> ' + log)
+        elif logLevel == Logger.LOG_ERROR:
+            self.printError('<#> ' + log)
+
+    def log(self, log):
+        with Logger.logLock:
+            print log
+
+		
+
+class PasswordSet:
+    FILE_EXEMPLE = 'master=passwd123\n127.0.0.1:22=pwd321;321pawd\n1.23.45.67:443=pass123'
+
+    def __init__(self, masterKey=None):
+        self.masterKey = masterKey
+
+    def parseFile(self, fileName):
+        isValid = False
+
+        with open(fileName) as f:
+            content = f.readlines()
+
+        content = [x.strip() for x in content]
+        content = [item for item in content if not str(item).startswith('#')]
+
+        if len(content) > 0:
+            masterKey = content[0]
+
+            if self.splitParam(masterKey, '=') is not None and masterKey.startswith('master'):
+                self.masterKey = self.splitParam(masterKey, '=')[1]
+
+            isValid = True
+            self.map = dict()
+
+            for i, v in enumerate(content[1:]):
+                hostAndPass = self.splitParam(v, '=')
+
+                if hostAndPass is not None:
+                    self.map[hostAndPass[0]] = hostAndPass[1].split(';')
+
+        return isValid
+
+    def isValidKey(self, key, target):
+        valid = False
+
+        if not self.masterKey == key:
+            if hasattr(self, 'map'):
+                if self.map.has_key(target):
+                    valid = key in self.map[target]
+        else:
+            valid = True
+
+        return valid
+
+
+    def splitParam(self, param, c):
+        index = param.find(c)
+
+        ret = None
+
+        if index != -1:
+            ret = []
+            ret.append(param[0:index])
+            ret.append(param[index+1:])
+
+        return ret
+
+
+
+
+class ClientRequest:
+    MAX_LEN_CLIENT_REQUEST = 1024 * 100
+    HEADER_CONTENT_LENGTH = 'Content-Length'
+    HEADER_ACTION = 'X-Action'
+    ACTION_CLOSE = 'close'
+    ACTION_DATA = 'data'
+
+    def __init__(self, socket):
+        self.socket = socket
+        self.readConent = False
+
+    def parse(self):
+        line = ''
+        count = 0
+        self.isValid = False
+        self.data = None
+        self.contentLength = None
+        self.action = None
+
+        while line != '\r\n' and count < ClientRequest.MAX_LEN_CLIENT_REQUEST:
+            line = self.readHttpLine()
+
+            if line is None:
+                break
+
+            if line.startswith(ClientRequest.HEADER_ACTION):
+                self.action = self.getHeaderVal(line)
+
+                if not self.action is None:
+                    if self.action == ClientRequest.ACTION_CLOSE or self.action == ClientRequest.ACTION_DATA:
+                        self.isValid = True
+
+            count += len(line)
+
+        if self.readConent:
+            if self.contentLength > 0 and self.contentLength < ClientRequest.MAX_LEN_CLIENT_REQUEST:
+                self.data = self.readFully(self.contentLength)
+
+        return self.isValid
+
+    def readHttpLine(self):
+        line = ''
+        count = 0
+        socket = self.socket
+
+        b = socket.recv(1)
+
+        if not b:
+            return None
+
+        while count < ClientRequest.MAX_LEN_CLIENT_REQUEST:
+            count += 1
+            line += b
+
+            if b == '\r':
+                b = socket.recv(1)
+                count += 1
+
+                if not b:
+                    break
+
+                line += b
+
+                if b == '\n':
+                    break
+
+            b = socket.recv(1)
+
+            if not b:
+                break
+
+        if not b:
+            return None
+
+        return line
+
+    def getHeaderVal(self, header):
+        ini = header.find(':')
+
+        if ini == -1:
+            return None
+
+        ini += 2
+
+        fim = header.find('\r\n')
+
+        if fim == -1:
+            header = header[ini:]
+
+        return header[ini:fim]
+
+    def readFully(self, n):
+        count = 0
+        data = ''
+
+        while count < n:
+            packet = self.socket.recv(n - count)
+
+            if not packet:
+                break
+
+            count += len(packet)
+            data += packet
+
+
+
+
+class Client(threading.Thread):
+    ACTION_DATA = 'data'
+    BUFFER_SIZE = 4096
+
+    def __init__(self, id, readSocket, target):
+        super(Client, self).__init__()
+        self.targetHostPort = target
+        self.id = id
+        self.readSocket = readSocket
+        self.logger = Logger()
+        self.isStopped = False
+        self.onCloseFunction = None
+        self.closeLock = threading.Lock()
+        self.threadEndCount = 0
+        self.writeSocket = None
+
+    def connectTarget(self):
+        aux = self.targetHostPort.find(':')
+
+        host = self.targetHostPort[:aux]
+        port = int(self.targetHostPort[aux + 1:])
+
+        self.target = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        self.target.connect((host, port))
+
+    def run(self):
+        try:
+            self.connectTarget()
+
+            request = ClientRequest(self.readSocket)
+            request.readConent = False
+
+            if not request.parse() or not Client.ACTION_DATA == request.action:
+                raise Exception('client sends invalid request')
+
+            threadRead = ThreadRelay(self.readSocket, self.target, self.finallyClose)
+            threadRead.logFunction = self.log
+            threadRead.start()
+
+            threadWrite = ThreadRelay(self.target, self.writeSocket, self.finallyClose)
+            threadWrite.logFunction = self.log
+            threadWrite.start()
+        except Exception as e:
+            self.log('connection error - ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+            self.close()
+
+    def finallyClose(self):
+        with self.closeLock:
+            self.threadEndCount += 1
+
+            if self.threadEndCount == 2:
+                self.close()
+
+    def close(self):
+        if not self.isStopped:
+            self.isStopped = True
+
+            if hasattr(self, 'target'):
+                try:
+                    self.target.close()
+                except:
+                    pass
+
+            if hasattr(self, 'writeSocket'):
+                try:
+                    self.writeSocket.close()
+                except:
+                    pass
+
+            if hasattr(self, 'readSocket'):
+                try:
+                    self.readSocket.close()
+                except:
+                    pass
+
+            self.onClose()
+            self.log('closed', Logger.LOG_INFO)
+
+    def onClose(self):
+        if not self.onCloseFunction is None:
+            self.onCloseFunction(self)
+
+    def log(self, msg, logLevel):
+        msg = 'Client ' + str(self.id) + ': ' + msg
+        self.logger.printLog(msg, logLevel)
+
+
+class ThreadRelay(threading.Thread):
+    def __init__(self, readSocket, writeSocket, closeFunction=None):
+        super(ThreadRelay, self).__init__()
+        self.readSocket = readSocket
+        self.writeSocket = writeSocket
+        self.logFunction = None
+        self.closeFuntion = closeFunction
+
+    def run(self):
+        try:
+            while True:
+                data = self.readSocket.recv(Client.BUFFER_SIZE)
+                if not data:
+                    break
+                self.writeSocket.sendall(data)
+
+            self.writeSocket.shutdown(socket.SHUT_WR)
+        except Exception as e:
+            if not self.logFunction is None:
+                self.logFunction('threadRelay error: ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+        finally:
+            if not self.closeFuntion is None:
+                self.closeFuntion()
+
+
+
+
+class AcceptClient(threading.Thread):
+    MAX_QTD_BYTES = 5000
+    HEADER_BODY = 'X-Body'
+    HEADER_ACTION = 'X-Action'
+    HEADER_TARGET = 'X-Target'
+    HEADER_PASS = 'X-Pass'
+    HEADER_ID = 'X-Id'
+    ACTION_CREATE = 'create'
+    ACTION_COMPLETE = 'complete'
+    MSG_CONNECTION_CREATED = 'Created'
+    MSG_CONNECTION_COMPLETED = 'Completed'
+
+    ID_COUNT = 0
+    ID_LOCK = threading.Lock()
+
+    def __init__(self, socket, server, passwdSet=None):
+        super(AcceptClient, self).__init__()
+        self.server = server
+        self.passwdSet = passwdSet
+        self.socket = socket
+
+    def run(self):
+        needClose = True
+
+        try:
+            head = self.readHttpRequest()
+
+            bodyLen = self.getHeaderVal(head, AcceptClient.HEADER_BODY)
+            if not bodyLen is None:
+                try:
+                    self.readFully(int(bodyLen))
+                except ValueError:
+                    pass
+
+            action = self.getHeaderVal(head, AcceptClient.HEADER_ACTION)
+
+            if action is None:
+                self.log('client sends no action header', Logger.LOG_WARN)
+                self.socket.sendall('HTTP/1.1 400 NoActionHeader!\r\nServer: GetTunnelServer\r\n\r\n')
+                return
+
+            if action == AcceptClient.ACTION_CREATE:
+                target = self.getHeaderVal(head, AcceptClient.HEADER_TARGET)
+
+                if not self.passwdSet is None:
+                    passwd = self.getHeaderVal(head, AcceptClient.HEADER_PASS)
+
+                    try:
+                        passwd = base64.b64decode(passwd)
+                    except:
+                        passwd = None
+                        pass
+
+                    if passwd is None or not self.passwdSet.isValidKey(passwd, target):
+                        self.log('client sends wrong key', Logger.LOG_WARN)
+                        self.socket.sendall('HTTP/1.1 403 Forbidden\r\nServer: GetTunnelServer\r\n\r\n')
+                        return
+
+                if target is not None and self.isValidHostPort(target):
+                    id = self.generateId()
+
+                    client = Client(id, self.socket, target)
+                    client.onCloseFunction = self.server.removeClient
+                    self.server.addClient(client)
+                    self.socket.sendall('HTTP/1.1 200 '+ AcceptClient.MSG_CONNECTION_CREATED + '\r\nServer: GetTunnelServer\r\nX-Id: ' + str(id) + '\r\nContent-Type: text/plain\r\nContent-Length: 0\r\nConnection: Keep-Alive\r\n\r\n')
+                    self.log('connection created - ' + str(id), Logger.LOG_INFO)
+                    needClose = False
+                else:
+                    self.log('client sends no valid target', Logger.LOG_WARN)
+                    self.socket.sendall('HTTP/1.1 400 Target!\r\nServer: GetTunnelServer\r\n\r\n')
+
+            elif action == AcceptClient.ACTION_COMPLETE:
+                id = self.getHeaderVal(head, AcceptClient.HEADER_ID)
+
+                if not id is None:
+                    client = self.server.getClient(id)
+
+                    if not client is None:
+                        client.writeSocket = self.socket
+
+                        self.log('connection completed - ' + str(id), Logger.LOG_INFO)
+                        self.socket.sendall('HTTP/1.1 200 ' + AcceptClient.MSG_CONNECTION_COMPLETED + '\r\nServer: GetTunnelServer\r\nConnection: Keep-Alive\r\n\r\n')
+
+                        client.start()
+                        needClose = False
+                    else:
+                        self.log('client try to complete non existing connection', Logger.LOG_WARN)
+                        self.socket.sendall('HTTP/1.1 400 CreateFirst!\r\nServer: GetTunnelServer\r\n\r\n')
+                else:
+                    self.log('client sends no id header', Logger.LOG_WARN)
+                    self.socket.sendall('HTTP/1.1 400 NoID!\r\nServer: GetTunnelServer\r\n\r\n')
+            else:
+                self.log('client sends invalid action', Logger.LOG_WARN)
+                self.socket.sendall('HTTP/1.1 400 InvalidAction!\r\nServer: GetTunnelServer\r\n\r\n')
+
+        except Exception as e:
+            self.log('connection error - ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+        finally:
+            if needClose:
+                try:
+                    self.socket.close()
+                except:
+                    pass
+
+    def log(self, msg, logLevel):
+        self.server.log(msg, logLevel)
+
+    def readHttpRequest(self):
+        request = ''
+        linha = ''
+        count = 0
+
+        while linha != '\r\n' and count < AcceptClient.MAX_QTD_BYTES:
+            linha = self.readHttpLine()
+
+            if linha is None:
+                break
+
+            request += linha
+            count += len(linha)
+
+        return request
+
+    def readHttpLine(self):
+        line = ''
+        count = 0
+        socket = self.socket
+
+        b = socket.recv(1)
+
+        if not b:
+            return None
+
+        while count < AcceptClient.MAX_QTD_BYTES:
+            count += 1
+            line += b
+
+            if b == '\r':
+                b = socket.recv(1)
+                count += 1
+
+                if not b:
+                    break
+
+                line += b
+
+                if b == '\n':
+                    break
+
+            b = socket.recv(1)
+
+            if not b:
+                break
+
+        if not b:
+            return None
+
+        return line
+
+    def getHeaderVal(self, head, header):
+        if not head.startswith('\r\n'):
+            header = '\r\n' + header
+
+        if not header.endswith(': '):
+            header = header + ': '
+
+        ini = head.find(header)
+
+        if ini == -1:
+            return None
+
+        end = head.find('\r\n', ini+2)
+
+        ini += len(header)
+
+        if end == -1 or ini > end or ini >= len(head):
+            return None
+
+        return head[ini:end]
+
+    def readFully(self, n):
+        count = 0
+
+        while count < n:
+            packet = self.socket.recv(n - count)
+
+            if not packet:
+                break
+
+            count += len(packet)
+
+    def isValidHostPort(self, hostPort):
+        aux = hostPort.find(':')
+
+        if aux == -1 or aux >= len(hostPort) -1:
+            return False
+
+        try:
+            int(hostPort[aux+1:])
+            return True
+        except ValueError:
+            return False
+
+    def generateId(self):
+        with AcceptClient.ID_LOCK:
+            AcceptClient.ID_COUNT += 1
+            return AcceptClient.ID_COUNT
+
+
+
+class Server(threading.Thread):
+
+    def __init__(self, listening, passwdSet=None):
+        super(Server, self).__init__()
+        self.listening = listening
+        self.passwdSet = passwdSet
+        self.running = False
+        self.logger = Logger()
+        self.isStopped = False
+        self.clientsLock = threading.Lock()
+        self.clients = []
+
+    def run(self):
+        try:
+            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.listening[:self.listening.find(':')], int(self.listening[self.listening.find(':') + 1:])))
+            self.soc.listen(0)
+
+            self.log('running on ' + self.listening, Logger.LOG_INFO)
+
+            self.running = True
+            while self.running:
+                try:
+                    c, addr = self.soc.accept()
+                    c.setblocking(1)
+
+                    self.log('opennig connection - ' + str(addr), Logger.LOG_INFO)
+                    self.acceptClient(c)
+                except socket.timeout:
+                    continue
+        except Exception as e:
+            self.log('connection error - ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+        finally:
+            self.running = False
+            self.close()
+
+    def acceptClient(self, socket):
+        accept = AcceptClient(socket, self, self.passwdSet)
+        accept.start()
+
+    def addClient(self, client):
+        with self.clientsLock:
+            self.clients.append(client)
+
+    def removeClient(self, client):
+        with self.clientsLock:
+            self.clients.remove(client)
+
+    def getClient(self, id):
+        client = None
+        with self.clientsLock:
+            for c in self.clients:
+                if str(c.id) == str(id):
+                    client = c
+                    break
+        return client
+
+    def close(self):
+        if not self.isStopped:
+            self.isStopped = True
+
+            if hasattr(self, 'soc'):
+                try:
+                    self.soc.close()
+                except:
+                    pass
+
+            with self.clientsLock:
+                clientsCopy = self.clients[:]
+
+            for c in clientsCopy:
+                c.close()
+
+            self.log('closed', Logger.LOG_INFO)
+
+    def log(self, msg, logLevel):
+        msg = 'Server: ' + msg
+        self.logger.printLog(msg, logLevel)
+
+
+
+
+def print_usage():
+    print '\nUsage  : python get.py -b listening -p pass'
+    print 'Ex.    : python get.py -b 0.0.0.0:80 -p pass123'
+    print '       : python get.py -b 0.0.0.0:80 -p passFile.pwd\n'
+    print '___Password file ex.:___'
+    print PasswordSet.FILE_EXEMPLE
+
+def parse_args(argv):
+    global CONFIG_LISTENING
+    global CONFIG_PASS
+
+    try:
+        opts, args = getopt.getopt(argv, "hb:p:", ["bind=", "pass="])
+    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'):
+            CONFIG_LISTENING = arg
+        elif opt in ('-p', '--pass'):
+            CONFIG_PASS = arg
+
+def main():
+    print '\n-->GetTunnelPy - Server v.' + '25/06/2017' + '\n'
+    print '-->Listening: ' + CONFIG_LISTENING
+
+    pwdSet = None
+
+    if not CONFIG_PASS is None:
+        if CONFIG_PASS.endswith('.pwd'):
+            pwdSet = PasswordSet()
+
+            try:
+                isValidFile = pwdSet.parseFile(CONFIG_PASS)
+            except IOError as e:
+                print '--#Error reading file: ' + str(type(e)) + ' - ' + str(e)
+                sys.exit()
+
+            if not isValidFile:
+                print '--#Error on parsing file!\n'
+                print_usage()
+                return
+
+            print '-->Pass file: ' + CONFIG_PASS + '\n'
+        else:
+            if (len(CONFIG_PASS) > 0):
+                print '-->Pass     : yes\n'
+                pwdSet = PasswordSet(CONFIG_PASS)
+            else:
+                print '-->Pass     : no\n'
+
+    server = Server(CONFIG_LISTENING)
+    server.passwdSet = pwdSet
+    server.start()
+
+    while True:
+        try:
+            time.sleep(2)
+        except KeyboardInterrupt:
+            print '<-> Stopping server...'
+            server.running = False
+            break
+
+if __name__ == '__main__':
+    parse_args(sys.argv[1:])
+    main()

+ 313 - 0
LACASITAMX-v8.9x/Des/protocolos/POpen.py

@@ -0,0 +1,313 @@
+#!/usr/bin/env python
+
+import sys
+import httplib
+from SocketServer import ThreadingMixIn
+from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
+from threading import Lock, Timer
+from cStringIO import StringIO
+from urlparse import urlsplit
+import socket
+import select
+import gzip
+import zlib
+import re
+import traceback
+
+
+class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
+
+    address_family = socket.AF_INET
+
+    def handle_error(self, request, client_address):
+        
+        print >>sys.stderr, '-'*40
+        print >>sys.stderr, 'Exception happened during processing of request from', client_address
+        traceback.print_exc()
+        print >>sys.stderr, '-'*40
+        
+     
+class ThreadingHTTPServer6(ThreadingHTTPServer):
+
+    address_family = socket.AF_INET6
+
+
+class SimpleHTTPProxyHandler(BaseHTTPRequestHandler):
+    global_lock = Lock()
+    conn_table = {}
+    timeout = 300               
+    upstream_timeout = 300    
+    proxy_via = None          
+
+    def log_error(self, format, *args):
+        if format == "Request timed out: %r":
+            return
+        self.log_message(format, *args)
+
+    def do_CONNECT(self):
+        
+
+        req = self
+        reqbody = None
+        req.path = "https://%s/" % req.path.replace(':443', '')
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+
+        u = urlsplit(req.path)
+        address = (u.hostname, u.port or 443)
+        try:
+            conn = socket.create_connection(address)
+        except socket.error:
+            return
+        self.send_response(200, 'SOCKS5')
+        self.send_header('Connection', 'close')
+        self.end_headers()
+
+        conns = [self.connection, conn]
+        keep_connection = True
+        while keep_connection:
+            keep_connection = False
+            rlist, wlist, xlist = select.select(conns, [], conns, self.timeout)
+            if xlist:
+                break
+            for r in rlist:
+                other = conns[1] if r is conns[0] else conns[0]
+                data = r.recv(8192)
+                if data:
+                    other.sendall(data)
+                    keep_connection = True
+        conn.close()
+
+    def do_HEAD(self):
+        self.do_SPAM()
+
+    def do_GET(self):
+        self.do_SPAM()
+
+    def do_POST(self):
+        self.do_SPAM()
+
+    def do_SPAM(self):
+        req = self
+        content_length = int(req.headers.get('Content-Length', 0))
+        if content_length > 0:
+            reqbody = self.rfile.read(content_length)
+        else:
+            reqbody = None
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+        elif replaced_reqbody is not None:
+            reqbody = replaced_reqbody
+            if 'Content-Length' in req.headers:
+                req.headers['Content-Length'] = str(len(reqbody))
+
+        
+        self.remove_hop_by_hop_headers(req.headers)
+        if self.upstream_timeout:
+            req.headers['Connection'] = 'Keep-Alive'
+        else:
+            req.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(req.headers)
+
+        try:
+            res, resdata = self.request_to_upstream_server(req, reqbody)
+        except socket.error:
+            return
+
+        content_encoding = res.headers.get('Content-Encoding', 'identity')
+        resbody = self.decode_content_body(resdata, content_encoding)
+
+        replaced_resbody = self.response_handler(req, reqbody, res, resbody)
+        if replaced_resbody is True:
+            return
+        elif replaced_resbody is not None:
+            resdata = self.encode_content_body(replaced_resbody, content_encoding)
+            if 'Content-Length' in res.headers:
+                res.headers['Content-Length'] = str(len(resdata))
+            resbody = replaced_resbody
+
+        self.remove_hop_by_hop_headers(res.headers)
+        if self.timeout:
+            res.headers['Connection'] = 'Keep-Alive'
+        else:
+            res.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(res.headers)
+
+        self.send_response(res.status, res.reason)
+        for k, v in res.headers.items():
+            if k == 'set-cookie':
+                
+                for value in self.split_set_cookie_header(v):
+                    self.send_header(k, value)
+            else:
+                self.send_header(k, v)
+        self.end_headers()
+
+        if self.command != 'HEAD':
+            self.wfile.write(resdata)
+            with self.global_lock:
+                self.save_handler(req, reqbody, res, resbody)
+
+    def request_to_upstream_server(self, req, reqbody):
+        u = urlsplit(req.path)
+        origin = (u.scheme, u.netloc)
+
+        
+        req.headers['Host'] = u.netloc
+        selector = "%s?%s" % (u.path, u.query) if u.query else u.path
+
+        while True:
+            with self.lock_origin(origin):
+                conn = self.open_origin(origin)
+                try:
+                    conn.request(req.command, selector, reqbody, headers=dict(req.headers))
+                except socket.error:
+                    
+                    self.close_origin(origin)
+                    raise
+                try:
+                    res = conn.getresponse(buffering=True)
+                except httplib.BadStatusLine as e:
+                    if e.line == "''":
+                        
+                        self.close_origin(origin)
+                        continue
+                    else:
+                        raise
+                resdata = res.read()
+                res.headers = res.msg    
+                if not self.upstream_timeout or 'close' in res.headers.get('Connection', ''):
+                    self.close_origin(origin)
+                else:
+                    self.reset_timer(origin)
+            return res, resdata
+
+    def lock_origin(self, origin):
+        d = self.conn_table.setdefault(origin, {})
+        if not 'lock' in d:
+            d['lock'] = Lock()
+        return d['lock']
+
+    def open_origin(self, origin):
+        conn = self.conn_table[origin].get('connection')
+        if not conn:
+            scheme, netloc = origin
+            if scheme == 'https':
+                conn = httplib.HTTPSConnection(netloc)
+            else:
+                conn = httplib.HTTPConnection(netloc)
+            self.reset_timer(origin)
+            self.conn_table[origin]['connection'] = conn
+        return conn
+
+    def reset_timer(self, origin):
+        timer = self.conn_table[origin].get('timer')
+        if timer:
+            timer.cancel()
+        if self.upstream_timeout:
+            timer = Timer(self.upstream_timeout, self.close_origin, args=[origin])
+            timer.daemon = True
+            timer.start()
+        else:
+            timer = None
+        self.conn_table[origin]['timer'] = timer
+
+    def close_origin(self, origin):
+        timer = self.conn_table[origin]['timer']
+        if timer:
+            timer.cancel()
+        conn = self.conn_table[origin]['connection']
+        conn.close()
+        del self.conn_table[origin]['connection']
+
+    def remove_hop_by_hop_headers(self, headers):
+        hop_by_hop_headers = ['Connection', 'Keep-Alive', 'Proxy-Authenticate', 'Proxy-Authorization', 'TE', 'Trailers', 'Trailer', 'Transfer-Encoding', 'Upgrade']
+        connection = headers.get('Connection')
+        if connection:
+            keys = re.split(r',\s*', connection)
+            hop_by_hop_headers.extend(keys)
+
+        for k in hop_by_hop_headers:
+            if k in headers:
+                del headers[k]
+
+    def modify_via_header(self, headers):
+        via_string = "%s %s" % (self.protocol_version, self.proxy_via)
+        via_string = re.sub(r'^HTTP/', '', via_string)
+
+        original = headers.get('Via')
+        if original:
+            headers['Via'] = original + ', ' + via_string
+        else:
+            headers['Via'] = via_string
+
+    def decode_content_body(self, data, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO(data)
+            with gzip.GzipFile(fileobj=io) as f:
+                body = f.read()
+        elif content_encoding == 'deflate':
+            body = zlib.decompress(data)
+        elif content_encoding == 'identity':
+            body = data
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return body
+
+    def encode_content_body(self, body, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO()
+            with gzip.GzipFile(fileobj=io, mode='wb') as f:
+                f.write(body)
+            data = io.getvalue()
+        elif content_encoding == 'deflate':
+            data = zlib.compress(body)
+        elif content_encoding == 'identity':
+            data = body
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return data
+
+    def split_set_cookie_header(self, value):
+        re_cookies = r'([^=]+=[^,;]+(?:;\s*Expires=[^,]+,[^,;]+|;[^,;]+)*)(?:,\s*)?'
+        return re.findall(re_cookies, value, flags=re.IGNORECASE)
+
+    def request_handler(self, req, reqbody):
+        
+        pass
+
+    def response_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+    def save_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+
+# Port
+
+def test(HandlerClass=SimpleHTTPProxyHandler, ServerClass=ThreadingHTTPServer, protocol="HTTP/1.1"):
+    if sys.argv[1:]:
+        port = int(sys.argv[1])
+    else:
+        port = 80
+    server_address = ('', port)
+
+    HandlerClass.protocol_version = protocol
+    httpd = ServerClass(server_address, HandlerClass)
+
+    sa = httpd.socket.getsockname()
+    print "Serving HTTP on", sa[0], "port", sa[1], "..."
+    httpd.serve_forever()
+
+
+if __name__ == '__main__':
+    test()
+

+ 335 - 0
LACASITAMX-v8.9x/Des/protocolos/PPriv.py

@@ -0,0 +1,335 @@
+#!/usr/bin/env python
+
+# -*- coding: utf-8 -*-
+# Edit By GlEmYsSoN & @e8th4ever
+
+from pprint import pprint
+import sys
+import http.client
+from socketserver import ThreadingMixIn
+from http.server import HTTPServer, BaseHTTPRequestHandler
+from threading import Lock, Timer
+from io import StringIO
+from urllib.parse import urlsplit
+import socket
+import select
+import gzip
+import zlib
+import re
+import traceback
+import subprocess
+subprocess.call("clear",shell=True)
+
+if sys.argv[2:]:
+ msg1 = sys.argv[2]
+else:
+ msg1 = 'ADM-ULTIMATE'
+
+if sys.argv[3:]:
+ server = sys.argv[3]
+else:
+ server = "127.0.0.1"
+
+msg2 = 'Server Forbidden'
+
+class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
+
+    address_family = socket.AF_INET
+
+    def handle_error(self, request, client_address):
+        
+        print('-'*40, file=sys.stderr)
+        print('Exception happened during processing of request from', client_address, file=sys.stderr)
+        traceback.print_exc()
+        print('-'*40, file=sys.stderr)
+        
+     
+class ThreadingHTTPServer6(ThreadingHTTPServer):
+
+    address_family = socket.AF_INET6
+
+
+class SimpleHTTPProxyHandler(BaseHTTPRequestHandler):
+    global_lock = Lock()
+    conn_table = {}
+    timeout = 300               
+    upstream_timeout = 300    
+    proxy_via = None          
+
+    def log_error(self, format, *args):
+        if format == "Request timed out: %r":
+            return
+        self.log_message(format, *args)
+
+    def do_CONNECT(self):
+
+        req = self
+        reqbody = None
+        if ':22' in req.path:
+            hostip = req.path.replace(':22', '')
+        elif ':443' in req.path:
+            hostip = req.path.replace(':443', '')
+        req.path = "https://%s/" % req.path.replace(':443', '')
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+
+        u = urlsplit(req.path)
+        address = (u.hostname, u.port or 443)
+        try:
+            conn = socket.create_connection(address)
+        except socket.error:
+            return
+
+        self.send_response(200, msg1)
+        self.send_header('Connection', 'close')
+        self.end_headers()
+
+        conns = [self.connection, conn]
+        keep_connection = True
+        while keep_connection:
+            if not server.find(hostip) != -1:
+                self.send_error(403, msg2)
+                self.close_connection
+            keep_connection = False
+            rlist, wlist, xlist = select.select(conns, [], conns, self.timeout)
+            if xlist:
+                break
+            for r in rlist:
+                other = conns[1] if r is conns[0] else conns[0]
+                data = r.recv(8192)
+                if data:
+                    other.sendall(data)
+                    keep_connection = True
+        conn.close()
+
+    def do_HEAD(self):
+        self.do_SPAM()
+
+    def do_GET(self):
+        self.do_SPAM()
+
+    def do_POST(self):
+        self.do_SPAM()
+
+    def do_SPAM(self):
+        req = self
+
+        content_length = int(req.headers.get('Content-Length', 0))
+        if content_length > 0:
+            reqbody = self.rfile.read(content_length)
+        else:
+            reqbody = None
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+        elif replaced_reqbody is not None:
+            reqbody = replaced_reqbody
+            if 'Content-Length' in req.headers:
+                req.headers['Content-Length'] = str(len(reqbody))
+
+        
+        self.remove_hop_by_hop_headers(req.headers)
+        if self.upstream_timeout:
+            req.headers['Connection'] = 'Keep-Alive'
+        else:
+            req.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(req.headers)
+
+        try:
+            res, resdata = self.request_to_upstream_server(req, reqbody)
+        except socket.error:
+            return
+
+        content_encoding = res.headers.get('Content-Encoding', 'identity')
+        resbody = self.decode_content_body(resdata, content_encoding)
+
+        replaced_resbody = self.response_handler(req, reqbody, res, resbody)
+        if replaced_resbody is True:
+            return
+        elif replaced_resbody is not None:
+            resdata = self.encode_content_body(replaced_resbody, content_encoding)
+            if 'Content-Length' in res.headers:
+                res.headers['Content-Length'] = str(len(resdata))
+            resbody = replaced_resbody
+
+        self.remove_hop_by_hop_headers(res.headers)
+        if self.timeout:
+            res.headers['Connection'] = 'Keep-Alive'
+        else:
+            res.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(res.headers)
+
+        self.send_response(res.status, res.reason)
+        for k, v in list(res.headers.items()):
+            if k == 'set-cookie':
+                
+                for value in self.split_set_cookie_header(v):
+                    self.send_header(k, value)
+            else:
+                self.send_header(k, v)
+        self.end_headers()
+
+        if self.command != 'HEAD':
+            self.wfile.write(resdata)
+            with self.global_lock:
+                self.save_handler(req, reqbody, res, resbody)
+
+    def request_to_upstream_server(self, req, reqbody):
+        u = urlsplit(req.path)
+
+        origin = (u.scheme, u.netloc)
+
+        
+        req.headers['Host'] = u.netloc
+        selector = "%s?%s" % (u.path, u.query) if u.query else u.path
+
+        while True:
+            with self.lock_origin(origin):
+                conn = self.open_origin(origin)
+                try:
+                    conn.request(req.command, selector, reqbody, headers=dict(req.headers))
+                except socket.error:
+                    
+                    self.close_origin(origin)
+                    raise
+                try:
+                    res = conn.getresponse(buffering=True)
+                except http.client.BadStatusLine as e:
+                    if e.line == "''":
+                        
+                        self.close_origin(origin)
+                        continue
+                    else:
+                        raise
+                resdata = res.read()
+                res.headers = res.msg    
+                if not self.upstream_timeout or 'close' in res.headers.get('Connection', ''):
+                    self.close_origin(origin)
+                else:
+                    self.reset_timer(origin)
+            return res, resdata
+
+    def lock_origin(self, origin):
+        d = self.conn_table.setdefault(origin, {})
+        if not 'lock' in d:
+            d['lock'] = Lock()
+        return d['lock']
+
+    def open_origin(self, origin):
+        conn = self.conn_table[origin].get('connection')
+        if not conn:
+            scheme, netloc = origin
+            if scheme == 'https':
+                conn = http.client.HTTPSConnection(netloc)
+            else:
+                conn = http.client.HTTPConnection(netloc)
+            self.reset_timer(origin)
+            self.conn_table[origin]['connection'] = conn
+        return conn
+
+    def reset_timer(self, origin):
+        timer = self.conn_table[origin].get('timer')
+        if timer:
+            timer.cancel()
+        if self.upstream_timeout:
+            timer = Timer(self.upstream_timeout, self.close_origin, args=[origin])
+            timer.daemon = True
+            timer.start()
+        else:
+            timer = None
+        self.conn_table[origin]['timer'] = timer
+
+    def close_origin(self, origin):
+        timer = self.conn_table[origin]['timer']
+        if timer:
+            timer.cancel()
+        conn = self.conn_table[origin]['connection']
+        conn.close()
+        del self.conn_table[origin]['connection']
+
+    def remove_hop_by_hop_headers(self, headers):
+        hop_by_hop_headers = ['Connection', 'Keep-Alive', 'Proxy-Authenticate', 'Proxy-Authorization', 'TE', 'Trailers', 'Trailer', 'Transfer-Encoding', 'Upgrade']
+        connection = headers.get('Connection')
+        if connection:
+            keys = re.split(r',\s*', connection)
+            hop_by_hop_headers.extend(keys)
+
+        for k in hop_by_hop_headers:
+            if k in headers:
+                del headers[k]
+
+    def modify_via_header(self, headers):
+        via_string = "%s %s" % (self.protocol_version, self.proxy_via)
+        via_string = re.sub(r'^HTTP/', '', via_string)
+
+        original = headers.get('Via')
+        if original:
+            headers['Via'] = original + ', ' + via_string
+        else:
+            headers['Via'] = via_string
+
+    def decode_content_body(self, data, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO(data)
+            with gzip.GzipFile(fileobj=io) as f:
+                body = f.read()
+        elif content_encoding == 'deflate':
+            body = zlib.decompress(data)
+        elif content_encoding == 'identity':
+            body = data
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return body
+
+    def encode_content_body(self, body, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO()
+            with gzip.GzipFile(fileobj=io, mode='wb') as f:
+                f.write(body)
+            data = io.getvalue()
+        elif content_encoding == 'deflate':
+            data = zlib.compress(body)
+        elif content_encoding == 'identity':
+            data = body
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return data
+
+    def split_set_cookie_header(self, value):
+        re_cookies = r'([^=]+=[^,;]+(?:;\s*Expires=[^,]+,[^,;]+|;[^,;]+)*)(?:,\s*)?'
+        return re.findall(re_cookies, value, flags=re.IGNORECASE)
+
+    def request_handler(self, req, reqbody):
+        
+        pass
+
+    def response_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+    def save_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+
+
+
+def test(HandlerClass=SimpleHTTPProxyHandler, ServerClass=ThreadingHTTPServer, protocol="HTTP/1.1"):
+    port = int(sys.argv[1])
+    server_address = ('', port)
+
+    HandlerClass.protocol_version = protocol
+    httpd = ServerClass(server_address, HandlerClass)
+
+    sa = httpd.socket.getsockname()
+    print("Servidor: " + str(sa[0]) + " Porta " + str(sa[1]))
+    httpd.serve_forever()
+
+
+if __name__ == '__main__':
+    test()

+ 318 - 0
LACASITAMX-v8.9x/Des/protocolos/PPub.py

@@ -0,0 +1,318 @@
+#!/usr/bin/env python
+
+import sys
+import httplib
+from SocketServer import ThreadingMixIn
+from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
+from threading import Lock, Timer
+from cStringIO import StringIO
+from urlparse import urlsplit
+import socket
+import select
+import gzip
+import zlib
+import re
+import traceback
+
+if sys.argv[2:]:
+ msg1 = sys.argv[2]
+else:
+ msg1 = "ADM-ULTIMATE"
+
+
+class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
+
+    address_family = socket.AF_INET
+
+    def handle_error(self, request, client_address):
+        
+        print >>sys.stderr, '-'*40
+        print >>sys.stderr, 'Exception happened during processing of request from', client_address
+        traceback.print_exc()
+        print >>sys.stderr, '-'*40
+        
+     
+class ThreadingHTTPServer6(ThreadingHTTPServer):
+
+    address_family = socket.AF_INET6
+
+
+class SimpleHTTPProxyHandler(BaseHTTPRequestHandler):
+    global_lock = Lock()
+    conn_table = {}
+    timeout = 300               
+    upstream_timeout = 300    
+    proxy_via = None          
+
+    def log_error(self, format, *args):
+        if format == "Request timed out: %r":
+            return
+        self.log_message(format, *args)
+
+    def do_CONNECT(self):
+        
+
+        req = self
+        reqbody = None
+        req.path = "https://%s/" % req.path.replace(':443', '')
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+
+        u = urlsplit(req.path)
+        address = (u.hostname, u.port or 443)
+        try:
+            conn = socket.create_connection(address)
+        except socket.error:
+            return
+        self.send_response(200, msg1)
+        self.send_header('Connection', 'close')
+        self.end_headers()
+
+        conns = [self.connection, conn] 
+        keep_connection = True
+        while keep_connection:
+            keep_connection = False
+            rlist, wlist, xlist = select.select(conns, [], conns, self.timeout)
+            if xlist:
+                break
+            for r in rlist:
+                other = conns[1] if r is conns[0] else conns[0]
+                data = r.recv(8192)
+                if data:
+                    other.sendall(data)
+                    keep_connection = True
+        conn.close()
+
+    def do_HEAD(self):
+        self.do_SPAM()
+
+    def do_GET(self):
+        self.do_SPAM()
+
+    def do_POST(self):
+        self.do_SPAM()
+
+    def do_SPAM(self):
+        req = self
+        content_length = int(req.headers.get('Content-Length', 0))
+        if content_length > 0:
+            reqbody = self.rfile.read(content_length)
+        else:
+            reqbody = None
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+        elif replaced_reqbody is not None:
+            reqbody = replaced_reqbody
+            if 'Content-Length' in req.headers:
+                req.headers['Content-Length'] = str(len(reqbody))
+
+        
+        self.remove_hop_by_hop_headers(req.headers)
+        if self.upstream_timeout:
+            req.headers['Connection'] = 'Keep-Alive'
+        else:
+            req.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(req.headers)
+
+        try:
+            res, resdata = self.request_to_upstream_server(req, reqbody)
+        except socket.error:
+            return
+
+        content_encoding = res.headers.get('Content-Encoding', 'identity')
+        resbody = self.decode_content_body(resdata, content_encoding)
+
+        replaced_resbody = self.response_handler(req, reqbody, res, resbody)
+        if replaced_resbody is True:
+            return
+        elif replaced_resbody is not None:
+            resdata = self.encode_content_body(replaced_resbody, content_encoding)
+            if 'Content-Length' in res.headers:
+                res.headers['Content-Length'] = str(len(resdata))
+            resbody = replaced_resbody
+
+        self.remove_hop_by_hop_headers(res.headers)
+        if self.timeout:
+            res.headers['Connection'] = 'Keep-Alive'
+        else:
+            res.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(res.headers)
+
+        self.send_response(res.status, res.reason)
+        for k, v in res.headers.items():
+            if k == 'set-cookie':
+                
+                for value in self.split_set_cookie_header(v):
+                    self.send_header(k, value)
+            else:
+                self.send_header(k, v)
+        self.end_headers()
+
+        if self.command != 'HEAD':
+            self.wfile.write(resdata)
+            with self.global_lock:
+                self.save_handler(req, reqbody, res, resbody)
+
+    def request_to_upstream_server(self, req, reqbody):
+        u = urlsplit(req.path)
+        origin = (u.scheme, u.netloc)
+
+        
+        req.headers['Host'] = u.netloc
+        selector = "%s?%s" % (u.path, u.query) if u.query else u.path
+
+        while True:
+            with self.lock_origin(origin):
+                conn = self.open_origin(origin)
+                try:
+                    conn.request(req.command, selector, reqbody, headers=dict(req.headers))
+                except socket.error:
+                    
+                    self.close_origin(origin)
+                    raise
+                try:
+                    res = conn.getresponse(buffering=True)
+                except httplib.BadStatusLine as e:
+                    if e.line == "''":
+                        
+                        self.close_origin(origin)
+                        continue
+                    else:
+                        raise
+                resdata = res.read()
+                res.headers = res.msg    
+                if not self.upstream_timeout or 'close' in res.headers.get('Connection', ''):
+                    self.close_origin(origin)
+                else:
+                    self.reset_timer(origin)
+            return res, resdata
+
+    def lock_origin(self, origin):
+        d = self.conn_table.setdefault(origin, {})
+        if not 'lock' in d:
+            d['lock'] = Lock()
+        return d['lock']
+
+    def open_origin(self, origin):
+        conn = self.conn_table[origin].get('connection')
+        if not conn:
+            scheme, netloc = origin
+            if scheme == 'https':
+                conn = httplib.HTTPSConnection(netloc)
+            else:
+                conn = httplib.HTTPConnection(netloc)
+            self.reset_timer(origin)
+            self.conn_table[origin]['connection'] = conn
+        return conn
+
+    def reset_timer(self, origin):
+        timer = self.conn_table[origin].get('timer')
+        if timer:
+            timer.cancel()
+        if self.upstream_timeout:
+            timer = Timer(self.upstream_timeout, self.close_origin, args=[origin])
+            timer.daemon = True
+            timer.start()
+        else:
+            timer = None
+        self.conn_table[origin]['timer'] = timer
+
+    def close_origin(self, origin):
+        timer = self.conn_table[origin]['timer']
+        if timer:
+            timer.cancel()
+        conn = self.conn_table[origin]['connection']
+        conn.close()
+        del self.conn_table[origin]['connection']
+
+    def remove_hop_by_hop_headers(self, headers):
+        hop_by_hop_headers = ['Connection', 'Keep-Alive', 'Proxy-Authenticate', 'Proxy-Authorization', 'TE', 'Trailers', 'Trailer', 'Transfer-Encoding', 'Upgrade']
+        connection = headers.get('Connection')
+        if connection:
+            keys = re.split(r',\s*', connection)
+            hop_by_hop_headers.extend(keys)
+
+        for k in hop_by_hop_headers:
+            if k in headers:
+                del headers[k]
+
+    def modify_via_header(self, headers):
+        via_string = "%s %s" % (self.protocol_version, self.proxy_via)
+        via_string = re.sub(r'^HTTP/', '', via_string)
+
+        original = headers.get('Via')
+        if original:
+            headers['Via'] = original + ', ' + via_string
+        else:
+            headers['Via'] = via_string
+
+    def decode_content_body(self, data, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO(data)
+            with gzip.GzipFile(fileobj=io) as f:
+                body = f.read()
+        elif content_encoding == 'deflate':
+            body = zlib.decompress(data)
+        elif content_encoding == 'identity':
+            body = data
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return body
+
+    def encode_content_body(self, body, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO()
+            with gzip.GzipFile(fileobj=io, mode='wb') as f:
+                f.write(body)
+            data = io.getvalue()
+        elif content_encoding == 'deflate':
+            data = zlib.compress(body)
+        elif content_encoding == 'identity':
+            data = body
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return data
+
+    def split_set_cookie_header(self, value):
+        re_cookies = r'([^=]+=[^,;]+(?:;\s*Expires=[^,]+,[^,;]+|;[^,;]+)*)(?:,\s*)?'
+        return re.findall(re_cookies, value, flags=re.IGNORECASE)
+
+    def request_handler(self, req, reqbody):
+        
+        pass
+
+    def response_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+    def save_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+
+
+
+def test(HandlerClass=SimpleHTTPProxyHandler, ServerClass=ThreadingHTTPServer, protocol="HTTP/1.1"):
+    if sys.argv[1:]:
+        port = int(sys.argv[1])
+    else:
+        port = 8799
+    server_address = ('', port)
+
+    HandlerClass.protocol_version = protocol
+    httpd = ServerClass(server_address, HandlerClass)
+
+    sa = httpd.socket.getsockname()
+    print "Serving HTTP on", sa[0], "port", sa[1], "..."
+    httpd.serve_forever()
+
+
+if __name__ == '__main__':
+    test()
+

+ 311 - 0
LACASITAMX-v8.9x/Des/protocolos/budp.sh

@@ -0,0 +1,311 @@
+#!/bin/bash
+ll="/usr/local/include/snaps" && [[ ! -d ${ll} ]] && exit
+l="/usr/local/lib/sped" && [[ ! -d ${l} ]] && exit
+clear
+clear
+declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
+SCPdir="/etc/VPS-MX"
+SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
+SCPinst="${SCPdir}/protocolos"&& [[ ! -d ${SCPinst} ]] && exit
+
+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"
+}
+
+installarm(){
+clear
+if [[ ! -e /bin/badvpn-udpgw ]]; then
+msg -ama "	INICIANDO DESCARGA BADVPN ARM TEST"
+[[ -e /bin/badvpn-udpgw ]] && rm -f /bin/badvpn-udpgw 
+[[ -e /bin/badvpn ]] && rm -f /bin/badvpn
+[[ -e /usr/local/bin/badvpn-udpgw ]] && rm -f /usr/local/bin/badvpn-udpgw
+rm -rf $HOME/badvpn*
+apt-get install -y gcc &>/dev/null # 2>/dev/null
+apt-get install -y make &>/dev/null #2>/dev/null
+apt-get install -y g++ &>/dev/null #2>/dev/null
+apt-get install -y openssl &>/dev/null #2>/dev/null
+apt-get install -y build-essential &>/dev/null #2>/dev/null
+if apt-get install -y cmake &>/dev/null; then
+ msg -verd "	CMAKE INSTALADO"
+ else
+ msg -verm2 "	FALLÓ"
+ return
+ fi
+cd $HOME
+if wget https://github.com/lacasitamx/SCRIPTMOD-LACASITA/raw/master/test/badvpn-master.zip &>/dev/null; then
+msg -ama "	DESCARGA CORRECTA"
+else
+msg -verm2 "	DESCARGA FALLIDA"
+return
+fi
+
+if unzip badvpn-master.zip &>/dev/null; then
+msg -verd "	Descomprimiendo archivo"
+else
+msg -verm2 "	La descomprecion ha fallado"
+return
+fi
+
+cd badvpn-master
+mkdir build
+cd build
+if cmake .. -DCMAKE_INSTALL_PREFIX="/" -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_UDPGW=1 &>/dev/null && make install &>/dev/null; then
+msg -verd "	Cmake con exito"
+else
+msg -verm2 "	Cmake Fallido"
+return
+fi
+cd $HOME
+rm -rf badvpn-master.zip
+#arm
+sleep 1s
+clear
+msg -ama " ACTIVANDO BADVPN 7300"
+echo -e "[Unit]
+Description=BadVPN UDPGW Service
+After=network.target\n
+[Service]
+Type=simple
+User=root
+WorkingDirectory=/root
+ExecStart=$(which badvpn-udpgw)  --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 10
+Restart=always
+RestartSec=3s\n
+[Install]
+WantedBy=multi-user.target" > /etc/systemd/system/badvpn.service
+
+    systemctl enable badvpn &>/dev/null
+    systemctl start badvpn &>/dev/null
+    systemctl daemon-reload &>/dev/null
+   # $(which badvpn) "start"
+ #   badvpn start
+    activado
+else
+msg -verm2 "	DETENIENDO BADVPN"
+    msg -bar
+    systemctl stop badvpn &>/dev/null
+    systemctl disable badvpn &>/dev/null
+    rm /etc/systemd/system/badvpn.service
+  #  rm /usr/bin/badvpn-udpgw &>/dev/null
+    [[ -e /bin/badvpn-udpgw ]] && rm -f /bin/badvpn-udpgw 
+	[[ -e /bin/badvpn ]] && rm -f /bin/badvpn
+	[[ -e /usr/local/bin/badvpn-udpgw ]] && rm -f /usr/local/bin/badvpn-udpgw
+	rm -rf $HOME/badvpn*
+	systemctl daemon-reload &>/dev/null
+    msg -verm " BADVPN DESACTIVADO"
+    fi
+}
+unistall(){
+msg -bar 
+	msg -tit
+    msg -ama "          DESACTIVADOR DE BADVPN (UDP)"
+    msg -bar
+    
+    systemctl stop badvpn &>/dev/null
+    systemctl disable badvpn &>/dev/null
+    rm -rf /etc/systemd/system/badvpn.service 
+    screen -r -S "badvpn" -X quit
+        screen -wipe 1>/dev/null 2>/dev/null
+        [[ $(grep -wc "badvpn" /etc/autostart) != '0' ]] && {
+		    sed -i '/badvpn/d' /etc/autostart
+		}
+    rm -rf $HOME/badvpn*
+    kill -9 $(ps x | grep badvpn | grep -v grep | awk '{print $1'}) > /dev/null 2>&1
+    killall badvpn-udpgw > /dev/null 2>&1
+    rm -rf /bin/badvpn-udpgw
+    [[ ! "$(ps x | grep badvpn | grep -v grep | awk '{print $1}')" ]] && msg -ne "                DESACTIVADO CON EXITO \n"
+    unset pid_badvpn
+	msg -bar
+	}
+	
+activado (){
+msg -bar
+    #puerto local  
+    [[ "$(ps x | grep badvpn | grep -v grep | awk '{print $1}')" ]] && msg -verd "                  ACTIVADO CON EXITO" || msg -ama "                 Falló"
+	msg -bar
+	}
+	
+BadVPN () {
+pid_badvpn=$(ps x | grep badvpn | grep -v grep | awk '{print $1}')
+
+clear
+msg -tit
+    msg -ama "  \e[1;43m\e[91mACTIVADOR DE BADVPN (7100-7200-7300-Multi Port)\e[0m"
+    msg -bar
+echo -e "$(msg -verd "[1]")$(msg -verm2 "➛ ")$(msg -azu "ACTIVAR BADVPN 7300") \e[92m(System)"
+echo -e "$(msg -verd "[2]")$(msg -verm2 "➛ ")$(msg -azu "ACTIVAR BADVPN 7300") \e[92m(Screen Directo)"
+echo -e "$(msg -verd "[3]")$(msg -verm2 "➛ ")$(msg -azu "AGREGAR +PORT BADVPN ")"
+echo -e "$(msg -verd "[4]")$(msg -verm2 "➛ ")$(msg -azu "APLICAR FIX CMAKE")"
+echo -e "$(msg -verd "[5]")$(msg -verm2 "➛ ")$(msg -azu "DETENER SERVICIO BADVPN")"
+echo -e "$(msg -verd "[0]")$(msg -verm2 "➛ ")$(msg -azu "VOLVER")"
+msg -bar
+read -p "Digite una opción (default 2): " -e -i 2 portasx
+#tput cuu1 && tput dl1
+if [[ ${portasx} = 1 ]]; then
+if [[ -z $pid_badvpn ]]; then
+msg -ama "	DESCARGANDO PAQUETES....."
+apt install wget -y &>/dev/null
+apt-get install -y gcc &>/dev/null # 2>/dev/null
+apt-get install -y make &>/dev/null #2>/dev/null
+apt-get install -y g++ &>/dev/null #2>/dev/null
+apt-get install -y openssl &>/dev/null #2>/dev/null
+apt-get install -y build-essential &>/dev/null #2>/dev/null
+if apt-get install cmake -y &>/dev/null; then
+msg -verd "	CMAKE INSTALADO"
+ else
+ msg -verm2 "	FALLÓ"
+ return
+ fi
+
+cd $HOME
+if wget https://github.com/lacasitamx/SCRIPTMOD-LACASITA/raw/master/test/badvpn-master.zip &>/dev/null; then
+msg -verd "	DESCARGA CORRECTA"
+else
+msg -verm2 "	DESCARGA FALLIDA"
+return
+fi
+
+if unzip badvpn-master.zip &>/dev/null; then
+msg -verd "	Descomprimiendo archivo"
+else
+msg -verm2 "	La descomprecion ha fallado"
+return
+fi
+
+cd badvpn-master
+mkdir build
+cd build
+if cmake .. -DCMAKE_INSTALL_PREFIX="/" -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_UDPGW=1 &>/dev/null && make install &>/dev/null; then
+msg -verd "	Cmake con exito"
+else
+msg -verm2 "	Cmake Fallido"
+return
+fi
+cd $HOME
+rm -rf badvpn-master.zip
+#rm -rf badvpn*
+#arm
+sleep 1s
+clear
+echo -e "[Unit]
+Description=BadVPN UDPGW Service
+After=network.target\n
+[Service]
+Type=simple
+User=root
+WorkingDirectory=/root
+ExecStart=$(which badvpn-udpgw)  --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 10
+Restart=always
+RestartSec=3s\n
+[Install]
+WantedBy=multi-user.target" > /etc/systemd/system/badvpn.service
+
+    systemctl enable badvpn &>/dev/null
+    systemctl start badvpn &>/dev/null
+    systemctl daemon-reload &>/dev/null
+activado
+else
+systemctl stop badvpn &>/dev/null
+    systemctl disable badvpn &>/dev/null
+    rm -rf /etc/systemd/system/badvpn.service 
+    msg -ne "                7300 DESACTIVADO CON EXITO \n"
+fi
+elif [[ ${portasx} = 2 ]]; then
+if [[ -z $pid_badvpn ]]; then
+if [[ ! -e /bin/badvpn-udpgw ]]; then
+    wget -O /bin/badvpn-udpgw https://raw.githubusercontent.com/lacasitamx/VPSMX/master/ArchivosUtilitarios/badvpn-udpgw &>/dev/null
+    chmod 777 /bin/badvpn-udpgw
+   fi
+screen -dmS badvpn $(which badvpn-udpgw) --listen-addr 127.0.0.1:7300 --max-clients 10000 --max-connections-for-client 10
+        [[ $(grep -wc "badvpn" /etc/autostart) = '0' ]] && {
+		    echo -e "ps x | grep 'badvpn' | grep -v 'grep' || screen -dmS badvpn $(which badvpn-udpgw) --listen-addr 127.0.0.1:7300 --max-clients 10000 --max-connections-for-client 10 --client-socket-sndbuf 10000" >> /etc/autostart
+		} || {
+		    sed -i '/udpvpn/d' /etc/autostart
+		    echo -e "ps x | grep 'badvpn' | grep -v 'grep' || screen -dmS badvpn $(which badvpn-udpgw) --listen-addr 127.0.0.1:7300 --max-clients 10000 --max-connections-for-client 10 --client-socket-sndbuf 10000" >> /etc/autostart
+		}
+		activado
+		else
+		unistall
+		fi
+   elif [[ ${portasx} = 3 ]]; then
+if [[ ! -e /bin/badvpn-udpgw ]]; then
+    wget -O /bin/badvpn-udpgw https://raw.githubusercontent.com/lacasitamx/VPSMX/master/ArchivosUtilitarios/badvpn-udpgw &>/dev/null
+    chmod 777 /bin/badvpn-udpgw
+   fi
+   read -p " Digite El Puerto Para Badvpn: " ud
+screen -dmS badvpn $(which badvpn-udpgw) --listen-addr 127.0.0.1:$ud --max-clients 10000 --max-connections-for-client 10
+echo -e "ps x | grep 'badvpn' | grep -v 'grep' || screen -dmS badvpn $(which badvpn-udpgw) --listen-addr 127.0.0.1:$ud --max-clients 10000 --max-connections-for-client 10 --client-socket-sndbuf 10000" >> /etc/autostart
+activado
+
+	elif [[ ${portasx} = 4 ]]; then
+	wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
+	tar xf cmake-3.8.2.tar.gz &>/dev/null
+	cd cmake-3.8.2
+	./configure &>/dev/null
+	sudo make install &>/dev/null
+	cd $HOME
+if wget https://github.com/lacasitamx/SCRIPTMOD-LACASITA/raw/master/test/badvpn-master.zip &>/dev/null; then
+msg -verd "	DESCARGA CORRECTA"
+else
+msg -verm2 "	DESCARGA FALLIDA"
+return
+fi
+
+if unzip badvpn-master.zip &>/dev/null; then
+msg -verd "	Descomprimiendo archivo"
+else
+msg -verm2 "	La descomprecion ha fallado"
+return
+fi
+
+cd badvpn-master
+mkdir build
+cd build
+if cmake .. -DCMAKE_INSTALL_PREFIX="/" -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_UDPGW=1 &>/dev/null && make install &>/dev/null; then
+msg -verd "	Cmake con exito"
+else
+msg -verm2 "	Cmake Fallido"
+return
+fi
+cd $HOME
+rm -rf badvpn-master.zip
+#rm -rf badvpn*
+#arm
+sleep 1s
+clear
+echo -e "[Unit]
+Description=BadVPN UDPGW Service
+After=network.target\n
+[Service]
+Type=simple
+User=root
+WorkingDirectory=/root
+ExecStart=$(which badvpn-udpgw)  --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 10
+Restart=always
+RestartSec=3s\n
+[Install]
+WantedBy=multi-user.target" > /etc/systemd/system/badvpn.service
+
+    systemctl enable badvpn &>/dev/null
+    systemctl start badvpn &>/dev/null
+    systemctl daemon-reload &>/dev/null
+activado
+unset pid_badvpn
+elif [[ ${portasx} = 5 ]]; then
+	unistall
+   elif [[ ${portasx} = 0 ]]; then
+   msg -verm "	SALIENDO"
+   exit
+   fi
+  
+
+
+}
+BadVPN

+ 59 - 0
LACASITAMX-v8.9x/Des/protocolos/chekuser.py

@@ -0,0 +1,59 @@
+from crypt import methods
+import subprocess
+import sys
+import typing as t
+import json
+
+from datetime import datetime
+from flask import Flask, jsonify, url_for, request, redirect
+
+LISTENING_PORT = int(sys.argv[1])
+FORMATO = sys.argv[2]
+app = Flask(__name__)
+app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True
+app.config['JSON_SORT_KEYS'] = False
+
+def get_expiry(account):
+  try:
+    chage = subprocess.Popen(('chage', '-l', account), stdout=subprocess.PIPE)
+    grep = subprocess.Popen(('grep', 'Account expires'), stdin=chage.stdout, stdout=subprocess.PIPE)
+    cut = subprocess.Popen('cut -d : -f2'.split(), stdin=grep.stdout, stdout=subprocess.PIPE)
+    output = cut.communicate()[0].strip()
+    output = output.decode("utf-8")
+    return output if output != 'never' else None
+  except subprocess.CalledProcessError as e:
+    return None
+
+def get_format(username):
+    if FORMATO == '1':
+        date = datetime.strptime(username, '%b %d, %Y')
+        format_date = datetime.strftime(date, '%Y%m%d')
+        return format_date
+    elif FORMATO == '2':
+        date = datetime.strptime(username, '%b %d, %Y')
+        format_date = datetime.strftime(date, '%d%m%Y')
+        return format_date
+
+@app.route('/checkUser',methods = ['POST', 'GET'])
+def check_user():
+    if request.method == 'POST':
+        try:
+            req_data = request.get_json()
+            user = req_data.get("user")
+            strDate = get_expiry(user)
+            x = get_format(strDate)
+            return x
+        except Exception as e:
+            return jsonify({'error': str(e)})
+    else:
+        try:
+            return 'Cannot GET /checkUser'
+        except Exception as e:
+            return jsonify({'error': str(e)})
+
+
+if __name__ == '__main__':
+    app.run(
+        host='0.0.0.0',
+        port=int(sys.argv[1]) if len(sys.argv) > 1 else LISTENING_PORT,
+    )

+ 310 - 0
LACASITAMX-v8.9x/Des/protocolos/chekuser.sh

@@ -0,0 +1,310 @@
+#!/bin/bash
+l="/usr/local/lib/sped" && [[ ! -d ${l} ]] && exit
+clear
+clear
+declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
+SCPdir="/etc/VPS-MX"
+SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
+SCPinst="${SCPdir}/protocolos"&& [[ ! -d ${SCPinst} ]] && exit
+
+chk_ip=$(wget -qO- ifconfig.me)
+
+mportas(){
+	unset portas
+	portas_var=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND")
+	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"
+}
+
+title(){
+    clear
+    msg -bar
+    if [[ -z $2 ]]; then
+      print_center -azu "$1"
+    else
+      print_center "$1" "$2"
+    fi
+    msg -bar
+ }
+ 
+back(){
+    msg -bar
+    echo -ne "$(msg -verd " [0]") $(msg -verm2 ">") " && msg -bra "\033[1;41mVOLVER"
+    msg -bar
+ }
+export numero='^[0-9]+$'
+del(){
+  for (( i = 0; i < $1; i++ )); do
+    tput cuu1 && tput dl1
+  done
+}
+selection_fun () {
+local selection="null"
+local range
+for((i=0; i<=$1; i++)); do range[$i]="$i "; done
+while [[ ! $(echo ${range[*]}|grep -w "$selection") ]]; do
+echo -ne "\033[1;37m$(fun_trans " ► Selecione una Opcion"): " >&2
+read selection
+tput cuu1 >&2 && tput dl1 >&2
+done
+echo $selection
+}
+in_opcion(){
+  unset opcion
+  if [[ -z $2 ]]; then
+      msg -azu " $1: " >&2
+  else
+      msg $1 " $2: " >&2
+  fi
+  read opcion
+  #echo "$opcion"
+}
+print_center(){
+  if [[ -z $2 ]]; then
+    text="$1"
+  else
+    col="$1"
+    text="$2"
+  fi
+
+  while read line; do
+    unset space
+    x=$(( ( 54 - ${#line}) / 2))
+    for (( i = 0; i < $x; i++ )); do
+      space+=' '
+    done
+    space+="$line"
+    if [[ -z $2 ]]; then
+      msg -azu "$space"
+    else
+      msg "$col" "$space"
+    fi
+  done <<< $(echo -e "$text")
+}
+
+menu_func(){
+  local options=${#@}
+  local array
+  for((num=1; num<=$options; num++)); do
+    echo -ne "$(msg -verd " [$num]") $(msg -verm2 ">") "
+    array=(${!num})
+    case ${array[0]} in
+      "-vd")echo -e "\033[1;33m[!]\033[1;32m ${array[@]:1}";;
+      "-vm")echo -e "\033[1;33m[!]\033[1;31m ${array[@]:1}";;
+      "-fi")echo -e "${array[@]:2} ${array[1]}";;
+  #    -bar|-bar2|-bar3|-bar4)echo -e "\033[1;37m${array[@]:1}\n$(msg ${array[0]})";;
+      *)echo -e "\033[1;37m${array[@]}";;
+    esac
+  done
+ }
+
+start(){
+	if [[ $(systemctl is-active chekuser) = "active" ]]; then
+		msg -azu "DESABILITANDO CHEKUSER"
+		systemctl stop chekuser &>/dev/null
+    	systemctl disable chekuser &>/dev/null
+    	rm -rf /etc/systemd/system/chekuser.service
+		msg -verd 'chekuser, se desactivo con exito!'
+		enter
+		return
+	fi
+
+	  while true; do
+	echo -ne "\033[1;37m"
+    read -p " INGRESE UN PUERTO: " chekuser
+	echo ""
+    [[ $(mportas|grep -w "$chekuser") ]] || break
+    echo -e "\033[1;33m Este puerto está en uso"
+    unset chekuser
+    done
+    echo " $(msg -ama "Puerto") $(msg -verd "$chekuser")"
+    msg -bar
+
+    print_center 'SELECCIONA UN FORMATO DE FECHA'
+    msg -bar
+    menu_func 'YYYY/MM/DD' 'DD/MM/YYYY'
+    msg -bar
+    date=$(selection_fun 2)
+    case $date in
+    	1)fecha="YYYY/MM/DD";;
+    	2)fecha="DD/MM/YYYY";;
+    esac
+    [[ $date = 0 ]] && return
+    del 5
+    echo " $(msg -ama "Formato") $(msg -verd "$fecha")"
+  #  enter
+    del 2
+
+    print_center -ama 'Instalandon python3-pip'
+    if apt install -y python3-pip &>/dev/null; then
+    	del 1
+    	print_center -verd 'Instalandon python3-pip ok'
+    else
+    	del 1
+    	print_center -verm2 'falla al instalar python3-pip\nintente instalar manualmente\n\ncomando manual >> apt install -y python3-pip\n\nresuelva esta falla para luego intentar'
+   # 	enter
+    	return
+    fi
+
+    print_center -ama 'Instalandon flask'
+    if pip3 install flask &>/dev/null; then
+    	del 1
+    	print_center -verd 'Instalandon flask ok'
+    else
+    	del 1
+    	print_center -verm2 '\nfalla al instalar flask\nintente instalar manualmente\n\ncomando manual >> pip3 install flask\n\nresuelva esta falla para luego intentar'
+   # 	enter
+    	return
+    fi
+
+    print_center -ama 'Iniciando servicio'
+
+    if [[ $(systemctl is-active chekuser) = "active" ]]; then
+    	systemctl stop chekuser &>/dev/null
+    	systemctl disable chekuser &>/dev/null
+    fi
+
+    rm -rf /etc/systemd/system/chekuser.service
+
+    echo -e "[Unit]
+Description=chekuser Service by @Rufu99
+After=network.target
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+User=root
+WorkingDirectory=/root
+ExecStart=/usr/bin/python3 /etc/VPS-MX/protocolos/chekuser.py $chekuser $date
+Restart=always
+RestartSec=3s
+
+[Install]
+WantedBy=multi-user.target" > /etc/systemd/system/chekuser.service
+
+# ExecStart=/usr/bin/python3 ${ADM_inst}/chekuser.py $chekuser $date
+# ps x|grep -v grep|grep chekuser.py|awk '{print $7}'
+
+	systemctl enable chekuser &>/dev/null
+	systemctl start chekuser &>/dev/null
+
+	if [[ $(systemctl is-active chekuser) = "active" ]]; then
+		title -verd 'Instalacion completa'
+		print_center -ama "URL: http://$chk_ip:$chekuser/checkUser"
+	else
+		systemctl stop chekuser &>/dev/null
+    	systemctl disable chekuser &>/dev/null
+    	rm -rf /etc/systemd/system/chekuser.service
+		print_center -verm2 'falla al iniciar servicio chekuser'
+	fi
+	#enter
+}
+
+mod_port(){
+	while true; do
+	echo -ne "\033[1;37m"
+    read -p " INGRESE UN PUERTO: " chekuser
+	echo ""
+    [[ $(mportas|grep -w "$chekuser") ]] || break
+    echo -e "\033[1;33m Este puerto está en uso"
+    unset chekuser
+    done
+    echo " $(msg -ama "Puerto") $(msg -verd "$chekuser")"
+    enter
+    port_chek=$(ps x|grep -v grep|grep chekuser.py|awk '{print $7}')
+    systemctl stop chekuser &>/dev/null
+    systemctl disable chekuser &>/dev/null
+    sed -i "s/$port_chek/$chekuser/g" /etc/systemd/system/chekuser.service
+    systemctl enable chekuser &>/dev/null
+    systemctl start chekuser &>/dev/null
+
+    if [[ $(systemctl is-active chekuser) = "active" ]]; then
+		title -verd 'puerto modificado'
+		print_center -ama "URL: http://$chk_ip:$chekuser/checkUser"
+	else
+		systemctl stop chekuser &>/dev/null
+    	systemctl disable chekuser &>/dev/null
+    	rm -rf /etc/systemd/system/chekuser.service
+		print_center -verm2 'algo salio mal\nfalla al iniciar servicio chekuser'
+	fi
+	#enter
+}
+
+mod_fdate(){
+	title 'SELECCIONA UN FORMATO DE FECHA'
+	menu_func 'YYYY/MM/DD' 'DD/MM/YYYY'
+    msg -bar
+    date=$(selection_fun 2)
+    case $date in
+    	1)fecha="YYYY/MM/DD";;
+    	2)fecha="DD/MM/YYYY";;
+    esac
+    [[ $date = 0 ]] && return
+    del 3
+    echo " $(msg -ama "Formato") $(msg -verd "$fecha")"
+    enter
+    formato=$(ps x|grep -v grep|grep chekuser.py|awk '{print $8}')
+    systemctl stop chekuser &>/dev/null
+    systemctl disable chekuser &>/dev/null
+    sed -i "s/$formato/$date/g" /etc/systemd/system/chekuser.service
+    systemctl enable chekuser &>/dev/null
+    systemctl start chekuser &>/dev/null
+
+    if [[ $(systemctl is-active chekuser) = "active" ]]; then
+		title -verd 'formato de fecha modificado'
+		print_center -ama "FORMATO: $fecha"
+	else
+		systemctl stop chekuser &>/dev/null
+    	systemctl disable chekuser &>/dev/null
+    	rm -rf /etc/systemd/system/chekuser.service
+		print_center -verm2 'algo salio mal\nfalla al iniciar servicio chekuser'
+	fi
+	#enter
+
+}
+
+menu_chekuser(){
+	title 'VERIFICACION DE USUARIOS ONLINE'
+	num=1
+	if [[ $(systemctl is-active chekuser) = "active" ]]; then
+		formato=$(ps x|grep -v grep|grep chekuser.py|awk '{print $8}')
+		case $formato in
+    		1)fecha_data="YYYY/MM/DD";;
+    		2)fecha_data="DD/MM/YYYY";;
+    	esac
+    msg -tit
+    	fecha_data=$(printf '%15s' "$fecha_data")
+		port_chek=$(ps x|grep -v grep|grep chekuser.py|awk '{print $7}')
+		msg -ama "\e[93mURL: http://$chk_ip:$port_chek/checkUser"
+		port_chek=$(printf '%8s' "$port_chek")
+	
+		echo " $(msg -verd '[1]') $(msg -verm2 '>') $(msg -verm2 'DESACTIVAR') $(msg -azu 'CHEKUSER')"
+		echo " $(msg -verd '[2]') $(msg -verm2 '>') $(msg -azu 'MODIFICAR PUERTO') $(msg -verd "$port_chek")"
+		echo " $(msg -verd '[3]') $(msg -verm2 '>') $(msg -azu 'MODIFICAR FORMATO') $(msg -verd "$fecha_data")"
+		msg -bar
+		num=3
+	else
+	msg -tit
+        print_center -verm2 'ADVERTENCIA!!!\nesto puede generar consumo de ram/cpu\nen metodos de coneccion inestables\nse recomienda no usar chekuser en esos casos'
+        msg -bar
+		echo " $(msg -verd '[1]') $(msg -verm2 '>') $(msg -verd 'ACTIVAR') $(msg -azu 'CHEKUSER')"
+		msg -bar
+	fi
+	back
+	opcion=$(selection_fun $num)
+	case $opcion in
+		1)start;;
+		2)mod_port;;
+		3)mod_fdate;;
+		0)return 1;;
+	esac
+}
+
+while [[  $? -eq 0 ]]; do
+  menu_chekuser
+done
+

+ 209 - 0
LACASITAMX-v8.9x/Des/protocolos/dropbear.sh

@@ -0,0 +1,209 @@
+#!/bin/bash
+#25/01/2021
+clear
+clear
+SCPdir="/etc/VPS-MX"
+SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
+SCPinst="${SCPdir}/protocolos"&& [[ ! -d ${SCPinst} ]] && exit
+declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
+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"
+}
+fun_ip () {
+if [[ -e /etc/VPS-MX/MEUIPvps ]]; then
+IP="$(cat /etc/VPS-MX/MEUIPvps)"
+else
+MEU_IP=$(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)
+MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
+[[ "$MEU_IP" != "$MEU_IP" ]] && IP="$MEU_IP2" || IP="$MEU_IP"
+echo "$MEU_IP" > /etc/VPS-MX/MEUIPvps
+fi
+}
+fun_eth () {
+eth=$(ifconfig | grep -v inet6 | grep -v lo | grep -v 127.0.0.1 | grep "encap:Ethernet" | awk '{print $1}')
+    [[ $eth != "" ]] && {
+    msg -bar
+    echo -e "${cor[3]} $(fun_trans "Aplicar Mejoras Para Mejorar Paquetes SSH?")"
+    echo -e "${cor[3]} $(fun_trans "Opcion Para Usuarios Avanzados")"
+    msg -bar
+    read -p " [S/N]: " -e -i n sshsn
+           [[ "$sshsn" = @(s|S|y|Y) ]] && {
+           echo -e "${cor[1]} $(fun_trans "Correccion de problemas de paquetes en SSH...")"
+           echo -e " $(fun_trans "Cual es la tasa RX")"
+           echo -ne "[ 1 - 999999999 ]: "; read rx
+           [[ "$rx" = "" ]] && rx="999999999"
+           echo -e " $(fun_trans "Cual es la tasa TX")"
+           echo -ne "[ 1 - 999999999 ]: "; read tx
+           [[ "$tx" = "" ]] && tx="999999999"
+           apt-get install ethtool -y > /dev/null 2>&1
+           ethtool -G $eth rx $rx tx $tx > /dev/null 2>&1
+           }
+     msg -bar
+     }
+}
+
+fun_bar () {
+comando="$1"
+ _=$(
+$comando > /dev/null 2>&1
+) & > /dev/null
+pid=$!
+while [[ -d /proc/$pid ]]; do
+echo -ne " \033[1;33m["
+   for((i=0; i<20; i++)); do
+   echo -ne "\033[1;31m##"
+   sleep 0.8
+   done
+echo -ne "\033[1;33m]"
+sleep 1s
+echo
+tput cuu1 && tput dl1
+done
+echo -ne " \033[1;33m[\033[1;31m########################################\033[1;33m] - \033[1;32m100%\033[0m\n"
+sleep 1s
+}
+fun_dropbear () {
+ [[ -e /etc/default/dropbear ]] && {
+ msg -bar
+ echo -e "\033[1;32m $(fun_trans ${id} "REMOVIENDO DROPBEAR")"
+ msg -bar
+ service dropbear stop & >/dev/null 2>&1
+ fun_bar "apt-get remove dropbear -y"
+ msg -bar
+ echo -e "\033[1;32m $(fun_trans "Dropbear Removido")"
+ msg -bar
+ [[ -e /etc/default/dropbear ]] && rm /etc/default/dropbear
+ return 0
+ }
+msg -bar
+msg -tit
+echo -e "\033[1;32m $(fun_trans "   INSTALADOR DROPBEAR")"
+msg -bar
+echo -e "\033[1;31m $(fun_trans "Seleccione Puertos Validados en orden secuencial:\n")\033[1;32m 22 80 81 82 85 90\033[1;37m"
+msg -bar
+echo -ne "\033[1;31m $(fun_trans "Digite  Puertos"): \033[1;37m" && read DPORT
+tput cuu1 && tput dl1
+TTOTAL=($DPORT)
+    for((i=0; i<${#TTOTAL[@]}; i++)); do
+        [[ $(mportas|grep "${TTOTAL[$i]}") = "" ]] && {
+        echo -e "\033[1;33m $(fun_trans  "Puerto Elegido:")\033[1;32m ${TTOTAL[$i]} OK"
+        PORT="$PORT ${TTOTAL[$i]}"
+        } || {
+        echo -e "\033[1;33m $(fun_trans  "Puerto Elegido:")\033[1;31m ${TTOTAL[$i]} FAIL"
+        }
+   done
+  [[  -z $PORT ]] && {
+  echo -e "\033[1;31m $(fun_trans  "Ningun Puerto Valida Fue Elegido")\033[0m"
+  return 1
+  }
+sysvar=$(cat -n /etc/issue |grep 1 |cut -d' ' -f6,7,8 |sed 's/1//' |sed 's/      //' | grep -o Ubuntu)
+[[ ! $(cat /etc/shells|grep "/bin/false") ]] && echo -e "/bin/false" >> /etc/shells
+[[ "$sysvar" != "" ]] && {
+echo -e "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
+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" > /etc/ssh/sshd_config
+msg -bar
+echo -e "${cor[2]} $(fun_trans ${id} "Instalando dropbear")"
+msg -bar
+fun_bar "apt-get install dropbear -y"
+apt-get install dropbear -y > /dev/null 2>&1
+msg -bar
+touch /etc/dropbear/banner
+msg -bar
+echo -e "${cor[2]} $(fun_trans ${id} "Configurando dropbear")"
+cat <<EOF > /etc/default/dropbear
+NO_START=0
+DROPBEAR_EXTRA_ARGS="VAR"
+DROPBEAR_BANNER="/etc/dropbear/banner"
+DROPBEAR_RECEIVE_WINDOW=65536
+EOF
+for dpts in $(echo $PORT); do
+sed -i "s/VAR/-p $dpts VAR/g" /etc/default/dropbear
+done
+sed -i "s/VAR//g" /etc/default/dropbear
+} || {
+echo -e "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
+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" > /etc/ssh/sshd_config
+echo -e "${cor[2]} $(fun_trans  "Instalando dropbear")"
+msg -bar
+fun_bar "apt-get install dropbear -y"
+touch /etc/dropbear/banner
+msg -bar
+echo -e "${cor[2]} $(fun_trans  "Configurando dropbear")"
+msg -bar
+cat <<EOF > /etc/default/dropbear
+NO_START=0
+DROPBEAR_EXTRA_ARGS="VAR"
+DROPBEAR_BANNER="/etc/dropbear/banner"
+DROPBEAR_RECEIVE_WINDOW=65536
+EOF
+for dpts in $(echo $PORT); do
+sed -i "s/VAR/-p $dpts VAR/g" /etc/default/dropbear
+done
+sed -i "s/VAR//g" /etc/default/dropbear
+}
+fun_eth &>/dev/null
+service ssh restart > /dev/null 2>&1
+service dropbear restart > /dev/null 2>&1
+echo -e "${cor[3]} $(fun_trans "Su dropbear ha sido configurado con EXITO")"
+msg -bar
+#UFW
+for ufww in $(mportas|awk '{print $2}'); do
+ufw allow $ufww > /dev/null 2>&1
+done
+}
+fun_dropbear

+ 857 - 0
LACASITAMX-v8.9x/Des/protocolos/openvpn.sh

@@ -0,0 +1,857 @@
+#!/bin/bash
+#25/01/2021
+clear
+clear
+msg -bar
+SCPdir="/etc/VPS-MX" && [[ ! -d ${SCPdir} ]] && exit 1
+SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
+SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPinst} ]] && exit
+SCPidioma="${SCPdir}/idioma" && [[ ! -e ${SCPidioma} ]] && touch ${SCPidioma}
+#timedatectl set-timezone UTC
+# Detect Debian users running the script with "sh" instead of bash
+if readlink /proc/$$/exe | grep -q "dash"; then
+    echo "Este script se utiliza con bash"
+    exit
+fi
+
+if [[ "$EUID" -ne 0 ]]; then
+    echo "Sorry, solo funciona como root"
+    exit
+fi
+
+if [[ ! -e /dev/net/tun ]]; then
+    echo "El TUN device no esta disponible
+Necesitas habilitar TUN antes de usar este script"
+    exit
+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 "Tu sistema operativo no esta disponible para este script"
+    exit
+fi
+
+agrega_dns() {
+    msg -ama " Escriba el HOST DNS que desea Agregar"
+    read -p " [NewDNS]: " SDNS
+    cat /etc/hosts | grep -v "$SDNS" >/etc/hosts.bak && mv -f /etc/hosts.bak /etc/hosts
+    if [[ -e /etc/opendns ]]; then
+        cat /etc/opendns >/tmp/opnbak
+        mv -f /tmp/opnbak /etc/opendns
+        echo "$SDNS" >>/etc/opendns
+    else
+        echo "$SDNS" >/etc/opendns
+    fi
+    [[ -z $NEWDNS ]] && NEWDNS="$SDNS" || NEWDNS="$NEWDNS $SDNS"
+    unset SDNS
+}
+mportas() {
+    unset portas
+    portas_var=$(lsof -V -i -P -n | grep -v "ESTABLISHED" | grep -v "COMMAND")
+    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"
+}
+dns_fun() {
+    case $1 in
+    3) dns[$2]='push "dhcp-option DNS 1.0.0.1"' ;;
+    4) dns[$2]='push "dhcp-option DNS 1.1.1.1"' ;;
+    5) dns[$2]='push "dhcp-option DNS 9.9.9.9"' ;;
+    6) dns[$2]='push "dhcp-option DNS 1.1.1.1"' ;;
+    7) dns[$2]='push "dhcp-option DNS 80.67.169.40"' ;;
+    8) dns[$2]='push "dhcp-option DNS 80.67.169.12"' ;;
+    9) dns[$2]='push "dhcp-option DNS 84.200.69.80"' ;;
+    10) dns[$2]='push "dhcp-option DNS 84.200.70.40"' ;;
+    11) dns[$2]='push "dhcp-option DNS 208.67.222.222"' ;;
+    12) dns[$2]='push "dhcp-option DNS 208.67.220.220"' ;;
+    13) dns[$2]='push "dhcp-option DNS 8.8.8.8"' ;;
+    14) dns[$2]='push "dhcp-option DNS 8.8.4.4"' ;;
+    15) dns[$2]='push "dhcp-option DNS 77.88.8.8"' ;;
+    16) dns[$2]='push "dhcp-option DNS 77.88.8.1"' ;;
+    17) dns[$2]='push "dhcp-option DNS 176.103.130.130"' ;;
+    18) dns[$2]='push "dhcp-option DNS 176.103.130.131"' ;;
+    esac
+}
+meu_ip() {
+    if [[ -e /etc/VPS-MX/MEUIPvps ]]; then
+        echo "$(cat /etc/VPS-MX/MEUIPvps)"
+    else
+        MEU_IP=$(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)
+        MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
+        [[ "$MEU_IP" != "$MEU_IP2" ]] && echo "$MEU_IP2" || echo "$MEU_IP"
+        echo "$MEU_IP" >/etc/VPS-MX/MEUIPvps
+    fi
+}
+IP="$(meu_ip)"
+
+instala_ovpn2() {
+    msg -bar3
+    clear
+    msg -bar
+    msg -tit
+    echo -e " \033[1;32m     INSTALADOR DE OPENVPN | VPS-MX By @Kalix1"
+    msg -bar
+    # OpenVPN setup and first user creation
+    echo -e " \033[1;97mSe necesitan ciertos parametros para configurar OpenVPN."
+    echo "Configuracion por default solo presiona ENTER."
+    echo "Primero, cual es la IPv4 que quieres para OpenVPN"
+    echo "Detectando..."
+    msg -bar
+    # Autodetect IP address and pre-fill for the user
+    IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127 \.[0-9]{1,3} \.[0-9]{1,3} \.[0-9]{1,3}' | grep -oE '[0-9]{1,3} \.[0-9]{1,3} \.[0-9]{1,3} \.[0-9]{1,3}' | head -1)
+    read -p "IP address: " -e -i $IP IP
+    # If $IP is a private IP address, the server must be behind NAT
+    if echo "$IP" | grep -qE '^(10 \.|172 \.1[6789] \.|172 \.2[0-9] \.|172 \.3[01] \.|192 \.168)'; then
+        echo
+        echo "Este servidor esta detras de una red NAT?"
+        read -p "IP  Publica  / hostname: " -e PUBLICIP
+    fi
+    msg -bar
+    msg -ama "Que protocolo necesitas para las conexiones OpenVPN?"
+    msg -bar
+    echo "   1) UDP (recomendada)"
+    echo "   2) TCP"
+    msg -bar
+    read -p "Protocolo [1-2]: " -e -i 1 PROTOCOL
+    case $PROTOCOL in
+    1)
+        PROTOCOL=udp
+        ;;
+    2)
+        PROTOCOL=tcp
+        ;;
+    esac
+    msg -bar
+    msg -ama "Que puerto necesitas en OpenVPN (Default 1194)?"
+    msg -bar
+    read -p "Puerto: " -e -i 1194 PORT
+    msg -bar
+    msg -ama "Cual DNS usaras en tu VPN?"
+    msg -bar
+    echo "   1) Actuales en el VPS"
+    echo "   2) 1.1.1.1"
+    echo "   3) Google"
+    echo "   4) OpenDNS"
+    echo "   5) Verisign"
+    msg -bar
+    read -p "DNS [1-5]: " -e -i 1 DNS
+    #CIPHER
+    msg -bar
+    msg -ama " Elija que codificacion desea para el canal de datos:"
+    msg -bar
+    echo "   1) AES-128-CBC"
+    echo "   2) AES-192-CBC"
+    echo "   3) AES-256-CBC"
+    echo "   4) CAMELLIA-128-CBC"
+    echo "   5) CAMELLIA-192-CBC"
+    echo "   6) CAMELLIA-256-CBC"
+    echo "   7) SEED-CBC"
+    echo "   8) NONE"
+    msg -bar
+    while [[ $CIPHER != @([1-8]) ]]; do
+        read -p " Cipher [1-7]: " -e -i 1 CIPHER
+    done
+    case $CIPHER in
+    1) CIPHER="cipher AES-128-CBC" ;;
+    2) CIPHER="cipher AES-192-CBC" ;;
+    3) CIPHER="cipher AES-256-CBC" ;;
+    4) CIPHER="cipher CAMELLIA-128-CBC" ;;
+    5) CIPHER="cipher CAMELLIA-192-CBC" ;;
+    6) CIPHER="cipher CAMELLIA-256-CBC" ;;
+    7) CIPHER="cipher SEED-CBC" ;;
+    8) CIPHER="cipher none" ;;
+    esac
+    msg -bar
+    msg -ama " Estamos listos para configurar su servidor OpenVPN"
+    msg -bar
+    read -n1 -r -p "Presiona cualquier tecla para continuar..."
+    if [[ "$OS" = 'debian' ]]; then
+        apt-get update
+        apt-get install openvpn iptables openssl ca-certificates -y
+    else
+        #
+        yum install epel-release -y
+        yum install openvpn iptables openssl ca-certificates -y
+    fi
+    # Get easy-rsa
+    EASYRSAURL='https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.8/EasyRSA-3.0.8.tgz'
+    wget -O ~/easyrsa.tgz "$EASYRSAURL" 2>/dev/null || curl -Lo ~/easyrsa.tgz "$EASYRSAURL"
+    tar xzf ~/easyrsa.tgz -C ~/
+    mv ~/EasyRSA-3.0.8/ /etc/openvpn/
+    mv /etc/openvpn/EasyRSA-3.0.8/ /etc/openvpn/easy-rsa/
+    chown -R root:root /etc/openvpn/easy-rsa/
+    rm -f ~/easyrsa.tgz
+    cd /etc/openvpn/easy-rsa/
+    #
+    ./easyrsa init-pki
+    ./easyrsa --batch build-ca nopass
+    ./easyrsa gen-dh
+    ./easyrsa build-server-full server nopass
+    EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl
+    #
+    cp pki/ca.crt pki/private/ca.key pki/dh.pem pki/issued/server.crt pki/private/server.key pki/crl.pem /etc/openvpn
+    #
+    chown nobody:$GROUPNAME /etc/openvpn/crl.pem
+    #
+    openvpn --genkey --secret /etc/openvpn/ta.key
+    #
+    echo "port $PORT
+proto $PROTOCOL
+dev tun
+sndbuf 0
+rcvbuf 0
+ca ca.crt
+cert server.crt
+key server.key
+dh dh.pem
+auth SHA512
+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)
+        #
+        #
+        if grep -q "127.0.0.53" "/etc/resolv.conf"; then
+            RESOLVCONF='/run/systemd/resolve/resolv.conf'
+        else
+            RESOLVCONF='/etc/resolv.conf'
+        fi
+        #
+        grep -v '#' $RESOLVCONF | 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 1.1.1.1"' >>/etc/openvpn/server.conf
+        echo 'push "dhcp-option DNS 1.0.0.1"' >>/etc/openvpn/server.conf
+        ;;
+    3)
+        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
+        ;;
+    4)
+        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
+        ;;
+    5)
+        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
+        ;;
+    esac
+
+    echo "keepalive 10 120
+${CIPHER}
+user nobody
+group $GROUPNAME
+persist-key
+persist-tun
+status openvpn-status.log
+verb 3
+crl-verify crl.pem" >>/etc/openvpn/server.conf
+    updatedb
+    PLUGIN=$(locate openvpn-plugin-auth-pam.so | head -1)
+    [[ ! -z $(echo ${PLUGIN}) ]] && {
+        echo "client-to-client
+client-cert-not-required
+username-as-common-name
+plugin $PLUGIN login" >>/etc/openvpn/server.conf
+    }
+    #
+    echo 'net.ipv4.ip_forward=1' >/etc/sysctl.d/30-openvpn-forward.conf
+    #
+    echo 1 >/proc/sys/net/ipv4/ip_forward
+    if pgrep firewalld; then
+        #
+        #
+        #
+        #
+        firewall-cmd --zone=public --add-port=$PORT/$PROTOCOL
+        firewall-cmd --zone=trusted --add-source=10.8.0.0/24
+        firewall-cmd --permanent --zone=public --add-port=$PORT/$PROTOCOL
+        firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24
+        #
+        firewall-cmd --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+        firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+    else
+        #
+        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 ! -d 10.8.0.0/24 -j SNAT --to $IP
+        sed -i "1 a \iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL
+        if iptables -L -n | grep -qE '^(REJECT|DROP)'; then
+            #
+            #
+            #
+            iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT
+            iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT
+            iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
+            sed -i "1 a \iptables -I INPUT -p $PROTOCOL --dport $PORT -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
+    fi
+    #
+    if sestatus 2>/dev/null | grep "Current mode" | grep -q "enforcing" && [[ "$PORT" != '1194' ]]; then
+        #
+        if ! hash semanage 2>/dev/null; then
+            yum install policycoreutils-python -y
+        fi
+        semanage port -a -t openvpn_port_t -p $PROTOCOL $PORT
+    fi
+    #
+    if [[ "$OS" = 'debian' ]]; then
+        #
+        if pgrep systemd-journal; then
+            systemctl restart openvpn@server.service
+        else
+            /etc/init.d/openvpn restart
+        fi
+    else
+        if pgrep systemd-journal; then
+            systemctl restart openvpn@server.service
+            systemctl enable openvpn@server.service
+        else
+            service openvpn restart
+            chkconfig openvpn on
+        fi
+    fi
+    #
+    if [[ "$PUBLICIP" != "" ]]; then
+        IP=$PUBLICIP
+    fi
+    #
+    echo "# OVPN_ACCESS_SERVER_PROFILE=VPS-MX
+client
+dev tun
+proto $PROTOCOL
+sndbuf 0
+rcvbuf 0
+remote $IP $PORT
+resolv-retry infinite
+nobind
+persist-key
+persist-tun
+remote-cert-tls server
+auth SHA512
+${CIPHER}
+setenv opt block-outside-dns
+key-direction 1
+verb 3
+auth-user-pass" >/etc/openvpn/client-common.txt
+    msg -bar
+    msg -ama " Ahora crear una SSH para generar el (.ovpn)!"
+    msg -bar
+    echo -e " \033[1;32m Configuracion Finalizada!"
+    msg -bar
+
+}
+
+instala_ovpn() {
+    parametros_iniciais() {
+        #Verifica o Sistema
+        [[ "$EUID" -ne 0 ]] && echo " Lo siento, usted necesita ejecutar esto como ROOT" && exit 1
+        [[ ! -e /dev/net/tun ]] && echo " TUN no esta Disponible" && exit 1
+        if [[ -e /etc/debian_version ]]; then
+            OS="debian"
+            VERSION_ID=$(cat /etc/os-release | grep "VERSION_ID")
+            IPTABLES='/etc/iptables/iptables.rules'
+            [[ ! -d /etc/iptables ]] && mkdir /etc/iptables
+            [[ ! -e $IPTABLES ]] && touch $IPTABLES
+            SYSCTL='/etc/sysctl.conf'
+            [[ "$VERSION_ID" != 'VERSION_ID="7"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="8"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="9"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="14.04"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="16.04"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="18.04"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="17.10"' ]] && {
+                echo " Su vercion de Debian / Ubuntu no Soportada."
+                while [[ $CONTINUE != @(y|Y|s|S|n|N) ]]; do
+                    read -p "Continuar ? [y/n]: " -e CONTINUE
+                done
+                [[ "$CONTINUE" = @(n|N) ]] && exit 1
+            }
+        else
+            msg -ama " Parece que no estas ejecutando este instalador en un sistema Debian o Ubuntu"
+            msg -bar
+            return 1
+        fi
+        #Pega Interface
+        NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )( \S+)' | head -1)
+
+    }
+    add_repo() {
+        #INSTALACAO E UPDATE DO REPOSITORIO
+        # Debian 7
+        if [[ "$VERSION_ID" = 'VERSION_ID="7"' ]]; then
+            echo "deb http://build.openvpn.net/debian/openvpn/stable wheezy main" >/etc/apt/sources.list.d/openvpn.list
+            wget -q -O - https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add - >/dev/null 2>&1
+        # Debian 8
+        elif [[ "$VERSION_ID" = 'VERSION_ID="8"' ]]; then
+            echo "deb http://build.openvpn.net/debian/openvpn/stable jessie main" >/etc/apt/sources.list.d/openvpn.list
+            wget -q -O - https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add - >/dev/null 2>&1
+        # Ubuntu 14.04
+        elif [[ "$VERSION_ID" = 'VERSION_ID="14.04"' ]]; then
+            echo "deb http://build.openvpn.net/debian/openvpn/stable trusty main" >/etc/apt/sources.list.d/openvpn.list
+            wget -q -O - https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add - >/dev/null 2>&1
+        # Ubuntu 16.04
+        elif [[ "$VERSION_ID" = 'VERSION_ID="16.04"' ]]; then
+            echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" >/etc/apt/sources.list.d/openvpn.list
+            wget -q -O - https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add - >/dev/null 2>&1
+        # Ubuntu 18.04
+        elif [[ "$VERSION_ID" = 'VERSION_ID="18.04"' ]]; then
+            apt-get remove openvpn -y >/dev/null 2>&1
+            rm -rf /etc/apt/sources.list.d/openvpn.list >/dev/null 2>&1
+            echo "deb http://build.openvpn.net/debian/openvpn/stable bionic main" >/etc/apt/sources.list.d/openvpn.list
+            wget -q -O - https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add - >/dev/null 2>&1
+        fi
+    }
+    coleta_variaveis() {
+        echo -e " \033[1;32m     INSTALADOR DE OPENVPN | VPS-MX By @Kalix1"
+        msg -bar
+        msg -ne " Confirme su IP"
+        read -p ": " -e -i $IP ip
+        msg -bar
+        msg -ama " Que puerto desea usar?"
+        msg -bar
+        while true; do
+            read -p " Port: " -e -i 1194 PORT
+            [[ $(mportas | grep -w "$PORT") ]] || break
+            echo -e " \033[1;33m Este puerto esta en uso \033[0m"
+            unset PORT
+        done
+        msg -bar
+        echo -e " \033[1;31m Que protocolo desea para las conexiones OPENVPN?"
+        echo -e " \033[1;31m A menos que UDP este bloqueado, no utilice TCP (es mas lento)"
+        #PROTOCOLO
+        while [[ $PROTOCOL != @(UDP|TCP) ]]; do
+            read -p " Protocol [UDP/TCP]: " -e -i TCP PROTOCOL
+        done
+        [[ $PROTOCOL = "UDP" ]] && PROTOCOL=udp
+        [[ $PROTOCOL = "TCP" ]] && PROTOCOL=tcp
+        #DNS
+        msg -bar
+        msg -ama " Que DNS desea utilizar?"
+        msg -bar
+        echo "   1) Usar DNS de sistema "
+        echo "   2) Cloudflare"
+        echo "   3) Quad"
+        echo "   4) FDN"
+        echo "   5) DNS.WATCH"
+        echo "   6) OpenDNS"
+        echo "   7) Google DNS"
+        echo "   8) Yandex Basic"
+        echo "   9) AdGuard DNS"
+        msg -bar
+        while [[ $DNS != @([1-9]) ]]; do
+            read -p " DNS [1-9]: " -e -i 1 DNS
+        done
+        #CIPHER
+        msg -bar
+        msg -ama " Elija que codificacion desea para el canal de datos:"
+        msg -bar
+        echo "   1) AES-128-CBC"
+        echo "   2) AES-192-CBC"
+        echo "   3) AES-256-CBC"
+        echo "   4) CAMELLIA-128-CBC"
+        echo "   5) CAMELLIA-192-CBC"
+        echo "   6) CAMELLIA-256-CBC"
+        echo "   7) SEED-CBC"
+        msg -bar
+        while [[ $CIPHER != @([1-7]) ]]; do
+            read -p " Cipher [1-7]: " -e -i 1 CIPHER
+        done
+        case $CIPHER in
+        1) CIPHER="cipher AES-128-CBC" ;;
+        2) CIPHER="cipher AES-192-CBC" ;;
+        3) CIPHER="cipher AES-256-CBC" ;;
+        4) CIPHER="cipher CAMELLIA-128-CBC" ;;
+        5) CIPHER="cipher CAMELLIA-192-CBC" ;;
+        6) CIPHER="cipher CAMELLIA-256-CBC" ;;
+        7) CIPHER="cipher SEED-CBC" ;;
+        esac
+        msg -bar
+        msg -ama " Estamos listos para configurar su servidor OpenVPN"
+        msg -bar
+        read -n1 -r -p " Enter para Continuar ..."
+        tput cuu1 && tput dl1
+    }
+    parametros_iniciais # BREVE VERIFICACAO
+    coleta_variaveis    # COLETA VARIAVEIS PARA INSTALAÇÃO
+    add_repo            # ATUALIZA REPOSITÓRIO OPENVPN E INSTALA OPENVPN
+    # Cria Diretorio
+    [[ ! -d /etc/openvpn ]] && mkdir /etc/openvpn
+    # Install openvpn
+    echo -ne "  \033[1;31m[ ! ] apt-get update"
+    apt-get update -q >/dev/null 2>&1 && echo -e " \033[1;32m [OK]" || echo -e " \033[1;31m [FAIL]"
+    echo -ne "  \033[1;31m[ ! ] apt-get install openvpn curl openssl"
+    apt-get install -qy openvpn curl >/dev/null 2>&1 && apt-get install openssl ca-certificates -y >/dev/null 2>&1 && echo -e " \033[1;32m [OK]" || echo -e " \033[1;31m [FAIL]"
+    SERVER_IP="$(meu_ip)" # IP Address
+    [[ -z "${SERVER_IP}" ]] && SERVER_IP=$(ip a | awk -F"[ /]+" '/global/ && !/127.0/ {print $3; exit}')
+    echo -ne "  \033[1;31m[ ! ] Generating Server Config" # Gerando server.con
+    (
+        case $DNS in
+        1)
+            i=0
+            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
+                dns[$i]="push  \"dhcp-option DNS $line \""
+            done
+            [[ ! "${dns[@]}" ]] && dns[0]='push "dhcp-option DNS 8.8.8.8"' && dns[1]='push "dhcp-option DNS 8.8.4.4"'
+            ;;
+        2) dns_fun 3 && dns_fun 4 ;;
+        3) dns_fun 5 && dns_fun 6 ;;
+        4) dns_fun 7 && dns_fun 8 ;;
+        5) dns_fun 9 && dns_fun 10 ;;
+        6) dns_fun 11 && dns_fun 12 ;;
+        7) dns_fun 13 && dns_fun 14 ;;
+        8) dns_fun 15 && dns_fun 16 ;;
+        9) dns_fun 17 && dns_fun 18 ;;
+        esac
+        echo 01 >/etc/openvpn/ca.srl
+        while [[ ! -e /etc/openvpn/dh.pem || -z $(cat /etc/openvpn/dh.pem) ]]; do
+            openssl dhparam -out /etc/openvpn/dh.pem 2048 &>/dev/null
+        done
+        while [[ ! -e /etc/openvpn/ca-key.pem || -z $(cat /etc/openvpn/ca-key.pem) ]]; do
+            openssl genrsa -out /etc/openvpn/ca-key.pem 2048 &>/dev/null
+        done
+        chmod 600 /etc/openvpn/ca-key.pem &>/dev/null
+        while [[ ! -e /etc/openvpn/ca-csr.pem || -z $(cat /etc/openvpn/ca-csr.pem) ]]; do
+            openssl req -new -key /etc/openvpn/ca-key.pem -out /etc/openvpn/ca-csr.pem -subj /CN=OpenVPN-CA/ &>/dev/null
+        done
+        while [[ ! -e /etc/openvpn/ca.pem || -z $(cat /etc/openvpn/ca.pem) ]]; do
+            openssl x509 -req -in /etc/openvpn/ca-csr.pem -out /etc/openvpn/ca.pem -signkey /etc/openvpn/ca-key.pem -days 365 &>/dev/null
+        done
+        cat >/etc/openvpn/server.conf <<EOF
+server 10.8.0.0 255.255.255.0
+verb 3
+duplicate-cn
+key client-key.pem
+ca ca.pem
+cert client-cert.pem
+dh dh.pem
+keepalive 10 120
+persist-key
+persist-tun
+comp-lzo
+float
+push "redirect-gateway def1 bypass-dhcp"
+${dns[0]}
+${dns[1]}
+
+user nobody
+group nogroup
+
+${CIPHER}
+proto ${PROTOCOL}
+port $PORT
+dev tun
+status openvpn-status.log
+EOF
+        updatedb
+        PLUGIN=$(locate openvpn-plugin-auth-pam.so | head -1)
+        [[ ! -z $(echo ${PLUGIN}) ]] && {
+            echo "client-to-client
+client-cert-not-required
+username-as-common-name
+plugin $PLUGIN login" >>/etc/openvpn/server.conf
+        }
+    ) && echo -e " \033[1;32m [OK]" || echo -e " \033[1;31m [FAIL]"
+    echo -ne "  \033[1;31m[ ! ] Generating CA Config" # Generate CA Config
+    (
+        while [[ ! -e /etc/openvpn/client-key.pem || -z $(cat /etc/openvpn/client-key.pem) ]]; do
+            openssl genrsa -out /etc/openvpn/client-key.pem 2048 &>/dev/null
+        done
+        chmod 600 /etc/openvpn/client-key.pem
+        while [[ ! -e /etc/openvpn/client-csr.pem || -z $(cat /etc/openvpn/client-csr.pem) ]]; do
+            openssl req -new -key /etc/openvpn/client-key.pem -out /etc/openvpn/client-csr.pem -subj /CN=OpenVPN-Client/ &>/dev/null
+        done
+        while [[ ! -e /etc/openvpn/client-cert.pem || -z $(cat /etc/openvpn/client-cert.pem) ]]; do
+            openssl x509 -req -in /etc/openvpn/client-csr.pem -out /etc/openvpn/client-cert.pem -CA /etc/openvpn/ca.pem -CAkey /etc/openvpn/ca-key.pem -days 365 &>/dev/null
+        done
+    ) && echo -e " \033[1;32m [OK]" || echo -e " \033[1;31m [FAIL]"
+    teste_porta() {
+        msg -bar
+        echo -ne "  \033[1;31m$(fun_trans ${id} "Verificando"):"
+        sleep 1s
+        [[ ! $(mportas | grep "$1") ]] && {
+            echo -e " \033[1;33m [FAIL] \033[0m"
+        } || {
+            echo -e " \033[1;32m [Pass] \033[0m"
+            return 1
+        }
+    }
+    msg -bar
+    echo -e " \033[1;33m Ahora Necesitamos un Proxy SQUID o PYTHON-OPENVPN"
+    echo -e " \033[1;33m Si no existe un proxy en la puerta, un proxy Python sera abierto!"
+    msg -bar
+    while [[ $? != "1" ]]; do
+        read -p " Confirme el Puerto(Proxy) " -e -i 80 PPROXY
+        teste_porta $PPROXY
+    done
+    cat >/etc/openvpn/client-common.txt <<EOF
+# OVPN_ACCESS_SERVER_PROFILE=VPS-MX
+client
+nobind
+dev tun
+redirect-gateway def1 bypass-dhcp
+remote-random
+remote ${SERVER_IP} ${PORT} ${PROTOCOL}
+http-proxy ${SERVER_IP} ${PPROXY}
+$CIPHER
+comp-lzo yes
+keepalive 10 20
+float
+auth-user-pass
+EOF
+    # Iptables
+    if [[ ! -f /proc/user_beancounters ]]; then
+        INTIP=$(ip a | awk -F"[ /]+" '/global/ && !/127.0/ {print $3; exit}')
+        N_INT=$(ip a | awk -v sip="$INTIP" '$0 ~ sip { print $7}')
+        iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o $N_INT -j MASQUERADE
+        iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $SERVER_IP
+    else
+        iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source $SERVER_IP
+
+    fi
+    iptables-save >/etc/iptables.conf
+    cat >/etc/network/if-up.d/iptables <<EOF
+#!/bin/sh
+iptables-restore < /etc/iptables.conf
+EOF
+    chmod +x /etc/network/if-up.d/iptables
+    # Enable net.ipv4.ip_forward
+    sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf
+    echo 1 >/proc/sys/net/ipv4/ip_forward
+    # Regras de Firewall
+    if pgrep firewalld; then
+        if [[ "$PROTOCOL" = 'udp' ]]; then
+            firewall-cmd --zone=public --add-port=$PORT/udp
+            firewall-cmd --permanent --zone=public --add-port=$PORT/udp
+        elif [[ "$PROTOCOL" = 'tcp' ]]; then
+            firewall-cmd --zone=public --add-port=$PORT/tcp
+            firewall-cmd --permanent --zone=public --add-port=$PORT/tcp
+        fi
+        firewall-cmd --zone=trusted --add-source=10.8.0.0/24
+        firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24
+    fi
+    if iptables -L -n | grep -qE 'REJECT|DROP'; then
+        if [[ "$PROTOCOL" = 'udp' ]]; then
+            iptables -I INPUT -p udp --dport $PORT -j ACCEPT
+        elif [[ "$PROTOCOL" = 'tcp' ]]; then
+            iptables -I INPUT -p tcp --dport $PORT -j ACCEPT
+        fi
+        iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT
+        iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
+        iptables-save >$IPTABLES
+    fi
+    if hash sestatus 2>/dev/null; then
+        if sestatus | grep "Current mode" | grep -qs "enforcing"; then
+            if [[ "$PORT" != '1194' ]]; then
+                if ! hash semanage 2>/dev/null; then
+                    yum install policycoreutils-python -y
+                fi
+                if [[ "$PROTOCOL" = 'udp' ]]; then
+                    semanage port -a -t openvpn_port_t -p udp $PORT
+                elif [[ "$PROTOCOL" = 'tcp' ]]; then
+                    semanage port -a -t openvpn_port_t -p tcp $PORT
+                fi
+            fi
+        fi
+    fi
+    #Liberando DNS
+    msg -bar
+    msg -ama " Ultimo Paso, Configuraciones DNS"
+    msg -bar
+    while [[ $DDNS != @(n|N) ]]; do
+        echo -ne " \033[1;33m"
+        read -p " Agergar HOST DNS [S/N]: " -e -i n DDNS
+        [[ $DDNS = @(s|S|y|Y) ]] && agrega_dns
+    done
+    [[ ! -z $NEWDNS ]] && {
+        sed -i "/127.0.0.1[[:blank:]] \+localhost/a 127.0.0.1 $NEWDNS" /etc/hosts
+        for DENESI in $(echo $NEWDNS); do
+            sed -i "/remote ${SERVER_IP} ${PORT} ${PROTOCOL}/a remote ${DENESI} ${PORT} ${PROTOCOL}" /etc/openvpn/client-common.txt
+        done
+    }
+    msg -bar
+    # REINICIANDO OPENVPN
+    if [[ "$OS" = 'debian' ]]; then
+        if pgrep systemd-journal; then
+            sed -i 's|LimitNPROC|#LimitNPROC|' /lib/systemd/system/openvpn \@.service
+            sed -i 's|/etc/openvpn/server|/etc/openvpn|' /lib/systemd/system/openvpn \@.service
+            sed -i 's|%i.conf|server.conf|' /lib/systemd/system/openvpn \@.service
+            #systemctl daemon-reload
+            (
+                systemctl restart openvpn
+                systemctl enable openvpn
+            ) >/dev/null 2>&1
+        else
+            /etc/init.d/openvpn restart >/dev/null 2>&1
+        fi
+    else
+        if pgrep systemd-journal; then
+            (
+                systemctl restart openvpn@server.service
+                systemctl enable openvpn@server.service
+            ) >/dev/null 2>&1
+        else
+            (
+                service openvpn restart
+                chkconfig openvpn on
+            ) >/dev/null 2>&1
+        fi
+    fi
+    service squid restart &>/dev/null
+    service squid3 restart &>/dev/null
+    apt-get install ufw -y >/dev/null 2>&1
+    for ufww in $(mportas | awk '{print $2}'); do
+        ufw allow $ufww >/dev/null 2>&1
+    done
+    #Restart OPENVPN
+    (
+        killall openvpn 2>/dev/null
+        systemctl stop openvpn@server.service >/dev/null 2>&1
+        service openvpn stop >/dev/null 2>&1
+        sleep 0.1s
+        cd /etc/openvpn >/dev/null 2>&1
+        screen -dmS ovpnscr openvpn --config "server.conf" >/dev/null 2>&1
+    ) >/dev/null 2>&1
+    echo -e " \033[1;32m Openvpn configurado con EXITO!"
+    msg -bar
+    msg -ama " Ahora crear una SSH para generar el (.ovpn)!"
+    msg -bar
+    return 0
+}
+edit_ovpn_host() {
+    msg -bar3
+    msg -ama " CONFIGURACION HOST DNS OPENVPN"
+    msg -bar
+    while [[ $DDNS != @(n|N) ]]; do
+        echo -ne " \033[1;33m"
+        read -p " Agregar host [S/N]: " -e -i n DDNS
+        [[ $DDNS = @(s|S|y|Y) ]] && agrega_dns
+    done
+    [[ ! -z $NEWDNS ]] && sed -i "/127.0.0.1[[:blank:]] \+localhost/a 127.0.0.1 $NEWDNS" /etc/hosts
+    msg -bar
+    msg -ama " Es Necesario el Reboot del Servidor Para"
+    msg -ama " Para que las configuraciones sean efectudas"
+    msg -bar
+}
+fun_openvpn() {
+    [[ -e /etc/openvpn/server.conf ]] && {
+        unset OPENBAR
+        [[ $(mportas | grep -w "openvpn") ]] && OPENBAR=" \033[1;32m ONLINE" || OPENBAR=" \033[1;31m OFFLINE"
+        msg -ama " OPENVPN YA ESTA INSTALADO"
+        msg -bar
+        echo -e " \033[1;32m [1] > \033[1;36m DESINSTALAR  OPENVPN"
+        echo -e " \033[1;32m [2] > \033[1;36m EDITAR CONFIGURACION CLIENTE  \033[1;31m(MEDIANTE NANO)"
+        echo -e " \033[1;32m [3] > \033[1;36m EDITAR CONFIGURACION SERVIDOR  \033[1;31m(MEDIANTE NANO)"
+        echo -e " \033[1;32m [4] > \033[1;36m CAMBIAR HOST DE OPENVPN"
+        echo -e " \033[1;32m [5] > \033[1;36m INICIAR O PARAR OPENVPN - $OPENBAR"
+        msg -bar
+        while [[ $xption != @([0|1|2|3|4|5]) ]]; do
+            echo -ne " \033[1;33m $(fun_trans "Opcion"): " && read xption
+            tput cuu1 && tput dl1
+        done
+        case $xption in
+        1)
+            clear
+            msg -bar
+            echo -ne " \033[1;97m"
+            read -p "QUIERES DESINTALAR OPENVPN? [Y/N]: " -e REMOVE
+            msg -bar
+            if [[ "$REMOVE" = 'y' || "$REMOVE" = 'Y' ]]; then
+                PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
+                PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2)
+                if pgrep firewalld; then
+                    IP=$(firewall-cmd --direct --get-rules ipv4 nat POSTROUTING | grep ' \-s 10.8.0.0/24 '"'"'!'"'"' -d 10.8.0.0/24 -j SNAT --to ' | cut -d " " -f 10)
+                    #
+                    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
+                    firewall-cmd --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+                    firewall-cmd --permanent --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+                else
+                    IP=$(grep 'iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to ' $RCLOCAL | cut -d " " -f 14)
+                    iptables -t nat -D POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+                    sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0 \/24 ! -d 10.8.0.0 \/24 -j SNAT --to /d' $RCLOCAL
+                    if iptables -L -n | grep -qE '^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
+                fi
+                if sestatus 2>/dev/null | grep "Current mode" | grep -q "enforcing" && [[ "$PORT" != '1194' ]]; then
+                    semanage port -d -t openvpn_port_t -p $PROTOCOL $PORT
+                fi
+                if [[ "$OS" = 'debian' ]]; then
+                    apt-get remove --purge -y openvpn
+                else
+                    yum remove openvpn -y
+                fi
+                rm -rf /etc/openvpn
+                rm -f /etc/sysctl.d/30-openvpn-forward.conf
+                msg -bar
+                echo "OpenVPN removido!"
+                msg -bar
+            else
+                msg -bar
+                echo "Desinstalacion abortada!"
+                msg -bar
+            fi
+            return 0
+            ;;
+        2)
+            nano /etc/openvpn/client-common.txt
+            return 0
+            ;;
+        3)
+            nano /etc/openvpn/server.conf
+            return 0
+            ;;
+        4) edit_ovpn_host ;;
+        5)
+            [[ $(mportas | grep -w openvpn) ]] && {
+                /etc/init.d/openvpn stop >/dev/null 2>&1
+                killall openvpn &>/dev/null
+                systemctl stop openvpn@server.service &>/dev/null
+                service openvpn stop &>/dev/null
+                #ps x |grep openvpn |grep -v grep|awk '{print $1}' | while read pid; do kill -9 $pid; done
+            } || {
+                cd /etc/openvpn
+                screen -dmS ovpnscr openvpn --config "server.conf" >/dev/null 2>&1
+                cd $HOME
+            }
+            msg -ama " Procedimiento Hecho con Exito"
+            msg -bar
+            return 0
+            ;;
+        0)
+            return 0
+            ;;
+        esac
+        exit
+    }
+    [[ -e /etc/squid/squid.conf ]] && instala_ovpn2 && return 0
+    [[ -e /etc/squid3/squid.conf ]] && instala_ovpn2 && return 0
+
+    instala_ovpn2 || return 1
+}
+
+fun_openvpn

+ 267 - 0
LACASITAMX-v8.9x/Des/protocolos/python.py

@@ -0,0 +1,267 @@
+import socket, threading, thread, select, signal, sys, time, getopt
+
+# Listen
+LISTENING_ADDR = '0.0.0.0'
+if sys.argv[1:]:
+  LISTENING_PORT = sys.argv[1]
+else:
+  LISTENING_PORT = 80  
+#Pass
+PASS = ''
+
+# CONST
+BUFLEN = 4096 * 4
+TIMEOUT = 60
+DEFAULT_HOST = '127.0.0.1:22'
+RESPONSE = 'HTTP/1.1 101 Switching Protocols <strong>By: lacasitamx</strong>\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)
+        intport = int(self.port)
+        self.soc.bind((self.host, intport))
+        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 = 22
+            else:
+                port = sys.argv[1]
+
+        (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 'Usage: proxy.py -p <port>'
+    print '       proxy.py -b <bindAddr> -p <port>'
+    print '       proxy.py -b 0.0.0.0 -p 80'
+
+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 "\n:-------PythonProxy-------:\n"
+    print "Listening addr: " + LISTENING_ADDR
+    print "Listening port: " + str(LISTENING_PORT) + "\n"
+    print ":-------------------------:\n"
+    server = Server(LISTENING_ADDR, LISTENING_PORT)
+    server.start()
+    while True:
+        try:
+            time.sleep(2)
+        except KeyboardInterrupt:
+            print 'Stopping...'
+            server.close()
+            break
+
+#######    parse_args(sys.argv[1:])
+if __name__ == '__main__':
+    main()

+ 152 - 0
LACASITAMX-v8.9x/Des/protocolos/shadowsocks.sh

@@ -0,0 +1,152 @@
+#!/bin/bash
+[[ ! -d /usr/local/lib/rm ]] && exit
+declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
+dir="/etc/VPS-MX"
+SCPfrm="${dir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
+SCPinst="${dir}/protocolos" && [[ ! -d ${SCPinst} ]] && exit
+[[ ! -d /usr/local/megat ]] && exit
+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"
+}
+fun_ip () {
+MEU_IP=$(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)
+MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
+[[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" || IP="$MEU_IP"
+}
+
+config="/etc/shadowsocks-libev/config.json"
+
+fun_eth () {
+eth=$(ifconfig | grep -v inet6 | grep -v lo | grep -v 127.0.0.1 | grep "encap:Ethernet" | awk '{print $1}')
+    [[ $eth != "" ]] && {
+    msg -bar
+    echo -e "${cor[3]} $(fun_trans ${id} "Aplicar Sistema Para Mejorar Paquetes SSH?")"
+    echo -e "${cor[3]} $(fun_trans ${id} "Opcion Para Usuarios Avanzados")"
+    msg -bar
+    read -p " [S/N]: " -e -i n sshsn
+           [[ "$sshsn" = @(s|S|y|Y) ]] && {
+           echo -e "${cor[1]} $(fun_trans ${id} "Correccion de problemas de paquetes en SSH...")"
+           echo -e " $(fun_trans ${id} "Cual es la Tasa de RX")"
+           echo -ne "[ 1 - 999999999 ]: "; read rx
+           [[ "$rx" = "" ]] && rx="999999999"
+           echo -e " $(fun_trans ${id} "Cual es la Tasa de  TX")"
+           echo -ne "[ 1 - 999999999 ]: "; read tx
+           [[ "$tx" = "" ]] && tx="999999999"
+           apt-get install ethtool -y > /dev/null 2>&1
+           ethtool -G $eth rx $rx tx $tx > /dev/null 2>&1
+           }
+     msg -bar
+     }
+}
+fun_bar () {
+comando="$1"
+ _=$(
+$comando > /dev/null 2>&1
+) & > /dev/null
+pid=$!
+while [[ -d /proc/$pid ]]; do
+echo -ne " \033[1;33m["
+   for((i=0; i<10; i++)); do
+   echo -ne "\033[1;31m##"
+   sleep 0.2
+   done
+echo -ne "\033[1;33m]"
+sleep 1s
+echo
+tput cuu1
+tput dl1
+done
+echo -e " \033[1;33m[\033[1;31m####################\033[1;33m] - \033[1;32m100%\033[0m"
+sleep 1s
+}
+del_shadowsocks () {
+[[ -e /etc/shadowsocks-libev/config.json ]] && {
+[[ $(ps ax|grep ss-server|grep -v grep|awk '{print $1}') != "" ]] && kill -9 $(ps ax|grep ss-server|grep -v grep|awk '{print $1}') > /dev/null 2>&1 && ss-server -c /etc/shadowsocks-libev/config.json -d stop > /dev/null 2>&1
+echo -e "\033[1;33m	SHADOWSOCKS LIBEV DETENIDO"
+msg -bar
+rm /etc/shadowsocks-libev/config.json
+rm -rf Instalador-libev.sh Instalador-libev.log shadowsocks_libev_qr.png
+rm -rf Instalador-libev.sh Instalador-libev.log
+return 0
+}
+}
+
+[[ $(ps ax | grep ss-server | grep -v grep | awk '{print $1}') ]] && ss="\e[92m[ ON ]" || ss="\e[91m[ OFF ]"
+clear
+msg -bar
+msg -tit
+echo -e "       \e[91m\e[43mINSTALADOR SHADOWSOCKS-LIBEV+(obfs)\e[0m "
+msg -bar
+echo -e "$(msg -verd "[1]")$(msg -verm2 "➛ ")$(msg -azu "INSTALAR SHADOWSOCKS LIBEV") $ss"
+echo -e "$(msg -verd "[2]")$(msg -verm2 "➛ ")$(msg -azu "DESINSTALAR SHADOWSOCKS LIBEV")"
+echo -e "$(msg -verd "[3]")$(msg -verm2 "➛ ")$(msg -azu "VER CONFI LIBEV")"
+echo -e "$(msg -verd "[4]")$(msg -verm2 "➛ ")$(msg -azu "MODIFICAR CONFIGURACION (nano)")"
+echo -e "$(msg -verd "[0]")$(msg -verm2 "➛ ")$(msg -azu "VOLVER")"
+msg -bar
+echo -n " Selecione Una Opcion: "
+read opcao
+case $opcao in
+1)
+clear
+msg -bar
+wget --no-check-certificate -O Instalador-libev.sh https://raw.githubusercontent.com/lacasitamx/ZETA/master/sha/Instalador-libev.sh > /dev/null 2>&1
+chmod +x Instalador-libev.sh
+./Instalador-libev.sh 2>&1 | tee Instalador-libev.log
+value=$(ps ax |grep ss-server|grep -v grep)
+[[ $value != "" ]] && value="\033[1;32mINICIADO CON EXITO" || value="\033[1;31mERROR"
+msg -bar
+echo -e "${value}"
+msg -bar
+;;
+2)
+clear
+msg -bar
+echo -e "\033[1;93m  Desinstalar  ..."
+del_shadowsocks
+msg -bar
+wget --no-check-certificate -O Instalador-libev.sh https://raw.githubusercontent.com/lacasitamx/ZETA/master/sha/Instalador-libev.sh > /dev/null 2>&1
+chmod +x Instalador-libev.sh
+./Instalador-libev.sh uninstall
+rm -rf Instalador-libev.sh Instalador-libev.log shadowsocks_libev_qr.png
+
+msg -bar
+sleep 3
+exit
+;;
+3)
+clear
+msg -bar
+msg -ama " VER CONFIGURACION"
+msg -bar
+if [[ ! -e ${config} ]]; then
+msg -verm " NO HAY INFORMACION"
+else
+cat /etc/shadowsocks-libev/confis
+msg -bar
+fi
+;;
+4)
+clear
+msg -bar
+msg -ama " MODIFICAR CONFIGURACION"
+msg -bar
+
+if [[ ! -e ${config} ]]; then
+msg -verm " NO HAY INFORMACION"
+else
+msg -verd " para guardar la confi precione ( crtl + x )"
+read -p " enter para continuar"
+nano ${config}
+msg -bar
+/etc/init.d/shadowsocks-libev restart
+msg -bar
+fi
+;;
+esac

+ 251 - 0
LACASITAMX-v8.9x/Des/protocolos/slowdns.sh

@@ -0,0 +1,251 @@
+#!/bin/bash
+ll="/usr/local/include/snaps" && [[ ! -d ${ll} ]] && exit
+l="/usr/local/lib/sped" && [[ ! -d ${l} ]] && exit
+#by @rufu99
+[[ ! -d /etc/VPS-MX ]] && exit
+[[ ! -d /etc/VPS-MX/protocolos ]] && exit
+ADM_inst="/etc/VPS-MX/Slow/install" && [[ ! -d ${ADM_inst} ]] && exit
+ADM_slow="/etc/VPS-MX/Slow/Key" && [[ ! -d ${ADM_slow} ]] && exit
+info(){
+	clear
+	nodata(){
+		msg -bar
+		msg -ama "!SIN INFORMACION SLOWDNS!"
+		exit 0
+	}
+
+	if [[ -e  ${ADM_slow}/domain_ns ]]; then
+		ns=$(cat ${ADM_slow}/domain_ns)
+		if [[ -z "$ns" ]]; then
+			nodata
+			exit 0
+		fi
+	else
+		nodata
+		exit 0
+	fi
+
+	if [[ -e ${ADM_slow}/server.pub ]]; then
+		key=$(cat ${ADM_slow}/server.pub)
+		if [[ -z "$key" ]]; then
+			nodata
+			exit 0
+		fi
+	else
+		nodata
+		exit 0
+	fi
+
+	msg -bar
+	msg -ama "DATOS DE SU CONEXION SLOWDNS"
+	msg -bar
+	msg -ama "Su NS (Nameserver): $(cat ${ADM_slow}/domain_ns)"
+	msg -bar
+	msg -ama "Su Llave: $(cat ${ADM_slow}/server.pub)"
+	
+	exit 0
+}
+
+drop_port(){
+    local portasVAR=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
+    local NOREPEAT
+    local reQ
+    local Port
+    unset DPB
+    while read port; do
+        reQ=$(echo ${port}|awk '{print $1}')
+        Port=$(echo {$port} | awk '{print $9}' | awk -F ":" '{print $2}')
+        [[ $(echo -e $NOREPEAT|grep -w "$Port") ]] && continue
+        NOREPEAT+="$Port\n"
+
+        case ${reQ} in
+        	sshd|dropbear|trojan|stunnel4|stunnel|python|python3|v2ray|xray)DPB+=" $reQ:$Port";;
+            *)continue;;
+        esac
+    done <<< "${portasVAR}"
+ }
+
+ini_slow(){
+clear
+msg -bar
+	msg -ama "	INSTALADOR SLOWDNS"
+	msg -bar
+	echo ""
+	drop_port
+	n=1
+    for i in $DPB; do
+        proto=$(echo $i|awk -F ":" '{print $1}')
+        proto2=$(printf '%-12s' "$proto")
+        port=$(echo $i|awk -F ":" '{print $2}')
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -ama "$proto2")$(msg -azu "$port")"
+        drop[$n]=$port
+        dPROT[$n]=$proto2
+        num_opc="$n"
+        let n++ 
+    done
+    msg -bar
+    opc=$(selection_fun $num_opc)
+    echo "${drop[$opc]}" > ${ADM_slow}/puerto
+    echo "${dPROT[$opc]}" >${ADM_slow}/puertoloc
+    PORT=$(cat ${ADM_slow}/puerto)
+    clear
+    msg -bar
+    msg -ama "	INSTALADOR SLOWDNS"
+    msg -bar
+    echo ""
+    echo -e " $(msg -ama "Puerto de conexion atraves de SlowDNS:") $(msg -verd "$PORT")"
+    msg -bar
+
+    unset NS
+    while [[ -z $NS ]]; do
+    	msg -ama " Tu dominio NS: "
+    	read NS
+    	tput cuu1 && tput dl1
+    done
+    echo "$NS" > ${ADM_slow}/domain_ns
+    echo -e " $(msg -ama "Tu dominio NS:") $(msg -verd "$NS")"
+    msg -bar
+
+    if [[ ! -e ${ADM_inst}/dns-server ]]; then
+    	msg -ama " Descargando binario...."
+    	if wget -O ${ADM_inst}/dns-server raw.github.com/lacasitamx/SCRIPTMOD-LACASITA/master/SLOWDNS/dns-server &>/dev/null ; then
+    		chmod +x ${ADM_inst}/dns-server
+    		msg -verd " DESCARGA CON EXITO"
+    	else
+    		msg -verm " DESCARGA FALLIDA"
+    		msg -bar
+    		msg -ama "No se pudo descargar el binario"
+    		msg -verm "Instalacion cancelada"
+    		
+    		exit 0
+    	fi
+    	msg -bar
+    fi
+
+    [[ -e "${ADM_slow}/server.pub" ]] && pub=$(cat ${ADM_slow}/server.pub)
+
+    if [[ ! -z "$pub" ]]; then
+    	msg -ama " Usar La clave existente [S/N] ?: "
+    	read ex_key
+
+    	case $ex_key in
+    		s|S|y|Y) tput cuu1 && tput dl1
+    			 echo -e " $(msg -ama "Tu clave:") $(msg -verd "$(cat ${ADM_slow}/server.pub)")";;
+    		n|N) tput cuu1 && tput dl1
+    			 rm -rf ${ADM_slow}/server.key
+    			 rm -rf ${ADM_slow}/server.pub
+    			 ${ADM_inst}/dns-server -gen-key -privkey-file ${ADM_slow}/server.key -pubkey-file ${ADM_slow}/server.pub &>/dev/null
+    			 echo -e " $(msg -ama "Tu clave:") $(msg -verd "$(cat ${ADM_slow}/server.pub)")";;
+    		*);;
+    	esac
+    else
+    	rm -rf ${ADM_slow}/server.key
+    	rm -rf ${ADM_slow}/server.pub
+    	${ADM_inst}/dns-server -gen-key -privkey-file ${ADM_slow}/server.key -pubkey-file ${ADM_slow}/server.pub &>/dev/null
+    	echo -e " $(msg -ama "Tu clave:") $(msg -verd "$(cat ${ADM_slow}/server.pub)")"
+    fi
+    msg -bar
+    msg -ama "    INSTALANDO SERVICIO 𝙎𝙇𝙊𝙒𝘿𝙉𝙎   ..." |pv -q 30
+    apt install ncurses-utils -y &>/dev/null
+    
+	apt install iptables -y &>/dev/null
+	#iptables -F >/dev/null 2>&1
+   iptables -I INPUT -p udp --dport 5300 -j ACCEPT
+    iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 5300
+    echo "nameserver 1.1.1.1 " >/etc/resolv.conf
+    echo "nameserver 1.0.0.1 " >>/etc/resolv.conf
+    
+    screen -dmS slowdns ${ADM_inst}/dns-server -udp :5300 -privkey-file ${ADM_slow}/server.key $NS 127.0.0.1:$PORT
+    [[ $(grep -wc "slowdns" /etc/autostart) = '0' ]] && {
+						echo -e "netstat -au | grep -w 7300 > /dev/null || {  screen -r -S 'slowdns' -X quit;  screen -dmS slowdns ${ADM_inst}/dns-server -udp :5300 -privkey-file ${ADM_slow}/server.key $NS 127.0.0.1:$PORT ; }" >>/etc/autostart
+					} || {
+						sed -i '/slowdns/d' /etc/autostart
+						echo -e "netstat -au | grep -w 7300 > /dev/null || {  screen -r -S 'slowdns' -X quit;  screen -dmS slowdns ${ADM_inst}/dns-server -udp :5300 -privkey-file ${ADM_slow}/server.key $NS 127.0.0.1:$PORT ; }" >>/etc/autostart
+					}
+    	msg -verd " INSTALACION CON EXITO"
+    
+    exit 0
+}
+
+reset_slow(){
+	clear
+	msg -bar
+	msg -verd "    Reiniciando 𝙎𝙇𝙊𝙒𝘿𝙉𝙎...."
+	screen -ls | grep slowdns | cut -d. -f1 | awk '{print $1}' | xargs kill
+	NS=$(cat ${ADM_slow}/domain_ns)
+	PORT=$(cat ${ADM_slow}/puerto)
+	screen -dmS slowdns ${ADM_inst}/dns-server -udp :5300 -privkey-file /root/server.key $NS 127.0.0.1:$PORT
+	[[ $(grep -wc "slowdns" /etc/autostart) = '0' ]] && {
+						echo -e "netstat -au | grep -w 7300 > /dev/null || {  screen -r -S 'slowdns' -X quit;  screen -dmS slowdns ${ADM_inst}/dns-server -udp :5300 -privkey-file ${ADM_slow}/server.key $NS 127.0.0.1:$PORT ; }" >>/etc/autostart
+					} || {
+						sed -i '/slowdns/d' /etc/autostart
+						echo -e "netstat -au | grep -w 7300 > /dev/null || {  screen -r -S 'slowdns' -X quit;  screen -dmS slowdns ${ADM_inst}/dns-server -udp :5300 -privkey-file ${ADM_slow}/server.key $NS 127.0.0.1:$PORT ; }" >>/etc/autostart
+					}
+		msg -verd " SERVICIO SLOW REINICIADO"
+	
+	exit 0
+}
+stop_slow(){
+	clear
+	msg -bar
+	msg -ama "    Deteniendo SlowDNS...."
+	if screen -ls | grep slowdns | cut -d. -f1 | awk '{print $1}' | xargs kill ; then
+	for pidslow in $(screen -ls | grep ".slowdns" | awk {'print $1'}); do
+						screen -r -S "$pidslow" -X quit
+			done
+			[[ $(grep -wc "dns-server" /etc/autostart) != '0' ]] && {
+						sed -i '/dns-server/d' /etc/autostart
+			}
+  screen -wipe >/dev/null
+		msg -verd " SERVICIO SLOW DETENIDO!!"
+		rm ${ADM_inst}/dns-server &>/dev/null
+		rm -rf ${ADM_slow}/* &>/dev/null
+	else
+		msg -verm " SERVICIO SLOW NO DETENIDO!"
+	fi
+	exit 0
+}
+portdns(){
+  proto="dns-serve"
+  portas=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND")
+  for list in $proto; do
+    case $list in
+      dns-serve)
+      portas2=$(echo $portas|grep -w "$list")
+      [[ $(echo "${portas2}"|grep "$list") ]] && inst[$list]="\033[1;33m[\e[1;92mActivo\e[33m] " || inst[$list]="\033[1;33m[\e[1;91mDesactivado\e[1;33m]";;
+    esac
+  done
+  }
+while :
+do
+	clear
+	portdns
+	if [[ -e ${ADM_slow}/puertoloc ]]; then LOC=$((cat ${ADM_slow}/puertoloc)|cut -d' ' -f1); else LOC="XX"; fi
+	if [[ -e ${ADM_slow}/puerto ]]; then PT=$((cat ${ADM_slow}/puerto)|cut -d' ' -f1); else PT="XX"; fi
+	msg -bar
+	msg -ama "	\e[91m\e[43mMENÚ DE INSTALACION 𝙎𝙇𝙊𝙒𝘿𝙉𝙎   \e[0m"
+	echo ""
+	#if [[ -e ${ADM_inst}/dns-server ]]; then
+	echo -e "     \e[91mSlowDNS\e[93m + \e[92m${LOC} \e[97m»» \e[91m${PT} \e[1;97mSERVICIO: ${inst[dns-serv]}\e[0m"
+	#else
+	#echo -e "	\e[1;97mSERVICIO: ${inst[dns-serv]}"
+	#fi
+	
+	msg -bar
+	
+	echo -e "  $(msg -verd "[1]")$(msg -verm2 "➛ ")$(msg -azu "INSTALAR 𝙎𝙇𝙊𝙒𝘿𝙉𝙎  ")"
+	echo -e "  $(msg -verd "[2]")$(msg -verm2 "➛ ")$(msg -azu "REINICIAR 𝙎𝙇𝙊𝙒𝘿𝙉𝙎  ")"
+	echo -e "  $(msg -verd "[3]")$(msg -verm2 "➛ ")$(msg -azu "DETENER 𝙎𝙇𝙊𝙒𝘿𝙉𝙎  ")"
+	echo -e "  $(msg -verd "[4]")$(msg -verm2 "➛ ")$(msg -azu "DATOS DE LA CUENTA")"
+	echo -e "  $(msg -verd "[0]")$(msg -verm2 "➛ ")$(msg -azu "VOLVER")"
+	msg -bar
+	echo -ne "  \033[1;37mSelecione Una Opcion : "
+read opc
+case $opc in
+		1)ini_slow;;
+		2)reset_slow;;
+		3)stop_slow;;
+		4)info;;
+		0)exit;;
+	esac
+done

+ 811 - 0
LACASITAMX-v8.9x/Des/protocolos/sockspy.sh

@@ -0,0 +1,811 @@
+#!/bin/bash
+ll="/usr/local/include/snaps" && [[ ! -d ${ll} ]] && exit
+
+#
+clear
+clear
+SCPdir="/etc/VPS-MX"
+SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
+SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPinst} ]] && exit
+
+declare -A cor=([0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m")
+[[ $(dpkg --get-selections | grep -w "python" | head -1) ]] || apt-get install python -y &>/dev/null
+[[ $(dpkg --get-selections | grep -w "python-pip" | head -1) ]] || apt-get install python pip -y &>/dev/null
+[[ $(dpkg --get-selections | grep -w "net-tools" | head -1) ]] || apt-get install net-tools -y &>/dev/null
+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"
+}
+meu_ip() {
+    MEU_IP=$(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)
+    MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
+    [[ "$MEU_IP" != "$MEU_IP2" ]] && echo "$MEU_IP2" || echo "$MEU_IP"
+}
+IP=$(wget -qO- ipv4.icanhazip.com)
+tcpbypass_fun() {
+    [[ -e $HOME/socks ]] && rm -rf $HOME/socks >/dev/null 2>&1
+    [[ -d $HOME/socks ]] && rm -rf $HOME/socks >/dev/null 2>&1
+    cd $HOME && mkdir socks >/dev/null 2>&1
+    cd socks
+    patch="https://www.dropbox.com/s/mn75pqufdc7zn97/backsocz"
+    arq="backsocz"
+    wget $patch -o /dev/null
+    unzip $arq >/dev/null 2>&1
+    mv -f ./ssh /etc/ssh/sshd_config && service ssh restart 1>/dev/null 2>/dev/null
+    mv -f sckt$(python3 --version | awk '{print $2}' | cut -d'.' -f1,2) /usr/sbin/sckt
+    mv -f scktcheck /bin/scktcheck
+    chmod +x /bin/scktcheck
+    chmod +x /usr/sbin/sckt
+    rm -rf $HOME/socks
+    cd $HOME
+    msg="$2"
+    [[ $msg = "" ]] && msg="@vpsmod"
+    portxz="$1"
+    [[ $portxz = "" ]] && portxz="8080"
+    screen -dmS sokz scktcheck "$portxz" "$msg" >/dev/null 2>&1
+}
+l="/usr/local/lib/sped" && [[ ! -d ${l} ]] && exit
+gettunel_fun() {
+    echo "master=NetVPS" >${SCPinst}/pwd.pwd
+    while read service; do
+        [[ -z $service ]] && break
+        echo "127.0.0.1:$(echo $service | cut -d' ' -f2)=$(echo $service | cut -d' ' -f1)" >>${SCPinst}/pwd.pwd
+    done <<<"$(mportas)"
+    screen -dmS getpy python ${SCPinst}/PGet.py -b "0.0.0.0:$1" -p "${SCPinst}/pwd.pwd"
+    [[ "$(ps x | grep "PGet.py" | grep -v "grep" | awk -F "pts" '{print $1}')" ]] && {
+        echo -e "Gettunel Iniciado con Sucesso"
+        msg -bar
+        echo -ne "Su contraseña Gettunel es:"
+        echo -e "\033[1;32m NetVPS"
+        msg -bar
+    } || echo -e "Gettunel no fue iniciado"
+    msg -bar
+}
+
+sistema20() {
+    if [[ ! -e /etc/VPS-MX/fix ]]; then
+        echo ""
+        ins() {
+            export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/
+            apt-get install python -y
+            apt-get install python pip -y
+        }
+        ins &>/dev/null && echo -e "INSTALANDO FIX" | pv -qL 40
+        sleep 1.s
+        [[ ! -e /etc/VPS-MX/fix ]] && touch /etc/VPS-MX/fix
+    else
+        echo ""
+    fi
+}
+sistema22() {
+    if [[ ! -e /etc/VPS-MX/fixer ]]; then
+        echo ""
+        ins() {
+            export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/
+            apt-get install python2 -y
+            apt-get install python -y
+            apt install python pip -y
+            rm -rf /usr/bin/python
+            ln -s /usr/bin/python2.7 /usr/bin/python
+        }
+        ins &>/dev/null && echo -e "INSTALANDO FIX" | pv -qL 40
+        sleep 1.s
+        [[ ! -e /etc/VPS-MX/fixer ]] && touch /etc/VPS-MX/fixer
+    else
+        echo ""
+    fi
+}
+
+PythonDic_fun() {
+
+    clear
+    echo ""
+    echo ""
+    msg -tit
+    msg -bar
+    echo -e "\033[1;31m  SOCKS DIRECTO-PY | CUSTOM\033[0m"
+    while true; do
+        msg -bar
+        echo -ne "\033[1;37m"
+        read -p " ESCRIBE SU PUERTO: " porta_socket
+        echo -e ""
+        [[ $(mportas | grep -w "$porta_socket") ]] || break
+        echo -e " ESTE PUERTO YA ESTÁ EN USO"
+        unset porta_socket
+    done
+    msg -bar
+    echo -e "\033[1;97m Digite Un Puerto Local 22|443|80\033[1;37m"
+    msg -bar
+    while true; do
+        echo -ne "\033[1;36m"
+        read -p " Digite Un Puerto SSH/DROPBEAR activo: " PORTLOC
+        echo -e ""
+        if [[ ! -z $PORTLOC ]]; then
+            if [[ $(echo $PORTLOC | grep [0-9]) ]]; then
+                [[ $(mportas | grep $PORTLOC | head -1) ]] && break || echo -e "ESTE PUERTO NO EXISTE"
+            fi
+        fi
+    done
+    #
+    puertoantla="$(mportas | grep $PORTLOC | awk '{print $2}' | head -1)"
+    msg -bar
+    echo -ne " Escribe El HTTP Response? 101|200|300: \033[1;37m" && read cabezado
+    tput cuu1 && tput dl1
+    if [[ -z $cabezado ]]; then
+        cabezado="200"
+        echo -e "	\e[31mResponse Default:\033[1;32m ${cabezado}"
+    else
+        echo -e "	\e[31mResponse Elegido:\033[1;32m ${cabezado}"
+    fi
+    msg -bar
+    echo -e "$(fun_trans "Introdusca su Mini-Banner")"
+    msg -bar
+    echo -ne " Introduzca el texto de estado plano o en HTML:\n \033[1;37m" && read texto_soket
+    tput cuu1 && tput dl1
+    if [[ -z $texto_soket ]]; then
+        texto_soket="@lacasitamx"
+        echo -e "	\e[31mMensage Default: \033[1;32m${texto_soket} "
+    else
+        echo -e "	\e[31mMensage: \033[1;32m ${texto_soket}"
+    fi
+    msg -bar
+
+    (
+        less <<CPM >/etc/VPS-MX/protocolos/PDirect.py
+import socket, threading, thread, select, signal, sys, time, getopt
+
+# Listen
+LISTENING_ADDR = '0.0.0.0'
+LISTENING_PORT = int("$porta_socket")
+PASS = ''
+
+# CONST
+BUFLEN = 4096 * 4
+TIMEOUT = 60
+DEFAULT_HOST = '127.0.0.1:$puertoantla'
+RESPONSE = 'HTTP/1.1 $cabezado <strong>$texto_soket</strong>\r\n\r\nHTTP/1.1 $cabezado Conexion Exitosa\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
+                port = 8080
+                port = 8799
+                port = 3128
+        (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=LISTENING_ADDR, port=LISTENING_PORT):
+    print "\n:-------PythonProxy-------:\n"
+    print "Listening addr: " + LISTENING_ADDR
+    print "Listening port: " + str(LISTENING_PORT) + "\n"
+    print ":-------------------------:\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__':
+    main()
+CPM
+    ) >$HOME/proxy.log &
+
+    chmod +x /etc/VPS-MX/protocolos/PDirect.py
+    screen -dmS ws$porta_socket python ${SCPinst}/PDirect.py $porta_socket $texto_soket >/root/proxy.log &
+    #screen -dmS pydic-"$porta_socket" python ${SCPinst}/PDirect.py "$porta_socket" "$texto_soket" && echo ""$porta_socket" "$texto_soket"" >> /etc/VPS-MX/PortPD.log
+
+    echo "$porta_socket $texto_soket" >/etc/VPS-MX/PortPD.log
+    [[ $(grep -wc "PDirect.py" /etc/autostart) = '0' ]] && {
+        echo -e "netstat -tlpn | grep -w $porta_socket > /dev/null || {  screen -r -S 'ws$porta_socket' -X quit;  screen -dmS ws$porta_socket python ${SCPinst}/PDirect.py $porta_socket $texto_soket; }" >>/etc/autostart
+    } || {
+        sed -i '/PDirect.py/d' /etc/autostart
+        echo -e "netstat -tlpn | grep -w $porta_socket > /dev/null || {  screen -r -S 'ws$porta_socket' -X quit;  screen -dmS ws$porta_socket python ${SCPinst}/PDirect.py $porta_socket $texto_soket; }" >>/etc/autostart
+    }
+
+}
+
+pythontest() {
+    clear
+    echo ""
+    echo ""
+    msg -tit
+    msg -bar
+    echo -e "\033[1;31m  SOCKS DIRECTO-PY | CUSTOM\033[0m"
+    while true; do
+        msg -bar
+        echo -ne "\033[1;37m"
+        read -p " ESCRIBE SU PUERTO: " porta_socket
+        echo -e ""
+        [[ $(mportas | grep -w "$porta_socket") ]] || break
+        echo -e " ESTE PUERTO YA ESTÁ EN USO"
+        unset porta_socket
+    done
+    msg -bar
+    echo -e "\033[1;97m Digite Un Puerto Local 22|443|80\033[1;37m"
+    msg -bar
+    while true; do
+        echo -ne "\033[1;36m"
+        read -p " Digite Un Puerto SSH/DROPBEAR activo: " PORTLOC
+        echo -e ""
+        if [[ ! -z $PORTLOC ]]; then
+            if [[ $(echo $PORTLOC | grep [0-9]) ]]; then
+                [[ $(mportas | grep $PORTLOC | head -1) ]] && break || echo -e "ESTE PUERTO NO EXISTE"
+            fi
+        fi
+    done
+    #
+    puertoantla="$(mportas | grep $PORTLOC | awk '{print $2}' | head -1)"
+    msg -bar
+    echo -ne " Escribe El HTTP Response? 101|200|300: \033[1;37m" && read cabezado
+    tput cuu1 && tput dl1
+    if [[ -z $cabezado ]]; then
+        cabezado="200"
+        echo -e "	\e[31mResponse Default:\033[1;32m ${cabezado}"
+    else
+        echo -e "	\e[31mResponse Elegido:\033[1;32m ${cabezado}"
+    fi
+    msg -bar
+    echo -e "$(fun_trans "Introdusca su Mini-Banner")"
+    msg -bar
+    echo -ne " Introduzca el texto de estado plano o en HTML:\n \033[1;37m" && read texto_soket
+    tput cuu1 && tput dl1
+    if [[ -z $texto_soket ]]; then
+        texto_soket="@lacasitamx"
+        echo -e "	\e[31mMensage Default: \033[1;32m${texto_soket} "
+    else
+        echo -e "	\e[31mMensage: \033[1;32m ${texto_soket}"
+    fi
+    msg -bar
+
+    (
+        less <<CPM >/etc/VPS-MX/protocolos/python.py
+import socket, threading, thread, select, signal, sys, time, getopt
+
+# Listen
+LISTENING_ADDR = '0.0.0.0'
+LISTENING_PORT = int("$porta_socket")
+PASS = ''
+
+# CONST
+BUFLEN = 4096 * 4
+TIMEOUT = 60
+DEFAULT_HOST = '127.0.0.1:$puertoantla'
+RESPONSE = 'HTTP/1.1 $cabezado <strong>$texto_soket</strong>\r\n\r\nHTTP/1.1 $cabezado Conexion Exitosa\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
+                port = 8080
+                port = 8799
+                port = 3128
+        (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=LISTENING_ADDR, port=LISTENING_PORT):
+    print "\n:-------PythonProxy-------:\n"
+    print "Listening addr: " + LISTENING_ADDR
+    print "Listening port: " + str(LISTENING_PORT) + "\n"
+    print ":-------------------------:\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__':
+    main()
+CPM
+    ) >$HOME/proxy.log &
+
+    chmod +x /etc/VPS-MX/protocolos/python.py
+    echo -e "[Unit]\nDescription=python.py Service by @lacasitamx\nAfter=network.target\nStartLimitIntervalSec=0\n\n[Service]\nType=simple\nUser=root\nWorkingDirectory=/root\nExecStart=/usr/bin/python ${SCPinst}/python.py $porta_socket $texto_soket\nRestart=always\nRestartSec=3s\n[Install]\nWantedBy=multi-user.target" >/etc/systemd/system/python.PD.service
+    echo "$porta_socket $texto_soket" >/etc/VPS-MX/PortPD.log
+    systemctl enable python.PD &>/dev/null
+    systemctl start python.PD &>/dev/null
+
+}
+
+pid_kill() {
+    [[ -z $1 ]] && refurn 1
+    pids="$@"
+    for pid in $(echo $pids); do
+        kill -9 $pid &>/dev/null
+    done
+}
+selecionador() {
+    clear
+    echo ""
+    echo ""
+    echo ""
+    while true; do
+        msg -bar
+        echo -ne "\033[1;37m"
+        read -p " ESCRIBE SU PUERTO: " porta_socket
+        echo -e ""
+        [[ $(mportas | grep -w "$porta_socket") ]] || break
+        echo -e " ESTE PUERTO YA ESTÁ EN USO"
+        unset porta_socket
+    done
+    echo -e "Introdusca su Mini-Banner"
+    msg -bar
+    echo -ne "Introduzca el texto de estado plano o en HTML:\n \033[1;37m" && read texto_soket
+    msg -bar
+}
+remove_fun() {
+    echo -e "Parando Socks Python"
+    msg -bar
+    pidproxy=$(ps x | grep "PPub.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy ]] && pid_kill $pidproxy
+    pidproxy2=$(ps x | grep "PPriv.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy2 ]] && pid_kill $pidproxy2
+    pidproxy3=$(ps x | grep "PDirect.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy3 ]] && pid_kill $pidproxy3
+    pidproxy4=$(ps x | grep "POpen.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy4 ]] && pid_kill $pidproxy4
+    pidproxy5=$(ps x | grep "PGet.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy5 ]] && pid_kill $pidproxy5
+    pidproxy6=$(ps x | grep "scktcheck" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy6 ]] && pid_kill $pidproxy6
+    pidproxy7=$(ps x | grep "python.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy7 ]] && pid_kill $pidproxy7
+    pidproxy8=$(ps x | grep "lacasitamx.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy8 ]] && pid_kill $pidproxy8
+    echo -e "\033[1;91mSocks DETENIDOS"
+    msg -bar
+    rm /etc/VPS-MX/PortPD.log &>/dev/null
+    echo "" >/etc/VPS-MX/PortPD.log
+
+    for pidproxy in $(screen -ls | grep ".ws" | awk {'print $1'}); do
+        screen -r -S "$pidproxy" -X quit
+    done
+    [[ $(grep -wc "PDirect.py" /etc/autostart) != '0' ]] && {
+        sed -i '/PDirect.py/d' /etc/autostart
+    }
+    sleep 1
+    screen -wipe >/dev/null
+    systemctl stop python.PD &>/dev/null
+    systemctl disable python.PD &>/dev/null
+    rm /etc/systemd/system/python.PD.service &>/dev/null
+    exit 0
+}
+iniciarsocks() {
+    pidproxy=$(ps x | grep -w "PPub.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy ]] && P1="\033[1;32m[ON]" || P1="\e[37m[\033[1;31mOFF\e[37m]"
+    pidproxy2=$(ps x | grep -w "PPriv.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy2 ]] && P2="\033[1;32m[ON]" || P2="\e[37m[\033[1;31mOFF\e[37m]"
+    pidproxy3=$(ps x | grep -w "PDirect.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy3 ]] && P3="\033[1;32m[ON]" || P3="\e[37m[\033[1;31mOFF\e[37m]"
+    pidproxy4=$(ps x | grep -w "POpen.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy4 ]] && P4="\033[1;32m[ON]" || P4="\e[37m[\033[1;31mOFF\e[37m]"
+
+    pidproxy5=$(ps x | grep "PGet.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy5 ]] && P5="\033[1;32m[ON]" || P5="\e[37m[\033[1;31mOFF\e[37m]"
+    pidproxy6=$(ps x | grep "scktcheck" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy6 ]] && P6="\033[1;32m[ON]" || P6="\e[37m[\033[1;31mOFF\e[37m]"
+    pidproxy7=$(ps x | grep "python.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy7 ]] && P7="\033[1;32m[ON]" || P7="\e[37m[\033[1;31mOFF\e[37m]"
+    pidproxy8=$(ps x | grep "python.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy8 ]] && P8="\033[1;32m[ON]" || P8="\e[37m[\033[1;31mOFF\e[37m]"
+
+    #msg -bar
+    msg -tit
+    msg -bar
+    echo -e "   	\e[91m\e[43mINSTALADOR DE PROXY'S\e[0m "
+    msg -bar
+    echo -e " \e[1;93m[\e[92m1\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mProxy Python SIMPLE      $P1"
+    echo -e " \e[1;93m[\e[92m2\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mProxy Python SEGURO      $P2"
+    echo -e " \e[1;93m[\e[92m3\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mProxy WEBSOCKET Custom   $P3 \e[1;32m(Screen TEST)"
+    echo -e " \e[1;93m[\e[92m4\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mProxy WEBSOCKET Custom   $P7 \e[1;32m(Socks HTTP)"
+    echo -e " \e[1;93m[\e[92m5\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mProxy Python OPENVPN     $P4"
+    echo -e " \e[1;93m[\e[92m6\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mProxy Python GETTUNEL    $P5"
+    echo -e " \e[1;93m[\e[92m7\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mProxy Python TCP BYPASS  $P6"
+    echo -e " \e[1;93m[\e[92m8\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mAplicar Fix en \e[1;32m(Ubu22 o Debian11 )"
+    echo -e " \e[1;93m[\e[92m9\e[93m] \e[97m$(msg -verm2 "➛ ")\033[1;97mDETENER SERVICIO PYTHON"
+    msg -bar
+    echo -e " \e[1;93m[\e[92m0\e[93m] \e[97m$(msg -verm2 "➛ ") \e[97m\033[1;41m VOLVER \033[1;37m"
+    msg -bar
+    IP=(meu_ip)
+    while [[ -z $portproxy || $portproxy != @(0|[1-9]) ]]; do
+        echo -ne " Digite Una Opcion: \033[1;37m" && read portproxy
+        tput cuu1 && tput dl1
+    done
+    case $portproxy in
+    1)
+        selecionador
+        screen -dmS screen python ${SCPinst}/PPub.py "$porta_socket" "$texto_soket"
+        ;;
+    2)
+        selecionador
+        screen -dmS screen python3 ${SCPinst}/PPriv.py "$porta_socket" "$texto_soket" "$IP"
+        ;;
+    3)
+        PIDI="$(ps aux | grep -v grep | grep "ws")"
+        if [[ -z $PIDI ]]; then
+            sistema20
+            PythonDic_fun
+        else
+            for pidproxy in $(screen -ls | grep ".ws" | awk {'print $1'}); do
+                screen -r -S "$pidproxy" -X quit
+            done
+            [[ $(grep -wc "PDirect.py" /etc/autostart) != '0' ]] && {
+                sed -i '/PDirect.py/d' /etc/autostart
+            }
+            sleep 1
+            screen -wipe >/dev/null
+            msg -bar
+            echo -e "\033[1;91mSocks Directo DETENIDO"
+            msg -bar
+            exit 0
+        fi
+        ;;
+    4)
+        if [[ ! -e /etc/systemd/system/python.PD.service ]]; then
+            sistema20
+            pythontest
+        else
+            systemctl stop python.PD &>/dev/null
+            systemctl disable python.PD &>/dev/null
+            rm /etc/systemd/system/python.PD.service &>/dev/null
+
+            msg -bar
+            echo -e "\033[1;91mSocks Directo DETENIDO"
+            msg -bar
+            exit 0
+        fi
+        ;;
+    5)
+        selecionador
+        screen -dmS screen python ${SCPinst}/POpen.py "$porta_socket" "$texto_soket"
+        ;;
+    6)
+        selecionador
+        gettunel_fun "$porta_socket"
+        ;;
+    7)
+        selecionador
+        tcpbypass_fun "$porta_socket" "$texto_soket"
+        ;;
+    8)
+        sistema22
+        msg -bar
+        msg -ama " AHORA REGRESA EN LA OPCION 3 DE SOCKS HTTP"
+        msg -bar
+
+        ;;
+    9) remove_fun ;;
+    0) return ;;
+    esac
+    echo -e "\033[1;92mProcedimiento COMPLETO"
+    msg -bar
+}
+iniciarsocks

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 1
LACASITAMX-v8.9x/Ofus/herramientas/Crear-Demo.sh


+ 0 - 39
LACASITAMX-v8.9x/Ofus/herramientas/dns-netflix.sh

@@ -1,39 +0,0 @@
-# !/bin/bash
-# 27/01/2021
-clear
-clear
-declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
-SCPdir="/etc/VPS-MX" && [[ ! -d ${SCPdir} ]] && exit 1
-SCPusr="${SCPdir}/controlador" && [[ ! -d ${SCPusr} ]] && mkdir ${SCPusr}
-SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-dnsnetflix () {
-echo "nameserver $dnsp" > /etc/resolv.conf
-#echo "nameserver 8.8.8.8" >> /etc/resolv.conf
-/etc/init.d/ssrmu stop &>/dev/null
-/etc/init.d/ssrmu start &>/dev/null
-/etc/init.d/shadowsocks-r stop &>/dev/null
-/etc/init.d/shadowsocks-r start &>/dev/null
-msg -bar2
-echo -e "${cor[4]}  DNS AGREGADOS CON EXITO"
-} 
-clear
-msg -bar2
-msg -tit
-echo -e "\033[1;93m     AGREGARDOR DE DNS PERSONALES By @USA1_BOT "
-msg -bar2
-echo -e "\033[1;39m Esta funcion ara que puedas ver Netflix con tu VPS"
-msg -bar2
-echo -e "\033[1;91m ¡ Solo seran utiles si registraste tu IP en el BOT !"
-echo -e "\033[1;39m En APPS como HTTP Inyector,KPN Rev,APKCUSTOM, etc."
-echo -e "\033[1;39m Se deveran agregar en la aplicasion a usar estos DNS."
-echo -e "\033[1;39m En APPS como SS,SSR,V2RAY no es necesario agregarlos."
-msg -bar2
-echo -e "\033[1;93m Recuerde escojer entre 1 DNS ya sea el de USA,BR,MX,CL \n segun le aya entregado el BOT."
-echo ""
-echo -e "\033[1;97m Ingrese su DNS a usar: \033[0;91m"; read -p "   "  dnsp
-echo ""
-msg -bar2
-read -p " Estas seguro de continuar?  [ s | n ]: " dnsnetflix   
-[[ "$dnsnetflix" = "s" || "$dnsnetflix" = "S" ]] && dnsnetflix
-msg -bar2

+ 0 - 432
LACASITAMX-v8.9x/Ofus/herramientas/fai2ban.sh

@@ -1,432 +0,0 @@
-#!/bin/bash
-#27/01/2021
-declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
-pid_fail=$(dpkg -l | grep fail2ban | grep ii)
-apache=$(dpkg -l | grep apache2 | grep ii)
-squid=$(dpkg -l | grep squid | grep ii)
-dropbear=$(dpkg -l | grep dropbear | grep ii)
-openssh=$(dpkg -l | grep openssh | grep ii)
-stunnel4=$(dpkg -l | grep stunnel4 | grep ii)
-[[ "$openssh" != "" ]] && s1="ssh"
-[[ "$squid" != "" ]] && s2="squid"
-[[ "$dropbear" != "" ]] && s3="dropbear"
-[[ "$apache" != "" ]] && s4="apache"
-[[ "$stunnel4" != "" ]] && s5="stunnel4"
-clear
-clear
-msg -bar
-msg -tit
-echo -e "\e[93m         --   Fail2ban Protection v0.11.2 -- "
-echo -e "\e[97m          Anti ataques DDOS y spoofing SPAM"
-msg -bar
-if [[ ! -z "$pid_fail" ]]; then
- echo -e "${cor[2]} [1] >${cor[5]} $(fun_trans "Desinstalar Fail2ban")"
- echo -e "${cor[2]} [2] >\e[92m $(fun_trans "Mirar el registro")"
- msg -bar
-  while [[ -z ${logxyz} || ${logxyz} != @(1|2) ]]; do
-   echo -ne "\033[1;37m$(fun_trans "Seleccione una Opcion"): " && read logxyz
-   tput cuu1 && tput dl1
-  done
- case ${logxyz} in
-  1)apt-get remove fail2ban -y &> /dev/null;;
-  2)cat /var/log/fail2ban.log 
-    msg -bar;;
- esac
-exit 0
-fi
-echo -e "${cor[5]}        Desea Instalar  Fail2ban?"
-msg -bar
-  while [[ -z ${fail2ban} || ${fail2ban} != @(s|S|n|N|y|Y) ]]; do
-   echo -ne "\033[1;37m$(fun_trans "Seleccione una Opcion") [S/N]: " && read fail2ban
-   tput cuu1 && tput dl1
-  done
-if [[ "$fail2ban" = @(s|S|y|Y) ]]; then
-apt-get install fail2ban -y &> /dev/null
-wget -O $HOME/fail2ban https://github.com/fail2ban/fail2ban/archive/0.11.2.tar.gz &> /dev/null
-tar -xf $HOME/fail2ban &> /dev/null
-cd $HOME/fail2ban-0.11.2 &> /dev/null
-python ./setup.py install &> /dev/null
-echo '[INCLUDES]
-before = paths-debian.conf
-[DEFAULT]
-ignoreip = 127.0.0.1/8
-# ignorecommand = /path/to/command <ip>
-ignorecommand =
-bantime  = 1036800
-findtime  = 3600
-maxretry = 5
-backend = auto
-usedns = warn
-logencoding = auto
-enabled = false
-filter = %(__name__)s
-destemail = root@localhost
-sender = root@localhost
-mta = sendmail
-protocol = tcp
-chain = INPUT
-port = 0:65535
-fail2ban_agent = Fail2Ban/%(fail2ban_version)s
-banaction = iptables-multiport
-banaction_allports = iptables-allports
-action_ = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
-action_mw = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
-            %(mta)s-whois[name=%(__name__)s, sender="%(sender)s", dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s"]
-action_mwl = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
-             %(mta)s-whois-lines[name=%(__name__)s, sender="%(sender)s", dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s"]
-action_xarf = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
-             xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath=%(logpath)s, port="%(port)s"]
-action_cf_mwl = cloudflare[cfuser="%(cfemail)s", cftoken="%(cfapikey)s"]
-                %(mta)s-whois-lines[name=%(__name__)s, sender="%(sender)s", dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s"]
-action_blocklist_de  = blocklist_de[email="%(sender)s", service=%(filter)s, apikey="%(blocklist_de_apikey)s", agent="%(fail2ban_agent)s"]
-action_badips = badips.py[category="%(__name__)s", banaction="%(banaction)s", agent="%(fail2ban_agent)s"]
-action_badips_report = badips[category="%(__name__)s", agent="%(fail2ban_agent)s"]
-action = %(action_)s' > /etc/fail2ban/jail.local
-echo -ne "${cor[5]} $(fun_trans "Fail2ban sera activo en los Siguientes\n Puertos y Servicos"):"
-echo ""
-msg -bar
-echo -ne "\n"
-[ "$s1" != "" ] && echo -ne " $s1"
-[ "$s2" != "" ] && echo -ne " $s2"
-[ "$s3" != "" ] && echo -ne " $s3"
-[ "$s4" != "" ] && echo -ne " $s4"
-[ "$s5" != "" ] && echo -ne " $s5"
-echo -ne "\n"
-echo -ne "\n"
-msg -bar
-sleep 1
-if [[ "$s1" != "" ]]; then
-echo '[sshd]
-enabled = true
-port    = ssh
-logpath = %(sshd_log)s
-backend = %(sshd_backend)s
-[sshd-ddos]
-enabled = true
-port    = ssh
-logpath = %(sshd_log)s
-backend = %(sshd_backend)s' >> /etc/fail2ban/jail.local
-else
-echo '[sshd]
-port    = ssh
-logpath = %(sshd_log)s
-backend = %(sshd_backend)s
-[sshd-ddos]
-port    = ssh
-logpath = %(sshd_log)s
-backend = %(sshd_backend)s' >> /etc/fail2ban/jail.local
-fi
-if [[ "$s2" != "" ]]; then
-echo '[squid]
-enabled = true
-port     =  80,443,3128,8080
-logpath = /var/log/squid/access.log' >> /etc/fail2ban/jail.local
-else
-echo '[squid]
-port     =  80,443,3128,8080
-logpath = /var/log/squid/access.log' >> /etc/fail2ban/jail.local
-fi
-if [[ "$s3" != "" ]]; then
-echo '[dropbear]
-enabled = true
-port     = ssh
-logpath  = %(dropbear_log)s
-backend  = %(dropbear_backend)s' >> /etc/fail2ban/jail.local
-else
-echo '[dropbear]
-port     = ssh
-logpath  = %(dropbear_log)s
-backend  = %(dropbear_backend)s' >> /etc/fail2ban/jail.local
-fi
-if [[ "$s4" != "" ]]; then
-echo '[apache-auth]
-enabled = true
-port     = http,https
-logpath  = %(apache_error_log)s' >> /etc/fail2ban/jail.local
-else
-echo '[apache-auth]
-port     = http,https
-logpath  = %(apache_error_log)s' >> /etc/fail2ban/jail.local
-fi
-echo '[selinux-ssh]
-port     = ssh
-logpath  = %(auditd_log)s
-[apache-badbots]
-port     = http,https
-logpath  = %(apache_access_log)s
-bantime  = 172800
-maxretry = 1
-[apache-noscript]
-port     = http,https
-logpath  = %(apache_error_log)s
-[apache-overflows]
-port     = http,https
-logpath  = %(apache_error_log)s
-maxretry = 2
-[apache-nohome]
-port     = http,https
-logpath  = %(apache_error_log)s
-maxretry = 2
-[apache-botsearch]
-port     = http,https
-logpath  = %(apache_error_log)s
-maxretry = 2
-[apache-fakegooglebot]
-port     = http,https
-logpath  = %(apache_access_log)s
-maxretry = 1
-ignorecommand = %(ignorecommands_dir)s/apache-fakegooglebot <ip>
-[apache-modsecurity]
-port     = http,https
-logpath  = %(apache_error_log)s
-maxretry = 2
-[apache-shellshock]
-port    = http,https
-logpath = %(apache_error_log)s
-maxretry = 1
-[openhab-auth]
-filter = openhab
-action = iptables-allports[name=NoAuthFailures]
-logpath = /opt/openhab/logs/request.log
-[nginx-http-auth]
-port    = http,https
-logpath = %(nginx_error_log)s
-[nginx-limit-req]
-port    = http,https
-logpath = %(nginx_error_log)s
-[nginx-botsearch]
-port     = http,https
-logpath  = %(nginx_error_log)s
-maxretry = 2
-[php-url-fopen]
-port    = http,https
-logpath = %(nginx_access_log)s
-          %(apache_access_log)s
-[suhosin]
-port    = http,https
-logpath = %(suhosin_log)s
-[lighttpd-auth]
-port    = http,https
-logpath = %(lighttpd_error_log)s
-[roundcube-auth]
-port     = http,https
-logpath  = %(roundcube_errors_log)s
-[openwebmail]
-port     = http,https
-logpath  = /var/log/openwebmail.log
-[horde]
-port     = http,https
-logpath  = /var/log/horde/horde.log
-[groupoffice]
-port     = http,https
-logpath  = /home/groupoffice/log/info.log
-[sogo-auth]
-port     = http,https
-logpath  = /var/log/sogo/sogo.log
-[tine20]
-logpath  = /var/log/tine20/tine20.log
-port     = http,https
-[drupal-auth]
-port     = http,https
-logpath  = %(syslog_daemon)s
-backend  = %(syslog_backend)s
-[guacamole]
-port     = http,https
-logpath  = /var/log/tomcat*/catalina.out
-[monit]
-#Ban clients brute-forcing the monit gui login
-port = 2812
-logpath  = /var/log/monit
-[webmin-auth]
-port    = 10000
-logpath = %(syslog_authpriv)s
-backend = %(syslog_backend)s
-[froxlor-auth]
-port    = http,https
-logpath  = %(syslog_authpriv)s
-backend  = %(syslog_backend)s
-[3proxy]
-port    = 3128
-logpath = /var/log/3proxy.log
-[proftpd]
-port     = ftp,ftp-data,ftps,ftps-data
-logpath  = %(proftpd_log)s
-backend  = %(proftpd_backend)s
-[pure-ftpd]
-port     = ftp,ftp-data,ftps,ftps-data
-logpath  = %(pureftpd_log)s
-backend  = %(pureftpd_backend)s
-[gssftpd]
-port     = ftp,ftp-data,ftps,ftps-data
-logpath  = %(syslog_daemon)s
-backend  = %(syslog_backend)s
-[wuftpd]
-port     = ftp,ftp-data,ftps,ftps-data
-logpath  = %(wuftpd_log)s
-backend  = %(wuftpd_backend)s
-[vsftpd]
-port     = ftp,ftp-data,ftps,ftps-data
-logpath  = %(vsftpd_log)s
-[assp]
-port     = smtp,465,submission
-logpath  = /root/path/to/assp/logs/maillog.txt
-[courier-smtp]
-port     = smtp,465,submission
-logpath  = %(syslog_mail)s
-backend  = %(syslog_backend)s
-[postfix]
-port     = smtp,465,submission
-logpath  = %(postfix_log)s
-backend  = %(postfix_backend)s
-[postfix-rbl]
-port     = smtp,465,submission
-logpath  = %(postfix_log)s
-backend  = %(postfix_backend)s
-maxretry = 1
-[sendmail-auth]
-port    = submission,465,smtp
-logpath = %(syslog_mail)s
-backend = %(syslog_backend)s
-[sendmail-reject]
-port     = smtp,465,submission
-logpath  = %(syslog_mail)s
-backend  = %(syslog_backend)s
-[qmail-rbl]
-filter  = qmail
-port    = smtp,465,submission
-logpath = /service/qmail/log/main/current
-[dovecot]
-port    = pop3,pop3s,imap,imaps,submission,465,sieve
-logpath = %(dovecot_log)s
-backend = %(dovecot_backend)s
-[sieve]
-port   = smtp,465,submission
-logpath = %(dovecot_log)s
-backend = %(dovecot_backend)s
-[solid-pop3d]
-port    = pop3,pop3s
-logpath = %(solidpop3d_log)s
-[exim]
-port   = smtp,465,submission
-logpath = %(exim_main_log)s
-[exim-spam]
-port   = smtp,465,submission
-logpath = %(exim_main_log)s
-[kerio]
-port    = imap,smtp,imaps,465
-logpath = /opt/kerio/mailserver/store/logs/security.log
-[courier-auth]
-port     = smtp,465,submission,imap3,imaps,pop3,pop3s
-logpath  = %(syslog_mail)s
-backend  = %(syslog_backend)s
-[postfix-sasl]
-port     = smtp,465,submission,imap3,imaps,pop3,pop3s
-logpath  = %(postfix_log)s
-backend  = %(postfix_backend)s
-[perdition]
-port   = imap3,imaps,pop3,pop3s
-logpath = %(syslog_mail)s
-backend = %(syslog_backend)s
-[squirrelmail]
-port = smtp,465,submission,imap2,imap3,imaps,pop3,pop3s,http,https,socks
-logpath = /var/lib/squirrelmail/prefs/squirrelmail_access_log
-[cyrus-imap]
-port   = imap3,imaps
-logpath = %(syslog_mail)s
-backend = %(syslog_backend)s
-[uwimap-auth]
-port   = imap3,imaps
-logpath = %(syslog_mail)s
-backend = %(syslog_backend)s
-[named-refused]
-port     = domain,953
-logpath  = /var/log/named/security.log
-[nsd]
-port     = 53
-action   = %(banaction)s[name=%(__name__)s-tcp, port="%(port)s", protocol="tcp", chain="%(chain)s", actname=%(banaction)s-tcp]
-           %(banaction)s[name=%(__name__)s-udp, port="%(port)s", protocol="udp", chain="%(chain)s", actname=%(banaction)s-udp]
-logpath = /var/log/nsd.log
-[asterisk]
-port     = 5060,5061
-action   = %(banaction)s[name=%(__name__)s-tcp, port="%(port)s", protocol="tcp", chain="%(chain)s", actname=%(banaction)s-tcp]
-           %(banaction)s[name=%(__name__)s-udp, port="%(port)s", protocol="udp", chain="%(chain)s", actname=%(banaction)s-udp]
-           %(mta)s-whois[name=%(__name__)s, dest="%(destemail)s"]
-logpath  = /var/log/asterisk/messages
-maxretry = 10
-[freeswitch]
-port     = 5060,5061
-action   = %(banaction)s[name=%(__name__)s-tcp, port="%(port)s", protocol="tcp", chain="%(chain)s", actname=%(banaction)s-tcp]
-           %(banaction)s[name=%(__name__)s-udp, port="%(port)s", protocol="udp", chain="%(chain)s", actname=%(banaction)s-udp]
-           %(mta)s-whois[name=%(__name__)s, dest="%(destemail)s"]
-logpath  = /var/log/freeswitch.log
-maxretry = 10
-[mysqld-auth]
-port     = 3306
-logpath  = %(mysql_log)s
-backend  = %(mysql_backend)s
-[recidive]
-logpath  = /var/log/fail2ban.log
-banaction = %(banaction_allports)s
-bantime  = 604800  ; 1 week
-findtime = 86400   ; 1 day
-[pam-generic]
-banaction = %(banaction_allports)s
-logpath  = %(syslog_authpriv)s
-backend  = %(syslog_backend)s
-[xinetd-fail]
-banaction = iptables-multiport-log
-logpath   = %(syslog_daemon)s
-backend   = %(syslog_backend)s
-maxretry  = 2
-[stunnel]
-logpath = /var/log/stunnel4/stunnel.log
-[ejabberd-auth]
-port    = 5222
-logpath = /var/log/ejabberd/ejabberd.log
-[counter-strike]
-logpath = /opt/cstrike/logs/L[0-9]*.log
-# Firewall: http://www.cstrike-planet.com/faq/6
-tcpport = 27030,27031,27032,27033,27034,27035,27036,27037,27038,27039
-udpport = 1200,27000,27001,27002,27003,27004,27005,27006,27007,27008,27009,27010,27011,27012,27013,27014,27015
-action  = %(banaction)s[name=%(__name__)s-tcp, port="%(tcpport)s", protocol="tcp", chain="%(chain)s", actname=%(banaction)s-tcp]
-           %(banaction)s[name=%(__name__)s-udp, port="%(udpport)s", protocol="udp", chain="%(chain)s", actname=%(banaction)s-udp]
-[nagios]
-logpath  = %(syslog_daemon)s     ; nrpe.cfg may define a different log_facility
-backend  = %(syslog_backend)s
-maxretry = 1
-[directadmin]
-logpath = /var/log/directadmin/login.log
-port = 2222
-[portsentry]
-logpath  = /var/lib/portsentry/portsentry.history
-maxretry = 1
-[pass2allow-ftp]
-# this pass2allow example allows FTP traffic after successful HTTP authentication
-port         = ftp,ftp-data,ftps,ftps-data
-# knocking_url variable must be overridden to some secret value in filter.d/apache-pass.local
-filter       = apache-pass
-# access log of the website with HTTP auth
-logpath      = %(apache_access_log)s
-blocktype    = RETURN
-returntype   = DROP
-bantime      = 3600
-maxretry     = 1
-findtime     = 1
-[murmur]
-port     = 64738
-action   = %(banaction)s[name=%(__name__)s-tcp, port="%(port)s", protocol=tcp, chain="%(chain)s", actname=%(banaction)s-tcp]
-           %(banaction)s[name=%(__name__)s-udp, port="%(port)s", protocol=udp, chain="%(chain)s", actname=%(banaction)s-udp]
-logpath  = /var/log/mumble-server/mumble-server.log
-[screensharingd]
-logpath  = /var/log/system.log
-logencoding = utf-8
-[haproxy-http-auth]
-logpath  = /var/log/haproxy.log' >> /etc/fail2ban/jail.local
-
-
-[[ -e $HOME/fail2ban ]] && rm $HOME/fail2ban
-[[ -d $HOME/fail2ban-0.11.2 ]] && rm -rf $HOME/fail2ban-0.11.2
-
-cd 
-service fail2ban restart
-fi

+ 0 - 289
LACASITAMX-v8.9x/Ofus/herramientas/paysnd.sh

@@ -1,289 +0,0 @@
-#!/bin/bash
-#19/12/2019
-clear
-clear
-declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
-SCPdir="/etc/VPS-MX" && [[ ! -d ${SCPdir} ]] && exit 1
-SCPusr="${SCPdir}/controlador" && [[ ! -d ${SCPusr} ]] && mkdir ${SCPusr}
-SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-construct_fun () {
-payload="$1"
-sed -i 's/.crlf]/\\r\\n&/g' ${payload}
-sed -i "s/.crlf]//g" ${payload}
-sed -i 's/.cr]/\\r&/g' ${payload}
-sed -i "s/.cr]//g" ${payload}
-sed -i 's/.lf]/\\n&/g' ${payload}
-sed -i "s/.lf]//g" ${payload}
-sed -i "s/.auth]//g" ${payload}
-sed -i 's/.delay_split]/\\r\\n&/g' ${payload}
-sed -i "s/.delay_split]//g" ${payload}
-sed -i 's/.instant_split]/\\r\\n&/g' ${payload}
-sed -i "s/.instant_split]//g" ${payload}
-sed -i 's/.split]/\\r\\n&/g' ${payload}
-sed -i "s/.split]//g" ${payload}
-sed -i "s;.host_port];${hostprox}:22;g" ${payload}
-sed -i "s;.host];${proxy};g" ${payload}
-sed -i "s;.port];:22;g" ${payload}
-sed -i 's;.protocol];HTTP/1.0;g' ${payload}
-sed -i 's;.ua];Dalvik/2.1.0;g' ${payload}
-sed -i 's;.method];CONNECT;g' ${payload}
-sed -i "s;.raw];CONNECT ${hostprox}:22 HTTP/1.0;g" ${payload}
-sed -i "s;.netData];CONNECT ${hostprox}:22 HTTP/1.0;g" ${payload}
-sed -i "s;.realData];CONNECT ${hostprox}:22 HTTP/1.0;g" ${payload}
-}
-esquelet="./payloads.txt"
-gerar_arqpay () {
-echo 'GET http://mhost/ HTTP/1.1[crlf][raw][crlf] [crlf][crlf]
-CONNECT mhost@[host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf][crlf]
-CONNECT mhost@[host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf] [crlf]
-CONNECT [host_port]@mhost HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf][crlf]
-CONNECT [host_port]@mhost HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf][crlf]CONNECT [host_port]@mhost [protocol][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf][crlf]CONNECT [host_port]@mhost [protocol][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]User-Agent: [ua][crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]User-Agent: [ua][crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]User-Agent: [ua][crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf] [crlf]
-CONNECT mhost@[host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]User-Agent: [ua][crlf][crlf]
-CONNECT mhost@[host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]User-Agent: [ua][crlf] [crlf]
-CONNECT mhost@[host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Referer: mhost[crlf][crlf]
-CONNECT mhost@[host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Referer: mhost[crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf] [crlf]
-GET mhost@[host_port] [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf][crlf]
-GET mhost@[host_port] [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf] [crlf]
-GET [host_port]@mhost [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf][crlf]
-GET [host_port]@mhost [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf] [crlf]
-CONNECT [host_port]@mhost [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf]
-CONNECT [host_port]@mhost [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf][raw][crlf] [crlf]
-CONNECT [host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf][crlf]
-CONNECT [host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]User-Agent: [ua][crlf][crlf][split][raw][crlf][crlf]CONNECT mhost:443 HTTP/1.1[crlf][raw][crlf][crlf]GET http://mhost/ HTTP/1.0[crlf]Host: mhost[crlf]Proxy-Authorization: basic: mhost[crlf]User-Agent: [ua][crlf]Connection: close[crlf]Proxy-Connection: Keep-Alive [crlf]Host: [host][crlf][crlf][split][raw][crlf][crlf]GET http://mhost/ HTTP/1.0[crlf]Host: mhost/[crlf][crlf]CONNECT [host_port] HTTP/1.0[crlf][crlf][realData][crlf][crlf]
-[method] mhost:443 HTTP/1.1[crlf][raw][crlf][crlf]GET http://mhost/ HTTP/1.1\nHost: mhost\nConnection: close\nConnection: close\nUser-Agent:[ua][crlf]Proxy-Connection: Keep-Alive[crlf]Host: [host][crlf][crlf][delay_split][raw][crlf][crlf][raw][crlf][realData][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]User-Agent: KDDI[crlf]Host: [host][crlf][crlf][raw][raw][crlf][raw][crlf][raw][crlf][crlf]DELETE http://mhost/ HTTP/1.1[crlf]Host: m.opera.com[crlf]Proxy-Authorization: basic: *[crlf]User-Agent: KDDI[crlf]Connection: close[crlf]Proxy-Connection: Direct[crlf]Host: [host][crlf][crlf][raw][raw][crlf][crlf][raw][method] http://mhost[port] HTTP/1.1[crlf]Host: [host][crlf][crlf]CONNECT [host] [protocol][crlf][crlf][CONNECT [host] [protocol][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][netData][crlf][instant_split]MOVE http://mhost[delay_split][crlf][crlf][netData][crlf][instant_split]MOVE http://mhost[delay_split][crlf][crlf][netData][crlf][instant_split]MOVE http://mhost[delay_split][crlf][crlf]X-Online-Host: mhost[crlf]Packet Length: Authorization[crlf]Packet Content: Authorization[crlf]Transfer-Encoding: chunked[crlf]Referer: mhost[crlf][crlf]
-[crlf][crlf]CONNECT [host_port]@mhost/ [protocol][crlf][delay_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]User-Agent: [ua][crlf]CONNECT [host]@mhost/ [protocol][crlf][crlf]
-[method] [host_port] [protocol] [delay_split]GET http://mhost/ HTTP/1.1[netData][crlf]GET mip:80[crlf]X-GreenArrow-MtaID: smtp1-1[crlf]CONNECT http://mhost/ HTTP/1.1[crlf]CONNECT http://mhost/ HTTP/1.0[crlf][split]CONNECT http://mhost/ HTTP/1.1[crlf]CONNECT http://mhost/ HTTP/1.1[crlf][crlf][method] [host_port] [protocol]?[split]GET http://mhost:8080/[crlf][crlf]GET [host_port] [protocol]?[split]OPTIONS http://mhost/[crlf]Connection: Keep-Alive[crlf]User-Agent: Mozilla/5.0 (Android; Mobile; rv:35.0) Gecko/35.0 Firefox/35.0[crlf]CONNECT [host_port] [protocol] [crlf]GET [host_port] [protocol]?[split]GET http://mhost/[crlf][crlf][method] mip:80[split]GET mhost/[crlf][crlf]: Cache-Control:no-store,no-cache,must-revalidate,post-check=0,pre-check=0[crlf]Connection:close[crlf]CONNECT [host_port] [protocol]?[split]GET http://mhost:/[crlf][crlf]POST [host_port] [protocol]?[split]GET[crlf]mhost:/[crlf]Content-Length: 999999999\r\n\r\n
-GET [host_port] [protocol][crlf][delay_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Referer: mhost[crlf]X-Online-Host: mhost[crlf]X-Forward-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf][raw][crlf][crlf]
-CONNECT [host_port] [protocol]GET http://mhost/ [protocol][crlf][split]GET mhost/ HTTP/1.1[crlf][crlf]
-CONNECT [host_port] [protocol]GET http://mhost/ [protocol][crlf][split]GET http://mhost/ HTTP/1.1[crlf]Host: navegue.vivo.ddivulga.com/pacote[crlf][crlf]CONNECT [host_port] [protocol]GET http://mhost/ [protocol][crlf][split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf]CONNECT [host_port] [protocol]GET http://mhost/ [protocol][crlf][split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf]CONNECT [host_port] [protocol]GET http://mhost/ [protocol][crlf][split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf]CONNECT [host_port] [protocol]GET http://mhost/ [protocol][crlf][split]CONNECT [host_port]@mhost/ [protocol][crlf]Host: mhost/[crlf]GET mhost/ HTTP/1.1[crlf]HEAD mhost/ HTTP/1.1[crlf]TRACE mhost/ HTTP/1.1[crlf]OPTIONS mhost/ HTTP/1.1[crlf]PATCH mhost/ HTTP/1.1[crlf]PROPATCH mhost/ HTTP/1.1[crlf]DELETE mhost/ HTTP/1.1[crlf]PUT mhost/ HTTP/1.1[crlf]Host: mhost/[crlf]Host: mhost/[crlf]X-Forward-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]X-Forwarded-For: mhost[protocol][crlf][crlf]
-[raw][split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost/[crlf]X-Forward-Host: mhost/[crlf]Connection: Keep-Alive[crlf]Connection: Close[crlf]User-Agent: [ua][crlf][crlf]
-[raw][split]GET mhost/ HTTP/1.1[crlf] [crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf][instant_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]GET mhost/[crlf]Connection: close Keep-Alive[crlf]User-Agent: [ua][crlf][crlf][raw][crlf][crlf]
-[raw]split]GET mhost/ HTTP/1.1[crlf][crlf]
-GET [host_port] [protocol][instant_split]GET http://mhost/ HTTP/1.1[crlf]
-GET [host_port] [protocol][crlf][delay_split]CONNECT http://mhost/ HTTP/1.1[crlf]
-CONNECT [host_port] [protocol] [instant_split]GET http://mhost/ HTTP/1.1[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf][crlf][instant_split]GET http://mhost/ HTTP/1.1[crlf]User-Agent: [ua][crlf][crlf]
-GET http://mhost/ HTTP/2.0[auth][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forward-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf]CONNECT [host_port] [protocol] [auth][crlf][crlf][delay_split][raw][crlf]JAZZ http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forward-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf][raw][crlf][crlf][delay_split]CONNECT [host_port] [protocol] [method][crlf] [crlf][crlf]
-CONNECT [host_port] [protocol][crlf]GET http://mhost/ HTTP/1.1\rHost: mhost\r[crlf]X-Online-Host: mhost\r[crlf]X-Forward-Host: mhost\rUser-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-gb) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/2.9174AP[crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost/ [crlf]User-Agent: Yes[crlf]Connection: close[crlf]Proxy-Connection: Keep-Alive[crlf][crlf][raw][crlf][crlf]
-GET [host_port] [protocol][crlf][split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][raw][crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf]Connection: close[crlf]Proxy-connection: Keep-Alive[crlf]Proxy-Authorization: Basic[crlf]UseDNS: Yes[crlf]Cache-Control: no-cache[crlf][raw][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf] Access-Control-Allow-Credentials: true, true[crlf] Access-Control-Allow-Headers: X-Requested-With,Content-Type, X-Requested-With,Content-Type[crlf]  Access-Control-Allow-Methods: GET,PUT,OPTIONS,POST,DELETE, GET,PUT,OPTIONS,POST,DELETE[crlf]  Age: 8, 8[crlf] Cache-Control: max-age=86400[crlf] public[crlf] Connection: keep-alive[crlf] Content-Type: text/html; charset=UTF-8[crlf]Content-Length: 9999999999999[crlf]UseDNS: Yes[crlf]Vary: Accept-Encoding[crlf][raw][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf] Access-Control-Allow-Credentials: true, true[crlf] Access-Control-Allow-Headers: X-Requested-With,Content-Type, X-Requested-With,Content-Type[crlf]  Access-Control-Allow-Methods: GET,PUT,OPTIONS,POST,DELETE, GET,PUT,OPTIONS,POST,DELETE[crlf]  Age: 8, 8[crlf] Cache-Control: max-age=86400[crlf] public[crlf] Connection: keep-alive[crlf] Content-Type: text/html; charset=UTF-8[crlf]Content-Length: 9999999999999[crlf]Vary: Accept-Encoding[crlf][raw][crlf] [crlf][crlf]
-[netData][split][raw][crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost/[crlf]User-Agent: Yes[crlf]Connection: close[crlf]Proxy-Connection: update[crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]host: http://mhost/[crlf]Connection: close update[crlf]User-Agent: [ua][crlf][crlf][raw][crlf][crlf] [crlf]
-[raw][crlf][split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][raw][crlf][crlf]User-Agent: [ua][crlf]Connection: Close[crlf]Proxy-connection: Close[crlf]Proxy-Authorization: Basic[crlf]Cache-Control: no-cache[crlf]Connection: Keep-Alive[crlf][raw][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Content-Type: text/html; charset=iso-8859-1[crlf]Connection: close[crlf][crlf]User-Agent: [ua][crlf][crlf]Referer: mhost[crlf]Cookie: mhost[crlf]Proxy-Connection: Keep-Alive [crlf][crlf][raw][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Upgrade-Insecure-Requests: 1[crlf]User-Agent: Mozilla/5.0 (Linux; Android 5.1; LG-X220 Build/LMY47I) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36[crlf]Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[crlf]Referer: http://mhost[crlf]Accept-Encoding: gzip, deflate, sdch[crlf]Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4[crlf]Cookie: _ga=GA1.2.2045323091.1494102805; _gid=GA1.2.1482137697.1494102805; tfp=80bcf53934df3482b37b54c954bd53ab; tpctmp=1494102806975; pnahc=0; _parsely_visitor={%22id%22:%22719d5f49-e168-4c56-b7c7-afdce6daef18%22%2C%22session_count%22:1%2C%22last_session_ts%22:1494102810109}; sc_is_visitor_unique=rx10046506.1494105143.4F070B22E5E94FC564C94CB6DE2D8F78.1.1.1.1.1.1.1.1.1[crlf][crlf]Connection: close[crlf]Proxy-Connection: Keep-Alive[crlf][netData][crlf] [crlf][crlf]
-GET [host_port] [protocol][crlf][split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][raw][crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf]Connection: close[crlf]Proxy-connection: Keep-Alive[crlf]Proxy-Authorization: Basic[crlf]Cache-Control: no-cache[crlf][raw][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]User-Agent: [ua][crlf]Connection: close [crlf]Referer:http://mhost[crlf]Content-Type: text/html; charset=iso-8859-1[crlf]Content-Length:0[crlf]Accept: text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5[crlf][raw][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]User-Agent: null[crlf]Connection: close[crlf]Proxy-Connection: x-online-host[crlf][crlf] CONNECT [host_port] [protocol] [netData][crlf]Content-Length: 130 [crlf][crlf]
-[raw][crlf][delay_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf]Connection: close[crlf][crlf]User-Agent: Yes[crlf]Accept-Encoding: gzip,deflate[crlf]Accept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7[crlf]Connection: Basic[crlf]Referer: mhost[crlf]Cookie: mhost/ [crlf]Proxy-Connection: Keep-Alive[crlf][crlf][netData][crlf] [crlf][crlf]
-[raw][crlf][delay_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf]Connection: close[crlf]Accept-Language: en-us,en;q=0.5[crlf]Accept-Encoding: gzip,deflate[crlf]Accept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7[crlf]Keep-Alive: 115[crlf]Connection: keep-alive[crlf]Referer: mhost[crlf]Cookie: mhost/ Proxy-Connection: Keep-Alive[crlf][crlf][netData][crlf] [crlf][crlf]
-[raw][crlf][delay_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf]Connection: close[crlf]Proxy-connection: Keep-Alive[crlf]Proxy-Authorization: Basic[crlf]Cache-Control: no-cache[crlf][raw][crlf] [crlf]
-[raw][crlf][delay_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf]Connection: close[crlf][crlf][raw][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][netData][crlf] [crlf][crlf]CONNECT [host_port][method]HTTP/1.1[crlf]HEAD http://mhost/ [protocol][crlf]Host: mhost[crlf][crlf]DELETE http://mhost/ HTTP/1.1[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][method] [host_port]@mip [crlf][crlf]http://mhost/ HTTP/1.1[crlf]mip[crlf][crlf] [crlf][crlf]http://mhost/ HTTP/1.1[crlf]Host@mip[crlf][crlf] [crlf][crlf] http://mhost/ HTTP/1.1[crlf]Host mhost/[crlf][crlf][netData][crlf] [crlf][crlf] http://mhost/ HTTP/1.1[crlf] [crlf][crlf][netData][crlf] [crlf][crlf] http://mhost/ HTTP/1.1[cr][crlf] [crlf][crlf][netData][cr][crlf] [crlf][crlf]CONNECT mip:22@http://mhost/ HTTP/1.1[crlf] [crlf][crlf][netData][crlf] [crlf][crlf]
-CONNECT [host_port]@mhost/ HTTP/1.1[crlf][crlf]CONNECT http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Forwarded-For: mhost[crlf]Connection: close[crlf]User-Agent: [ua][crlf]Proxy-connection: Keep-Alive[crlf]Proxy-Authorization: Basic[crlf]Cache-Control : no-cache[crlf][crlf]
-CONNECT [host_port]@mhost/ HTTP/1.0[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Forwarded-For: mhost[crlf]Connection: close[crlf]User-Agent: [ua][crlf]Proxy-connection: Keep-Alive[crlf]Proxy-Authorization: Basic[crlf]Cache-Control : no-cache[crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13[crlf]Accept-Language: en-us,en;q=0.5[crlf]Accept-Encoding: gzip,deflate[crlf]Accept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7[crlf]Keep-Alive: 115[crlf]Connection: keep-alive[crlf]Referer: mhost[crlf]Cookie: mhost/ Proxy-Connection: Keep-Alive [crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]User-Agent: Yes[crlf]Accept-Encoding: gzip,deflate[crlf]Accept-Charset: ISO-8859-1,utf-8;q=0.7,;q=0.7[crlf]Connection: Basic[crlf]Referer: mhost[crlf]Cookie: mhost/ [crlf]Proxy-Connection: Keep-Alive[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forward-Host: mhost[crlf]X-Forwarded-For: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf][crlf][delay_split]CONNECT [host_port]@mhost/ [protocol][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]DATA: 2048B[crlf]Host: mhost[crlf]User-Agent: Yes[crlf]Connection: close[crlf]Accept-Encoding: gzip[crlf]Non-Buffer: true[crlf]Proxy: false[crlf][crlf][netData][crlf] [crlf][crlf]
-GET [host_port] [protocol][crlf][delay_split]CONNECT http://mhost/ HTTP/1.1[crlf]Host: http://mhost/[crlf]X-Online-Host: mhost[crlf]X-Forward-Host: http://mhost[crlf]X-Forwarded-For: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Cache-Control=max-age=0[crlf][crlf][raw][crlf] [crlf][crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf]X-Online-Host: mhost[crlf][crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Referer: mhost[crlf]GET /HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf]User-Agent: [ua][crlf][raw][crlf][crlf][raw][crlf]Referer: mhost[crlf][crlf]
-GET http://mhost/ HTTP/1.1[cr][crlf]Host: mhost/\nUser-Agent: Yes\nConnection: close\nProxy-Connection: Keep-Alive\n\r\n\r\n[netData]\r\n \r\n\r\n
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: close Keep-Alive[crlf]User-Agent: [ua][crlf][crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forward-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf][split]CONNECT mhost@[host_port] [protocol][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf][realData][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf][crlf]CONNECT mhost/ [protocol][crlf][crlf]
-[raw][crlf]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]CONNECT mhost/ [protocol][crlf]
-[raw] HTTP/1.0\r\n\r\nGET http://mhost/ HTTP/1.1\r\nHost: mhost\r\nConnection: Keep-Alive\r\nCONNECT mhost\r\n\r\n
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][raw][crlf][crlf]
-GET [host_port]@mhost/ HTTP/1.1[crlf]X-Real-IP:mip[crlf]X-Forwarded-For:http://mhost/ http://mhost/[crlf]X-Forwarded-Port:mhost[crlf]X-Forwarded-Proto:http[crlf]Connection:Keep-Alive[crlf][crlf][instant_split][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host:mhost[crlf][crlf][split][realData][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf][realData][crlf]CONNECT mhost/ HTTP/1.1[crlf][crlf]
-CONNECT [host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forward-Host: mhost[crlf]User-Agent: [ua][crlf][raw][crlf][crlf]
-[raw][crlf]GET http://mhost/ [protocol][crlf][split]mhost:/ HTTP/1.1[crlf]Host: mhost:[crlf]X-Forward-Host: mhost:[crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Connection: close[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host:http://mhost[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1\r\nHost: mhost\r\n\r\n[netData]\r\n\r\n\r\n
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][realData][crlf][crlf]
-GET http://mhost/ HTTP/1.1\r\nX-Online-Host:mhost\r\n\r\nCONNECT mip:443[crlf]HTTP/1.0\r\n \r\n\\r\n\r\n\\r\n\r\n\\r\n\r\n\\r\n\r\n\\\r\n
-GET http://mhost/ HTTP/1.1\r\nGET: mhost\n\r\nCONNECT mip:443[crlf]HTTP/1.0\r\n \r\n\\r\n\r\n\\r\n\r\n\\r\n\r\n\\r\n\r\n\\\r\n
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf]Connection: close[crlf][raw][crlf] [crlf][crlf]
-GET http://mhost/[crlf]X-Forward-Host: mhost[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost[crlf]X-Forward-Host: mhost[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost[crlf][crlf]CONNECT mhost/ [protocol][crlf] [crlf][crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf]mhost[crlf]HEAD http://mhost/ [protocol][crlf]Host: mhost/ [crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf]Forward-Host: mhost[crlf]HEAD http://mhost/ [protocol][crlf]Host: mhost/ [crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf]Connection: http://mhost[crlf]HEAD http://mhost/ [protocol][crlf]Host: mhost/ [crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf]CONNECT mhost@[host_port] [protocol][crlf]HEAD http://mhost/ [protocol][crlf]Host: mhost/ [crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf]Connection: Keep-Alive[crlf]mhost@[host_port][crlf]HEAD http://mhost/ [protocol][crlf]Host: mhost/ [crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf][netdata][crlf] [crlf]GET mhost/ [protocol][crlf]User-Agent: [ua][crlf][raw][crlf][crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf][crlf]User-Agent: [ua][crlf][raw][crlf][crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf][crlf][split]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]X-Forwarded-For: mhost[crlf][crlf]User-Agent: [ua][crlf]Connection: close[crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost[crlf][crlf][raw][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost[crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf][raw][crlf] [crlf][crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf][crlf]CONNECT http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf]
-GET http://mhost/ [method] [host_port] HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf]Connection: close[crlf][netData][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf]CONNECT mhost@[host_port] [protocol][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]CONNECT mhost@[host_port] [protocol][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]CONNECT http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf]Connection: close[crlf][netdata][crlf] [crlf][split]Connection: close[crlf]Content-Lenght: 20624[crlf][crlf][netData][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf][crlf][netData][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]mhost\r\nHost:mhost\r\n\r\n[netData]\r\n \r\n\r\n
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost[crlf][crlf][realData][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf][crlf]HEAD http://mhost/ [protocol][crlf]Host: mhost/ [crlf]CONNECT mhost/  [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]host: mhost[crlf][crlf][realData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost/ [crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf][crlf][raw][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost[crlf]Connection: Keep-Alive[crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf][crlf][realData][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf][crlf]Host: mhost[crlf][crlf]CONNECT mhost/ [protocol][crlf] [crlf]
-GET http://mhost/ HTTP/1.1[crlf]mhost[crlf]Host: mhost[crlf][crlf]CONNECT mhost/ [crlf][raw][crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]mhost[crlf]Host: mhost[crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf][crlf]CONNECT [host_port][crlf]CONNECT mhost/ [crlf][crlf][cr]
-[realData][crlf][split]GET http://mhost/  HTTP/1.1[crlf][crlf]Host: mhost[crlf]X-Online-Host: mhost[crlf]Connection: Keep-Alive[crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]mhost[crlf]Host: mhost[crlf][crlf]CONNECT [host_port][crlf]GET mhost/ [crlf]
-CONNECT [host_port]@mhost/ HTTP/1.1[crlf][crlf]GET http://mhost/ [protocol][crlf]Host: mhost[crlf]X-Forward-Host: mhost[crlf][raw][crlf][crlf]
-[raw][crlf][cr][crlf]X-Online-Host: mhost[crlf]Connection: [crlf]User-Agent: [ua][crlf]Content-Lenght: 99999999999[crlf][crlf]
-[raw][crlf]X-Online-Host: mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][raw][crlf]X-Online-Host: mhost[crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Authorization: Basic: Connection: X-Forward-Keep-AliveX-Online-Host: mhost[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]host:frontend.claro.com.br[crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][raw][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf][netData][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: Multibanco.com.br[crlf][crlf][raw][crlf] [crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Host: mhost/ [crlf][crlf][raw][crlf]CONNECT [crlf]
-GET http://mhost/ HTTP/1.1[crlf] Proxy-Authorization: Basic:Connection: X-Forward-Keep-AliveX-Online-Host:[crlf][crlf][netData][crlf] [crlf][crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf][instant_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf]Host: mhost[crlf][crlf]
-[raw][crlf]X-Online-Host: mhost[crlf][crlf][raw][crlf]X-Online-Host: mhost/ [crlf][crlf]
-[raw][crlf]X-Online-Host: http://mhost[crlf][crlf]CONNECT[host_port] [protocol][crlf]X-Online-Host: mhost/ [crlf][crlf]
-CONNECT [host_port]@mhost/ HTTP/1.1[crlf]CONNECT mip:443 [crlf][crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf]Host: mhost[crlf]X-Forwarded-For: mhost[crlf][crlf][split]GET mhost/ HTTP/1.1[cr][crlf][raw][crlf] [crlf][crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf][delay_split]GET http://mhost/ HTTP/1.1[crlf]Host:mhost[crlf][crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf][instant_split]GET http://mhost/ HTTP/1.1[crlf]Host: mhost[crlf][crlf]
-GET http://mhost/ HTTP/1.1[crlf]Content-Type: text[crlf]Cache-Control: no-cache[crlf]Connection: close[crlf]Content-Lenght: 20624[crlf]GET mip:443@mhost/ HTTP/1.1[crlf][crlf]
-CONNECT [host_port]@mhost/ [protocol][crlf]Host: mhost[crlf]X-Forwarded-For: mhost/ User-Agent: Yes[crlf]Connection: close[crlf]Proxy-Connection: Keep-Alive Connection: Transfer-Encoding[crlf] [protocol][crlf]User-Agent: [ua][crlf][raw][auth][crlf][crlf][netData][crlf] [crlf][crlf]
-[raw][crlf]Host: mhost[crlf]GET http://mhost/ HTTP/1.1[crlf]X-Online-Host: mhost[crlf][crlf]' > $esquelet
-}
-err_fun () {
-echo -e "${cor[5]} Operacion Invalida"
-exit
-}
-msg -bar
-msg -tit
-echo -e "${cor[3]}               PAYLOAD BRUTE FORCE "
-msg -bar
-gerar_pay () {
-# Coletando Host
-while [[ ! ${value1} ]]; do
-    read -p " Host Test: " value1
-done
-curl -I ${value1} > /dev/null 2>&1 || err_fun
-[[ $(echo ${value1}|rev|cut -c 1) = "/" ]] && valor1="${value1:0:$((${#value1}-1))}" || valor1="${value1}"
-valor2="127.0.0.1"
-msg -bar
-echo -e "${cor[5]} Request Method ${cor[3]}"
-cat <<EOF
- [1] - GET        [2] - CONNECT  [3] - PUT     [4] - OPTIONS
- [5] - DELETE     [6] - HEAD     [7] - PATCH   [8] - POST
-EOF
-msg -bar
-# Coletando Requisição
-while [[ ! ${req} ]]; do
-    read -p " => " valor3
-    case $valor3 in
-    1)req="GET";;
-    2)req="CONNECT";;
-    3)req="PUT";;
-    4)req="OPTIONS";;
-    5)req="DELETE";;
-    6)req="HEAD";;
-    7)req="PATCH";;
-    8)req="POST";;
-    esac
-done
-in="netData"
-gerar_arqpay
-sed -i "s;realData;abc;g" $esquelet
-sed -i "s;netData;abc;g" $esquelet
-sed -i "s;netdata;abc;g" $esquelet
-sed -i "s;raw;abc;g" $esquelet
-sed -i "s;abc;$in;g" $esquelet
-sed -i "s;GET;$req;g" $esquelet
-sed -i "s;mhost;$valor1;g" $esquelet
-sed -i "s;mip;$valor2;g" $esquelet
-msg -bar
-read -p " Digite el Proxy/Dropbear: " hostprox
-read -p " Digite el Puerto: " portx
-msg -bar
-echo -e "${cor[1]} STARTING..."
-msg -bar
-}
-while true; do
-echo -e " [1]-Testear Un Payload"
-echo -e " [2]-Testear Payloads Registrados"
-msg -bar
-read -p " [1-2]: " opx
-case $opx in
-1)
-read -p " Digite un Payload: " payloadx
-echo "$payloadx" > $esquelet
-sed -i "s;realData;abc;g" $esquelet
-sed -i "s;netData;abc;g" $esquelet
-sed -i "s;netdata;abc;g" $esquelet
-sed -i "s;raw;abc;g" $esquelet
-sed -i "s;abc;$in;g" $esquelet
-sed -i "s;GET;$req;g" $esquelet
-sed -i "s;mhost;$valor1;g" $esquelet
-sed -i "s;mip;$valor2;g" $esquelet
-construct_fun $esquelet
-read -p " Digite el Proxy/o Dropbear: " hostprox
-read -p " Digite el Puerto: " portx
-msg -bar
-break
-;;
-2)
-msg -bar
-gerar_pay
-construct_fun $esquelet
-break
-;;
-esac
-done
-read -p " Digite el Tiempo De Espera! (Segundos): " VARS
-msg -bar
-line=$(($(cat $esquelet|wc -l)+1))
-for((a=1; a<$line; a++)); do
-(
-echo -ne "${cor[1]}Payload: ${cor[3]}" >&2
-cat $esquelet|head -${a}|tail -1 >&2
-echo -ne "${cor[1]}Respuesta: ${cor[2]}" >&2
-pay="$(cat $esquelet|head -${a}|tail -1)"
-exec 5<>/dev/tcp/${hostprox}/${portx}
-echo "$pay" >&5
-echo -e "$(cat <&5|head -1)\n" >&2
-) & > /dev/null
-PID=$!
-sleep ${VARS}s
-kill -SIGINT $PID &>/dev/null && echo -e "Sin Respuesta\n"
-done
-echo -ne "\033[0m"

+ 0 - 235
LACASITAMX-v8.9x/Ofus/herramientas/ports.sh

@@ -1,235 +0,0 @@
-#!/bin/bash
-#27/01/2021
-clear
-clear
-declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
-SCPdir="/etc/VPS-MX" && [[ ! -d ${SCPdir} ]] && exit 1
-SCPusr="${SCPdir}/controlador" && [[ ! -d ${SCPusr} ]] && mkdir ${SCPusr}
-SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-port () {
-local portas
-local portas_var=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
-i=0
-while read port; do
-var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
-[[ "$(echo -e ${portas}|grep -w "$var1 $var2")" ]] || {
-    portas+="$var1 $var2 $portas"
-    echo "$var1 $var2"
-    let i++
-    }
-done <<< "$portas_var"
-}
-verify_port () {
-local SERVICE="$1"
-local PORTENTRY="$2"
-[[ ! $(echo -e $(port|grep -v ${SERVICE})|grep -w "$PORTENTRY") ]] && return 0 || return 1
-}
-edit_squid () {
-
-msg -ama "$(fun_trans "REDEFINIR PUERTOS SQUID")"
-msg -bar
-if [[ -e /etc/squid/squid.conf ]]; then
-local CONF="/etc/squid/squid.conf"
-elif [[ -e /etc/squid3/squid.conf ]]; then
-local CONF="/etc/squid3/squid.conf"
-fi
-NEWCONF="$(cat ${CONF}|grep -v "http_port")"
-msg -ne "$(fun_trans "Nuevos Puertos"): "
-read -p "" newports
-for PTS in `echo ${newports}`; do
-verify_port squid "${PTS}" && echo -e "\033[1;33mPort $PTS \033[1;32mOK" || {
-echo -e "\033[1;33mPort $PTS \033[1;31mFAIL"
-return 1
-}
-done
-rm ${CONF}
-while read varline; do
-echo -e "${varline}" >> ${CONF}
- if [[ "${varline}" = "#portas" ]]; then
-  for NPT in $(echo ${newports}); do
-  echo -e "http_port ${NPT}" >> ${CONF}
-  done
- fi
-done <<< "${NEWCONF}"
-msg -azu "$(fun_trans "AGUARDE")"
-service squid restart &>/dev/null
-service squid3 restart &>/dev/null
-sleep 1s
-msg -bar
-msg -azu "$(fun_trans "PUERTOS REDEFINIDOS")"
-msg -bar
-}
-edit_apache () {
-msg -azu "$(fun_trans "REDEFINIR PUERTOS APACHE")"
-msg -bar
-local CONF="/etc/apache2/ports.conf"
-local NEWCONF="$(cat ${CONF})"
-msg -ne "$(fun_trans "Nuevos Puertos"): "
-read -p "" newports
-for PTS in `echo ${newports}`; do
-verify_port apache "${PTS}" && echo -e "\033[1;33mPort $PTS \033[1;32mOK" || {
-echo -e "\033[1;33mPort $PTS \033[1;31mFAIL"
-return 1
-}
-done
-rm ${CONF}
-while read varline; do
-if [[ $(echo ${varline}|grep -w "Listen") ]]; then
- if [[ -z ${END} ]]; then
- echo -e "Listen ${newports}" >> ${CONF}
- END="True"
- else
- echo -e "${varline}" >> ${CONF}
- fi
-else
-echo -e "${varline}" >> ${CONF}
-fi
-done <<< "${NEWCONF}"
-msg -azu "$(fun_trans "AGUARDE")"
-service apache2 restart &>/dev/null
-sleep 1s
-msg -bar
-msg -azu "$(fun_trans "PUERTOS REDEFINIDOS")"
-msg -bar
-}
-edit_openvpn () {
-msg -azu "$(fun_trans "REDEFINIR PUERTOS OPENVPN")"
-msg -bar
-local CONF="/etc/openvpn/server.conf"
-local CONF2="/etc/openvpn/client-common.txt"
-local NEWCONF="$(cat ${CONF}|grep -v [Pp]ort)"
-local NEWCONF2="$(cat ${CONF2})"
-msg -ne "$(fun_trans "Nuevos puertos"): "
-read -p "" newports
-for PTS in `echo ${newports}`; do
-verify_port openvpn "${PTS}" && echo -e "\033[1;33mPort $PTS \033[1;32mOK" || {
-echo -e "\033[1;33mPort $PTS \033[1;31mFAIL"
-return 1
-}
-done
-rm ${CONF}
-while read varline; do
-echo -e "${varline}" >> ${CONF}
-if [[ ${varline} = "proto tcp" ]]; then
-echo -e "port ${newports}" >> ${CONF}
-fi
-done <<< "${NEWCONF}"
-rm ${CONF2}
-while read varline; do
-if [[ $(echo ${varline}|grep -v "remote-random"|grep "remote") ]]; then
-echo -e "$(echo ${varline}|cut -d' ' -f1,2) ${newports} $(echo ${varline}|cut -d' ' -f4)" >> ${CONF2}
-else
-echo -e "${varline}" >> ${CONF2}
-fi
-done <<< "${NEWCONF2}"
-msg -azu "$(fun_trans "AGUARDE")"
-service openvpn restart &>/dev/null
-/etc/init.d/openvpn restart &>/dev/null
-sleep 1s
-msg -bar
-msg -azu "$(fun_trans "PUERTOS REDEFINIDOS")"
-msg -bar
-}
-edit_dropbear () {
-msg -bar
-msg -azu "$(fun_trans "REDEFINIR PUERTOS DROPBEAR")"
-msg -bar
-local CONF="/etc/default/dropbear"
-local NEWCONF="$(cat ${CONF}|grep -v "DROPBEAR_EXTRA_ARGS")"
-msg -ne "$(fun_trans "Nuevos Puertos"): "
-read -p "" newports
-for PTS in `echo ${newports}`; do
-verify_port dropbear "${PTS}" && echo -e "\033[1;33mPort $PTS \033[1;32mOK" || {
-echo -e "\033[1;33mPort $PTS \033[1;31mFAIL"
-return 1
-}
-done
-rm ${CONF}
-while read varline; do
-echo -e "${varline}" >> ${CONF}
- if [[ ${varline} = "NO_START=0" ]]; then
- echo -e 'DROPBEAR_EXTRA_ARGS="VAR"' >> ${CONF}
- for NPT in $(echo ${newports}); do
- sed -i "s/VAR/-p ${NPT} VAR/g" ${CONF}
- done
- sed -i "s/VAR//g" ${CONF}
- fi
-done <<< "${NEWCONF}"
-msg -azu "$(fun_trans "AGUARDE")"
-service dropbear restart &>/dev/null
-sleep 1s
-msg -bar
-msg -azu "$(fun_trans "PUERTOS REDEFINIDOS")"
-msg -bar
-}
-edit_openssh () {
-msg -azu "$(fun_trans "REDEFINIR PUERTOS OPENSSH")"
-msg -bar
-local CONF="/etc/ssh/sshd_config"
-local NEWCONF="$(cat ${CONF}|grep -v [Pp]ort)"
-msg -ne "$(fun_trans "Nuevos Puertos"): "
-read -p "" newports
-for PTS in `echo ${newports}`; do
-verify_port sshd "${PTS}" && echo -e "\033[1;33mPort $PTS \033[1;32mOK" || {
-echo -e "\033[1;33mPort $PTS \033[1;31mFAIL"
-return 1
-}
-done
-rm ${CONF}
-for NPT in $(echo ${newports}); do
-echo -e "Port ${NPT}" >> ${CONF}
-done
-while read varline; do
-echo -e "${varline}" >> ${CONF}
-done <<< "${NEWCONF}"
-msg -azu "$(fun_trans "AGUARDE")"
-service ssh restart &>/dev/null
-service sshd restart &>/dev/null
-sleep 1s
-msg -bar
-msg -azu "$(fun_trans "PUERTOS REDEFINIDOS")"
-msg -bar
-}
-
-main_fun () {
-msg -bar2
-msg -tit ""
-msg -ama "                EDITAR PUERTOS ACTIVOS "
-msg -bar
-lacasita
-msg -bar2
-unset newports
-i=0
-while read line; do
-let i++
-          case $line in
-          squid|squid3)squid=$i;; 
-          apache|apache2)apache=$i;; 
-          openvpn)openvpn=$i;; 
-          dropbear)dropbear=$i;; 
-          sshd)ssh=$i;; 
-          esac
-done <<< "$(port|cut -d' ' -f1|sort -u)"
-for((a=1; a<=$i; a++)); do
-[[ $squid = $a ]] && echo -ne "\033[1;32m [$squid] > " && msg -azu "$(fun_trans "REDEFINIR PUERTOS SQUID")"
-[[ $apache = $a ]] && echo -ne "\033[1;32m [$apache] > " && msg -azu "$(fun_trans "REDEFINIR PUERTOS APACHE")"
-[[ $openvpn = $a ]] && echo -ne "\033[1;32m [$openvpn] > " && msg -azu "$(fun_trans "REDEFINIR PUERTOS OPENVPN")"
-[[ $dropbear = $a ]] && echo -ne "\033[1;32m [$dropbear] > " && msg -azu "$(fun_trans "REDEFINIR PUERTOS DROPBEAR")"
-[[ $ssh = $a ]] && echo -ne "\033[1;32m [$ssh] > " && msg -azu "$(fun_trans "REDEFINIR PUERTOS SSH")"
-done
-echo -ne "$(msg -bar)\n\033[1;32m [0] > " && msg -azu "\e[97m\033[1;41m VOLVER \033[1;37m"
-msg -bar
-while true; do
-echo -ne "\033[1;37m$(fun_trans "Seleccione"): " && read selection
-tput cuu1 && tput dl1
-[[ ! -z $squid ]] && [[ $squid = $selection ]] && edit_squid && break
-[[ ! -z $apache ]] && [[ $apache = $selection ]] && edit_apache && break
-[[ ! -z $openvpn ]] && [[ $openvpn = $selection ]] && edit_openvpn && break
-[[ ! -z $dropbear ]] && [[ $dropbear = $selection ]] && edit_dropbear && break
-[[ ! -z $ssh ]] && [[ $ssh = $selection ]] && edit_openssh && break
-[[ "0" = $selection ]] && break
-done
-#exit 0
-}
-main_fun

+ 0 - 55
LACASITAMX-v8.9x/Ofus/herramientas/speed.py

@@ -1,55 +0,0 @@
-#!/bin/bash
-SCPdir="/etc/VPS-MX"
-SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
-SCPinst="${SCPdir}/protocolos"&& [[ ! -d ${SCPinst} ]] && exit
-
-cas () {
-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;33mESPERE \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;33mESPERE \033[1;37m- \033[1;33m["
-done
-echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m"
-tput cnorm
-}
-
-[[ $(dpkg --get-selections|grep -w "speedtest-cli"|head -1) ]] || apt-get install speedtest-cli -y &>/dev/null 
-
-clear
-msg -bar
-echo -e "   \033[1;32mTESTIANDO VELOCIDAD DEL SERVIDOR !\033[0m"
-msg -bar
-scp(){
-speedtest-cli --share > speed
-}
-cas 'scp'
-msg -bar
-png=$(cat speed | sed -n '5 p' |awk -F : {'print $NF'})
-download=$(cat speed | sed -n '7 p' |awk -F :  {'print $NF'})
-upload=$(cat speed | sed -n '9 p' |awk -F :  {'print $NF'})
-link=$(cat speed | sed -n '10 p' |awk {'print $NF'})
-msg -bar
-echo -e "	\033[1;32mPING (LATENCIA):\033[1;37m$png"
-echo -e "	\033[1;32mDESCARGA:\033[1;37m$download"
-echo -e "	\033[1;32mSUBIDA:\033[1;37m$upload"
-echo -e "\033[1;32mLINK: \033[1;36m$link\033[0m"
-msg -bar
-#rm speed &>/dev/null
-#

+ 0 - 168
LACASITAMX-v8.9x/Ofus/herramientas/squidpass.sh

@@ -1,168 +0,0 @@
-#!/bin/bash
-#27/01/2021
-clear
-clear
-declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
-SCPdir="/etc/VPS-MX" && [[ ! -d ${SCPdir} ]] && exit 1
-SCPusr="${SCPdir}/controlador" && [[ ! -d ${SCPusr} ]] && mkdir ${SCPusr}
-SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-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 &
-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;31m -\033[1;32m 100%\033[1;37m"
-}
-
-#PREENXE A VARIAVEL $IP
-meu_ip () {
-MEU_IP=$(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)
-MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
-[[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" || IP="$MEU_IP"
-}
-
-squidpass () {
-tmp_arq="/tmp/arq-tmp"
-if [ -d "/etc/squid" ]; then
-pwd="/etc/squid/passwd"
-config_="/etc/squid/squid.conf"
-service_="squid"
-squid_="0"
-elif [ -d "/etc/squid3" ]; then
-pwd="/etc/squid3/passwd"
-config_="/etc/squid3/squid.conf"
-service_="squid3"
-squid_="1"
-fi
-[[ ! -e $config_ ]] && 
-msg -bar && 
-echo -e " \033[1;36m Proxy Squid no Instalado no puede proseguir" && 
-msg -bar && 
-return 0
-if [ -e $pwd ]; then 
-echo -e "${cor[3]} Desea Desactivar Autentificasion del Proxy Squid"
-read -p " [S/N]: " -e -i n sshsn
-[[ "$sshsn" = @(s|S|y|Y) ]] && {
-msg -bar
-echo -e " \033[1;36mDesintalando Dependencias:"
-rm -rf /usr/bin/squid_log1
-fun_bar 'apt-get remove apache2-utils'
-msg -bar
-cat $config_ | grep -v '#Password' > $tmp_arq
-mv -f $tmp_arq $config_ 
-cat $config_ | grep -v '^auth_param.*passwd*$' > $tmp_arq
-mv -f $tmp_arq $config_ 
-cat $config_ | grep -v '^auth_param.*proxy*$' > $tmp_arq
-mv -f $tmp_arq $config_ 
-cat $config_ | grep -v '^acl.*REQUIRED*$' > $tmp_arq
-mv -f $tmp_arq $config_ 
-cat $config_ | grep -v '^http_access.*authenticated*$' > $tmp_arq
-mv -f $tmp_arq $config_ 
-cat $config_ | grep -v '^http_access.*all*$' > $tmp_arq
-mv -f $tmp_arq $config_ 
-echo -e "
-http_access allow all" >> "$config_"
-rm -f $pwd
-service $service_ restart  > /dev/null 2>&1 &
-echo -e " \033[1;31m Desautentificasion de Proxy Squid Desactivado"
-msg -bar
-} 
-else
-echo -e "${cor[3]} "Habilitar Autenfificasion de Proxy Squid?""
-read -p " [S/N]: " -e -i n sshsn
-[[ "$sshsn" = @(s|S|y|Y) ]] && {
-msg -bar
-echo -e " \033[1;36mInstalando Dependencias:"
-echo "Archivo SQUID PASS" > /usr/bin/squid_log1
-fun_bar 'apt-get install apache2-utils'
-msg -bar
-read -e -p " Tu nombre de usuario deseado: " usrn
-[[ $usrn = "" ]] && 
-msg -bar && 
-echo -e " \033[1;31mEl usuario no puede ser nulo" && 
-msg -bar && 
-return 0
-htpasswd -c $pwd $usrn
-succes_=$(grep -c "$usrn" $pwd)
-if [ "$succes_" = "0" ]; then
-rm -f $pwd
-msg -bar
-echo -e " \033[1;31m Error al generar la contraseña, no se inició la autenticación de Squid"
-msg -bar
-return 0
-elif [[ "$succes_" = "1" ]]; then
-cat $config_ | grep -v '^http_access.*all*$' > $tmp_arq
-mv -f $tmp_arq $config_ 
-if [ "$squid_" = "0" ]; then
-echo -e "#Password
-auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
-auth_param basic realm proxy
-acl authenticated proxy_auth REQUIRED
-http_access allow authenticated
-http_access deny all" >> "$config_"
-service squid restart  > /dev/null 2>&1 &
-update-rc.d squid defaults > /dev/null 2>&1 &
-elif [ "$squid_" = "1" ]; then
-echo -e "#Password
-auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwd
-auth_param basic realm proxy
-acl authenticated proxy_auth REQUIRED
-http_access allow authenticated
-http_access deny all" >> "$config_"
-service squid3 restart > /dev/null 2>&1 &
-update-rc.d squid3 defaults > /dev/null 2>&1 &
-fi
-msg -bar
-service squid restart > /dev/null 2>&1
-echo -e " \033[1;32m PROTECCION DE PROXY INICIADA"
-msg -bar
-fi
-}
-fi 
-}
-msg -bar
-msg -tit
-msg -ama "            AUTENTIFICAR PROXY SQUID "
-msg -bar
-unset squid_log1
-[[ -e /usr/bin/squid_log1 ]] && squid_log1="\033[1;32m$(source trans -b pt:${id} "ACTIVO")"
-echo -e "${cor[2]} [1] > ${cor[3]}AUTENTIFICAR O DESAUTENTIFICAR PROXY $squid_log1"
-echo -e "${cor[2]} [0] > ${cor[4]}VOLVER"
-msg -bar
-echo -ne "\033[1;37mEscoja una Opcion: "
-read optons
-case $optons in
-0)
-msg -bar
-exit
-;;
-1)
-msg -bar
-squidpass
-;;
-esac
-#REINICIANDO VPS-MX (SQUID)
-[[ "$1" = "1" ]] && squidpass
-####_Eliminar_Tmps_####
-[[ -e $_tmp ]] && rm $_tmp
-[[ -e $_tmp2 ]] && rm $_tmp2
-[[ -e $_tmp3 ]] && rm $_tmp3
-[[ -e $_tmp4 ]] && rm $_tmp4

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 1
LACASITAMX-v8.9x/Ofus/herramientas/tcp.sh


+ 0 - 92
LACASITAMX-v8.9x/Ofus/herramientas/ultrahost

@@ -1,92 +0,0 @@
-#!/bin/bash
-#27/06/2021
-clear
-clear
-declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
-SCPdir="/etc/VPS-MX" && [[ ! -d ${SCPdir} ]] && exit 1
-SCPusr="${SCPdir}/controlador" && [[ ! -d ${SCPusr} ]] && mkdir ${SCPusr}
-SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
-subdom () {
-SUBDOM="$1"
-[[ "$SUBDOM" = "" ]] && return
-randomize="$RANDOM"
-    for sites in `cat $log`; do
-    [[ $(echo ${DNS[@]}|grep $sites) = "" ]] && DNS+=($sites)
-    [[ $(echo ${DNS[@]}|grep $sites) != "" ]] && cat $log|grep -v "$sites" > $log
-    done
-    while true; do
-    [[ "$(pidof lynx | wc -w)" -lt "20" ]] && break
-    done
-    (
-    HOST[$randomize]="$SUBDOM"
-    curl -sSL "${HOST[$randomize]}"|grep -Eoi '<a [^>]+>'|grep -Eo 'href="[^\"]+"'|grep -Eo '(http|https)://[a-zA-Z0-9./*]+'|sort -u|awk -F "://" '{print $2}' >> $log
-    ) > /dev/null 2>&1 &
-}
-
-iniciar () {
-while [[ -z $SUB_DOM ]]; do
-echo -ne "\033[1;33m$(fun_trans "Introduzca el Dominio para realizar la prueba"): " && read SUB_DOM
-done
-[[ -z $limite ]] && echo -ne "\033[1;33m$(fun_trans "Escriba el Limite de Resultados"): " && read limite
-[[ -z ${limite} ]] && limite="300"
-msg -bar
-#CRIA LOG
-log="./loog" && touch $log
-#INICIA PRIMEIRA BUSCA
-_DOM=$(curl -sSL "$SUB_DOM"|grep -Eoi '<a [^>]+>'|grep -Eo 'href="[^\"]+"'|grep -Eo '(http|https)://[a-zA-Z0-9./*]+'|sort -u|awk -F "://" '{print $2}')
-  for _DOMS in `echo $_DOM`; do
- [[ $(echo ${DNS[@]}|grep ${_DOMS}) = "" ]] && DNS+=(${_DOMS})
-  done
-#INICIA THREADS
-i=0
-while true; do
-DOMAIN=$(echo "${DNS[$i]}")
-[[ $DOMAIN = "" ]] && break
- if [[ $(echo -e "${PESQ[@]}"|grep "$DOMAIN") = "" ]]; then
-  subdom "$DOMAIN"
-  echo -e "\033[1;31m(Scan\033[1;32m $((${#PESQ[@]}+1))\033[1;31m de \033[1;32m${#DNS[@]}\033[1;31m) - $(fun_trans "Escaneando") ---> \033[1;36mhttp://$DOMAIN\033[1;37m"
-  PESQ+=($DOMAIN)
- fi
-[[ "$(echo ${#DNS[@]})" -gt "$limite" ]] && break
-i=$(($i+1))
-sleep 1s
-done
-rm $log
-msg -bar
-echo -e "\033[1;32m$(fun_trans "Scan Finalizado Inicio de la colección de IPs")\033[1;31m\033[0m"
-[[ -e $HOME/subresult ]] && rm $HOME/subresult
-[[ ! -e $HOME/subresult ]] && touch $HOME/subresult
-for result in $(echo "${DNS[@]}"); do
-(
-rand="$RANDOM"
-dns[rand]="$result"
-scan[rand]=$(echo ${result}|cut -d'/' -f1)
-IP[rand]=$(nslookup "${scan[rand]}"|grep -Eo 'Address: [0-9.]+'|grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'|tail -1) > /dev/null 2>&1
-echo -e "====================================\nDNS: ${dns[rand]}\nIP: ${IP[rand]}\n====================================" >> $HOME/subresult
-unset IP
-) &
-done
-while true; do
-[[ $(pidof nslookup|wc -w) -lt "1" ]] && break
-done
-msg -bar
-RSLT=$(($(cat $HOME/subresult|wc -l)/4)) && echo -e "\033[1;32m$RSLT $(fun_trans "Hosts Capturados")\033[0m"
-msg -bar
-echo -ne "$(fun_trans "Desea Imprimir Resultados")? [S/N]: "; read yn
-   [[ $yn = @(s|S|y|Y) ]] && {
-   echo -ne "\033[1;32m"
-   cat $HOME/subresult|grep -v =
-   echo -e "$barra\033[0m"
-   }
-return 0
-}
-#INICIA SCRIPT
-msg -bar
-msg -tit
-echo -e "\033[1;33m $(fun_trans "                  SCAN DE SUNDOMINIOS")"
-msg -bar
-iniciar
-[[ $? = "0" ]] &&
-echo -e "\033[1;32m$(fun_trans "Registro generado en el archivo") $HOME/subresult\033[0m" &&
-msg -bar

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä