Script API
Script API
/bin/bash
# Configurações
EMAIL="[email protected]"
NUMERO_CELULAR="+551199999999"
DESTINATARIO_WHATSAPP="+551188888888"
# Teste de SMS
test_sms() {
log "\n Testando envio de SMS..."
termux-sms-send -n "$NUMERO_CELULAR" "Teste de SMS do Termux
API - $(date)"
log " SMS enviado para $NUMERO_CELULAR"
}
# Teste de Câmera
test_camera() {
log "\n Testando câmera..."
termux-camera-photo -c 0 camera_test.jpg
if [ -f camera_test.jpg ]; then
log " Foto tirada com sucesso (camera_test.jpg)"
else
log " Falha ao acessar a câmera"
fi
}
# Teste de GPS
test_gps() {
log "\n Testando GPS..."
gps_data=$(termux-location)
if [ -z "$gps_data" ]; then
log " Falha ao obter localização"
else
log " Dados de GPS:"
echo "$gps_data" | jq '.' >> termux_test.log
echo "$gps_data" | jq '.latitude, .longitude'
fi
}
# Teste de WhatsApp
test_whatsapp() {
log "\n Testando WhatsApp..."
termux-contact-list | grep -i "$DESTINATARIO_WHATSAPP" > /dev/null
if [ $? -eq 0 ]; then
termux-share -a view -t "Teste do Termux API" -c "Mensagem de teste
enviada em $(date)" "$DESTINATARIO_WHATSAPP"
log " Mensagem enviada para WhatsApp"
else
log " Contato não encontrado na lista"
fi
}
# Teste de Email
test_email() {
log "\n Testando envio de email..."
termux-open --send-email "$EMAIL" \
--subject "Teste Termux API" \
--body "Este é um teste automático do Termux API\n\nData:
$(date)\n\nBateria: $(termux-battery-status | jq -r '.percentage')%"
log " Email enviado para $EMAIL"
}
# Teste de Sensores
test_sensors() {
log "\n Testando sensores..."
log "Sensores disponíveis:"
termux-sensor -l >> termux_test.log
# Teste de Microfone
test_microphone() {
log "\n Testando microfone..."
termux-microphone-record -f mic_test.aac -l 3
if [ -f mic_test.aac ]; then
log " Gravação realizada (mic_test.aac)"
else
log " Falha ao acessar microfone"
fi
}
# Teste de Vibração
test_vibration() {
log "\n Testando vibração..."
termux-vibrate -d 1000
log " Vibração ativada por 1 segundo"
}
# Menu principal
main() {
echo "" > termux_test.log
log " Iniciando testes do Termux API - $(date)"
test_sms
test_camera
test_gps
test_whatsapp
test_email
test_sensors
test_microphone
test_vibration
main
#!/bin/bash
# Configurações
EMAIL="[email protected]"
NUMERO_CELULAR="+551199999999"
DESTINATARIO_WHATSAPP="+551188888888"
ARQUIVO_LOG="termux_test_$(date +%Y%m%d_%H%M%S).log"
## Testes de Hardware ##
test_sms() {
test_component "SMS" termux-sms-send -n "$NUMERO_CELULAR"
"Teste de SMS do Termux API - $(date)"
}
test_camera() {
test_component "Câmera" termux-camera-photo -c 0 camera_test.jpg
[ -f camera_test.jpg ] && rm camera_test.jpg
}
test_gps() {
local gps_data=$(termux-location)
test_component "GPS" [ -n "$gps_data" ] && echo "$gps_data" | jq '.'
}
test_microphone() {
test_component "Microfone" termux-microphone-record -f mic_test.aac -l 2
[ -f mic_test.aac ] && rm mic_test.aac
}
test_sensors() {
test_component "Sensores" termux-sensor -l
}
test_vibration() {
test_component "Vibração" termux-vibrate -d 500
}
test_cpu() {
test_component "CPU" grep -i "model name" /proc/cpuinfo | head -n 1
}
test_memory() {
test_component "Memória" free -h
}
test_storage() {
test_component "Armazenamento" df -h
}
test_network() {
test_component "Conexão de rede" ping -c 3 google.com
}
test_packages() {
test_component "Gerenciamento de pacotes" pkg list-installed
}
test_processes() {
test_component "Processos em execução" ps aux
}
test_filesystem() {
test_component "Sistema de arquivos" ls -l /
}
test_kernel() {
test_component "Versão do Kernel" uname -a
}
test_users() {
test_component "Usuários do sistema" whoami
}
test_environment() {
test_component "Variáveis de ambiente" printenv
}
## Testes Avançados ##
test_termux_api() {
test_component "Termux API" termux-battery-status
}
test_python() {
test_component "Python" python3 --version
}
test_git() {
test_component "Git" git --version
}
test_ssh() {
test_component "SSH" ssh -V
}
test_web() {
test_component "Conexão Web" curl -I https://google.com
}
test_ports() {
test_component "Verificação de portas" nmap localhost
}
## Funções de Relatório ##
generate_report() {
log "\n${BLUE}=== RELATÓRIO FINAL ===${NC}"
# Menu principal
main() {
echo -e "${BLUE}=== TESTE COMPLETO DO TERMUX ===${NC}"
echo -e "${YELLOW}Iniciando testes em $(date)${NC}"
echo -e "Log sendo salvo em: ${YELLOW}$ARQUIVO_LOG${NC}"
check_dependencies
# Testes de Hardware
echo -e "\n${BLUE}=== TESTES DE HARDWARE ===${NC}"
test_sms
test_camera
test_gps
test_microphone
test_sensors
test_vibration
# Testes de Sistema Operacional
echo -e "\n${BLUE}=== TESTES DO SISTEMA OPERACIONAL ===${NC}"
test_cpu
test_memory
test_storage
test_network
test_packages
test_processes
test_filesystem
test_kernel
test_users
test_environment
# Testes Avançados
echo -e "\n${BLUE}=== TESTES AVANÇADOS ===${NC}"
test_termux_api
test_python
test_git
test_ssh
test_web
test_ports
generate_report
}
main
#!/bin/bash
# Configurações de segurança
LOG_FILE="security_scan_$(date +%Y%m%d_%H%M%S).log"
QUARANTINE_DIR="$HOME/security_quarantine"
WHITELIST=("trusted_app1" "trusted_app2") # Adicione seus apps confiáveis
# Função de log
log() {
echo -e "[$(date '+%H:%M:%S')] $1" | tee -a "$LOG_FILE"
}
# Verificar dependências
check_dependencies() {
local deps=("termux-api" "jq" "curl" "git" "python" "rkhunter" "clamav"
"fdupes" "exiftool")
local missing=()
# Anti-malware scan
scan_malware() {
log "${BLUE}Iniciando varredura de malware...${NC}"
if [ -s duplicates.list ]; then
log "${YELLOW}Arquivos duplicados encontrados:${NC}"
cat duplicates.list | tee -a "$LOG_FILE"
# Mover para quarentena
while read -r file; do
if [ -f "$file" ]; then
mv "$file" "$QUARANTINE_DIR/"
log "Movido para quarentena: $file"
fi
done < duplicates.list
else
log "${GREEN}Nenhum arquivo duplicado encontrado.${NC}"
fi
}
if [ -s duplicate_contacts.json ]; then
log "${YELLOW}Contatos duplicados encontrados:${NC}"
jq -r '.[0].name' duplicate_contacts.json | tee -a "$LOG_FILE"
if [ -s duplicate_sms.json ]; then
log "${YELLOW}Mensagens duplicadas encontradas:${NC}"
jq -r '.[0].body' duplicate_sms.json | head -n 5 | tee -a "$LOG_FILE"
else
log "${GREEN}Nenhuma mensagem duplicada encontrada.${NC}"
fi
}
if [ -s duplicate_photos.list ]; then
log "${YELLOW}Fotos duplicadas encontradas:${NC}"
head -n 5 duplicate_photos.list | tee -a "$LOG_FILE"
# Sistema anti-hacking
anti_hacking() {
log "${BLUE}Iniciando verificações de segurança...${NC}"
# Limpeza de segurança
cleanup() {
log "${BLUE}Realizando limpeza de segurança...${NC}"
# Limpar cache
log "Limpando cache..."
rm -rf ~/.cache/*
# Limpar histórico
log "Limpando histórico..."
history -c
rm ~/.bash_history
# Menu principal
main_menu() {
clear
echo -e "${BLUE}=== TERMUX SECURITY SUITE ==="
echo -e "1. Varredura completa de malware"
echo -e "2. Verificar arquivos duplicados"
echo -e "3. Verificar contatos duplicados"
echo -e "4. Verificar mensagens duplicadas"
echo -e "5. Verificar fotos duplicadas"
echo -e "6. Sistema anti-hacking"
echo -e "7. Limpeza de segurança"
echo -e "8. Executar todas as verificações"
echo -e "0. Sair${NC}"
case $choice in
1) scan_malware ;;
2) find_duplicates ;;
3) check_duplicate_contacts ;;
4) check_duplicate_sms ;;
5) check_duplicate_photos ;;
6) anti_hacking ;;
7) cleanup ;;
8)
scan_malware
find_duplicates
check_duplicate_contacts
check_duplicate_sms
check_duplicate_photos
anti_hacking
cleanup
;;
0) exit 0 ;;
*) echo -e "${RED}Opção inválida${NC}" ;;
esac
# Inicialização
check_dependencies
main_menu
#!/bin/bash
# Configurações
EMAIL="[email protected]"
NUMERO_CELULAR="+551199999999"
DESTINATARIO_WHATSAPP="+551188888888"
ARQUIVO_LOG="termux_test_$(date +%Y%m%d_%H%M%S).log"
QUARANTINE_DIR="$HOME/security_quarantine"
WHITELIST=("termux" "com.termux" "com.android.shell") # Apps confiáveis
# Verificar dependências
check_dependencies() {
local missing=()
local dependencies=("termux-api" "jq" "curl" "nmap" "git" "python" "rkhunter"
"clamav" "fdupes" "exiftool")
## Testes de Hardware ##
test_sms() {
test_component "SMS" termux-sms-send -n "$NUMERO_CELULAR"
"Teste de SMS do Termux API - $(date)"
}
test_camera() {
test_component "Câmera" termux-camera-photo -c 0 camera_test.jpg
[ -f camera_test.jpg ] && rm camera_test.jpg
}
test_gps() {
local gps_data=$(termux-location)
test_component "GPS" [ -n "$gps_data" ] && echo "$gps_data" | jq '.'
}
test_microphone() {
test_component "Microfone" termux-microphone-record -f mic_test.aac -l 2
[ -f mic_test.aac ] && rm mic_test.aac
}
test_sensors() {
test_component "Sensores" termux-sensor -l
}
test_vibration() {
test_component "Vibração" termux-vibrate -d 500
}
test_cpu() {
test_component "CPU" grep -i "model name" /proc/cpuinfo | head -n 1
}
test_memory() {
test_component "Memória" free -h
}
test_storage() {
test_component "Armazenamento" df -h
}
test_network() {
test_component "Conexão de rede" ping -c 3 google.com
}
test_packages() {
test_component "Gerenciamento de pacotes" pkg list-installed
}
test_processes() {
test_component "Processos em execução" ps aux
}
test_filesystem() {
test_component "Sistema de arquivos" ls -l /
}
test_kernel() {
test_component "Versão do Kernel" uname -a
}
test_users() {
test_component "Usuários do sistema" whoami
}
test_environment() {
test_component "Variáveis de ambiente" printenv
}
## Testes Avançados ##
test_termux_api() {
test_component "Termux API" termux-battery-status
}
test_python() {
test_component "Python" python3 --version
}
test_git() {
test_component "Git" git --version
}
test_ssh() {
test_component "SSH" ssh -V
}
test_web() {
test_component "Conexão Web" curl -I https://google.com
}
test_ports() {
test_component "Verificação de portas" nmap localhost
}
test_malware() {
log "${BLUE}Iniciando varredura de malware...${NC}"
# Verificar rootkits
test_component "Rootkits" rkhunter --check --sk --quiet
# Verificar vírus
test_component "Vírus" clamscan -r --bell -i "$HOME"
test_duplicates() {
log "${BLUE}Procurando arquivos duplicados...${NC}"
# Arquivos duplicados
test_component "Arquivos duplicados" fdupes -r "$HOME" > duplicates.list
[ -s duplicates.list ] && log "${YELLOW}Arquivos duplicados encontrados.
Verifique duplicates.list${NC}"
# Contatos duplicados
log "Verificando contatos duplicados..."
termux-contact-list | jq 'group_by(.name) | map(select(length > 1)) | .[]' >
duplicate_contacts.json
[ -s duplicate_contacts.json ] && log "${YELLOW}Contatos duplicados
encontrados. Verifique duplicate_contacts.json${NC}"
# Fotos duplicadas
log "Verificando fotos duplicadas..."
find ~/storage/dcim -type f -iname "*.jpg" -o -iname "*.png" | while read file;
do
exiftool -q -q -ImageSize -FileSize "$file"
done | sort | uniq -d > duplicate_photos.list
[ -s duplicate_photos.list ] && log "${YELLOW}Fotos duplicadas
encontradas. Verifique duplicate_photos.list${NC}"
}
test_antihacking() {
log "${BLUE}Executando verificações anti-hacking...${NC}"
clean_security() {
log "${BLUE}Realizando limpeza de segurança...${NC}"
# Limpar cache
test_component "Limpeza de cache" rm -rf ~/.cache/*
# Limpar histórico
test_component "Limpeza de histórico" history -c && rm ~/.bash_history
## Funções de Relatório ##
generate_report() {
log "\n${BLUE}=== RELATÓRIO FINAL ===${NC}"
# Resumo de segurança
log "\n${YELLOW}=== ALERTAS DE SEGURANÇA ===${NC}"
grep -E 'malware|suspeitos|não autorizados|Rootkits|Vírus'
$ARQUIVO_LOG
# Menu principal
main() {
echo -e "${BLUE}=== TESTE COMPLETO DO TERMUX ===${NC}"
echo -e "${YELLOW}Iniciando testes em $(date)${NC}"
echo -e "Log sendo salvo em: ${YELLOW}$ARQUIVO_LOG${NC}"
check_dependencies
# Testes de Hardware
echo -e "\n${BLUE}=== TESTES DE HARDWARE ===${NC}"
test_sms
test_camera
test_gps
test_microphone
test_sensors
test_vibration
# Testes Avançados
echo -e "\n${BLUE}=== TESTES AVANÇADOS ===${NC}"
test_termux_api
test_python
test_git
test_ssh
test_web
test_ports
# Testes de Segurança
echo -e "\n${RED}=== TESTES DE SEGURANÇA ===${NC}"
test_malware
test_duplicates
test_antihacking
clean_security
generate_report
}
main
#!/bin/bash
# Configurações
ARQUIVO_LOG="termux_full_test_$(date +%Y%m%d_%H%M%S).log"
QUARANTINE_DIR="$HOME/security_quarantine"
TEST_SERVER="google.com"
SPEEDTEST_SERVER="--server-id=2927" # Servidor recomendado (mude
conforme sua região)
# Teste de DNS
test_component "Resolução DNS" dig "$TEST_SERVER" +short
# Limpeza de RAM
log "${CYAN}Limpando memória RAM...${NC}"
sync && echo 3 > /proc/sys/vm/drop_caches
log "${GREEN}Memória RAM limpa${NC}"
# Memória interna
log "${CYAN}Varredura de memória interna...${NC}"
df -h /data /system /storage | tee -a "$ARQUIVO_LOG"
# Arquivos grandes
log "${CYAN}Buscando arquivos grandes (>100MB)...${NC}"
find /storage /data -type f -size +100M -exec du -h {} + 2>/dev/null | sort -rh |
head -n 20 | tee -a "$ARQUIVO_LOG"
}
# CPU
test_component "Informações da CPU" lscpu || grep -i "model name"
/proc/cpuinfo
# Bateria
test_component "Status da bateria" termux-battery-status
# Sensores
test_component "Sensores disponíveis" termux-sensor -l
# GPS
test_component "Localização GPS" termux-location
# Câmera
test_component "Câmera" termux-camera-photo -c 0 camera_test.jpg &&
rm camera_test.jpg
# Microfone
test_component "Microfone" termux-microphone-record -f mic_test.aac -l 2
&& rm mic_test.aac
# Vibração
test_component "Vibração" termux-vibrate -d 500
}
# Kernel
test_component "Versão do Kernel" uname -a
# Uptime
test_component "Tempo de atividade" uptime
# Processos
log "${CYAN}Processos em execução:${NC}"
ps aux | head -n 15 | tee -a "$ARQUIVO_LOG"
# Pacotes instalados
log "${CYAN}Pacotes instalados:${NC}"
pkg list-installed | wc -l | tee -a "$ARQUIVO_LOG"
}
# Rootkits
test_component "Verificação de rootkits" rkhunter --check --sk --quiet
# Vírus
test_component "Varredura de vírus" clamscan -r --bell -i "$HOME"
# Arquivos suspeitos
log "${CYAN}Buscando arquivos suspeitos...${NC}"
find /data /storage -type f \( -name "*.exe" -o -name "*.bat" -o -name "*.sh" \)
-exec ls -la {} + 2>/dev/null | tee -a "$ARQUIVO_LOG"
}
### LIMPEZA DO SISTEMA ###
clean_system() {
log "${PURPLE}=== LIMPEZA DO SISTEMA ===${NC}"
# Cache
test_component "Limpeza de cache" rm -rf ~/.cache/*
# Temporários
test_component "Limpeza de arquivos temporários" find /data /storage -
name "*.tmp" -delete 2>/dev/null
# Thumbnails
test_component "Limpeza de thumbnails" find /storage -type f -name
".thumbnails" -exec rm -rf {} +
# RAM
test_component "Otimização de memória RAM" sync && echo 3 >
/proc/sys/vm/drop_caches
# Pacotes obsoletos
test_component "Limpeza de pacotes" pkg autoclean
# Resumo estatístico
local total_tests=$(grep -c "Testando" "$ARQUIVO_LOG")
local success_tests=$(grep -c "" "$ARQUIVO_LOG")
local failed_tests=$(grep -c "" "$ARQUIVO_LOG")
# Alertas importantes
if [ "$failed_tests" -gt 0 ]; then
log "\n${RED}=== TESTES COM FALHA ===${NC}"
grep -B 1 "" "$ARQUIVO_LOG"
fi
# Problemas de segurança
log "\n${YELLOW}=== ALERTAS DE SEGURANÇA ===${NC}"
grep -iE "warning|error|suspeito|vírus|rootkit" "$ARQUIVO_LOG" | tail -n 10
# Desempenho
log "\n${CYAN}=== DESEMPENHO ===${NC}"
grep -E "speed|download|upload|latency|memory|cpu" "$ARQUIVO_LOG" |
tail -n 15
case $choice in
1) run_full_tests ;;
2) test_network ;;
3) test_memory ;;
4) test_hardware ;;
5) test_security ;;
6) clean_system ;;
7) run_full_tests; clean_system ;;
0) exit 0 ;;
*) echo -e "${RED}Opção inválida${NC}"; sleep 1; main_menu ;;
esac
}
run_full_tests() {
check_dependencies
test_network
test_memory
test_hardware
test_system
test_security
generate_report
}
main_menu
#!/bin/bash
# Configurações
ARQUIVO_LOG="termux_full_test_$(date +%Y%m%d_%H%M%S).log"
QUARANTINE_DIR="$HOME/security_quarantine"
TEST_SERVER="google.com"
SPEEDTEST_SERVER="--server-id=2927" # Servidor recomendado (mude
conforme sua região)
test_bluetooth() {
log "${BLUE}Testando Bluetooth...${NC}"
if termux-bluetooth-status | grep -q "enabled"; then
log "${GREEN}Bluetooth está ativado${NC}"
termux-bluetooth-devices | tee -a "$ARQUIVO_LOG"
else
log "${YELLOW}Bluetooth está desativado${NC}"
fi
}
test_flashlight() {
log "${BLUE}Testando lanterna...${NC}"
termux-torch on && sleep 2 && termux-torch off
log "${GREEN}Teste de lanterna concluído${NC}"
}
test_airplane_mode() {
log "${BLUE}Verificando modo avião...${NC}"
termux-airplane-mode | tee -a "$ARQUIVO_LOG"
}
test_battery_saver() {
log "${BLUE}Verificando modo economia de bateria...${NC}"
termux-battery-status | jq '.power_saver' | tee -a "$ARQUIVO_LOG"
}
## TESTES DE TELA ##
test_screen() {
log "${PURPLE}=== TESTES DE TELA ==="
# Teste de brilho
log "${CYAN}Testando ajuste de brilho...${NC}"
for brightness in 50 100 150 200 255; do
termux-brightness $brightness
sleep 1
done
termux-brightness auto
# Câmera traseira
test_component "Câmera traseira" termux-camera-photo -c 0
rear_camera.jpg
[ -f rear_camera.jpg ] && {
log "${GREEN}Foto da câmera traseira salva em rear_camera.jpg${NC}"
exiftool rear_camera.jpg | grep -E 'Camera|Resolution' | tee -a
"$ARQUIVO_LOG"
rm rear_camera.jpg
}
# Teste de flash
log "${CYAN}Testando flash...${NC}"
termux-torch on && sleep 2 && termux-torch off
}
# Alto-falante
log "${CYAN}Testando alto-falante...${NC}"
termux-tts-speak "Teste do alto-falante" --engine "speech"
# Microfone
test_component "Microfone" termux-microphone-record -f audio_test.aac -l
3
[ -f audio_test.aac ] && {
log "${GREEN}Gravação de áudio salva em audio_test.aac${NC}"
rm audio_test.aac
}
## TESTES DE BOTÕES ##
test_buttons() {
log "${PURPLE}=== TESTES DE BOTÕES ==="
# Wi-Fi
test_component "Conexão Wi-Fi" termux-wifi-connectioninfo
# GPS
test_component "GPS" termux-location
# Dados móveis
log "${CYAN}Verificando dados móveis...${NC}"
termux-telephony-cellinfo | tee -a "$ARQUIVO_LOG"
}
# Status completo
test_component "Status da bateria" termux-battery-status
# Carregamento
log "${CYAN}Verificando status de carregamento...${NC}"
termux-battery-status | jq '.plugged' | tee -a "$ARQUIVO_LOG"
# Saúde da bateria
log "${CYAN}Verificando saúde da bateria...${NC}"
termux-battery-status | jq '.health' | tee -a "$ARQUIVO_LOG"
}
## INFORMAÇÕES DO HARDWARE ##
get_hardware_info() {
log "${PURPLE}=== INFORMAÇÕES DE HARDWARE ==="
# Placa-mãe/SoC
log "${CYAN}Informações da plataforma:${NC}"
getprop ro.product.board | tee -a "$ARQUIVO_LOG"
getprop ro.board.platform | tee -a "$ARQUIVO_LOG"
# CPU
log "${CYAN}Informações da CPU:${NC}"
cat /proc/cpuinfo | grep -E 'model name|Hardware|Processor' | tee -a
"$ARQUIVO_LOG"
# Memória
log "${CYAN}Informações de memória:${NC}"
free -h | tee -a "$ARQUIVO_LOG"
cat /proc/meminfo | grep -E 'MemTotal|MemFree' | tee -a
"$ARQUIVO_LOG"
# Armazenamento
log "${CYAN}Informações de armazenamento:${NC}"
df -h | tee -a "$ARQUIVO_LOG"
# GPU
log "${CYAN}Informações da GPU:${NC}"
getprop ro.opengles.version | tee -a "$ARQUIVO_LOG"
dumpsys SurfaceFlinger | grep -i "GLES" | tee -a "$ARQUIVO_LOG"
}
case $choice in
1) run_system_tests ;;
2) run_hardware_tests ;;
3) test_screen ;;
4) test_camera_advanced ;;
5) test_audio_full ;;
6) test_connectivity_full ;;
7) test_sensors_full ;;
8) test_battery_full ;;
9) get_hardware_info ;;
10) run_all_tests ;;
0) exit 0 ;;
*) echo -e "${RED}Opção inválida${NC}"; sleep 1; main_menu ;;
esac
run_system_tests() {
log "${BLUE}=== TESTES DO SISTEMA ==="
test_component "CPU" grep -i "model name" /proc/cpuinfo
test_component "Memória" free -h
test_component "Armazenamento" df -h
test_component "Kernel" uname -a
test_component "Processos" ps aux
}
run_hardware_tests() {
log "${BLUE}=== TESTES DE HARDWARE ==="
test_vibration
test_bluetooth
test_flashlight
test_airplane_mode
test_battery_saver
test_buttons
}
run_all_tests() {
run_system_tests
run_hardware_tests
test_screen
test_camera_advanced
test_audio_full
test_connectivity_full
test_sensors_full
test_battery_full
get_hardware_info
}
main_menu
#!/bin/bash
# Configurações
ARQUIVO_LOG="termux_ultimate_test_$(date +%Y%m%d_%H%M%S).log"
QUARANTINE_DIR="$HOME/security_quarantine"
TEST_SERVER="google.com"
SPEEDTEST_SERVER="--server-id=2927"
WHITELIST=("termux" "com.termux" "com.android.shell")
# Informações básicas
test_component "CPU" lscpu || grep -i "model name" /proc/cpuinfo
test_component "Memória" free -h
test_component "Armazenamento" df -h
# Bateria
log "${CYAN}=== TESTE DE BATERIA ===${NC}"
termux-battery-status | tee -a "$ARQUIVO_LOG"
# Vibração
log "${CYAN}Testando vibração...${NC}"
for i in {100..500..100}; do
termux-vibrate -d $i
sleep 1
done
# Bluetooth
log "${CYAN}Testando Bluetooth...${NC}"
termux-bluetooth-status | tee -a "$ARQUIVO_LOG"
termux-bluetooth-devices | tee -a "$ARQUIVO_LOG"
# Lanterna
log "${CYAN}Testando lanterna...${NC}"
termux-torch on && sleep 2 && termux-torch off
# Modo Avião
log "${CYAN}Verificando modo avião...${NC}"
termux-airplane-mode | tee -a "$ARQUIVO_LOG"
# Brilho
log "${CYAN}Testando ajuste de brilho...${NC}"
for brightness in 50 100 150 200 255; do
termux-brightness $brightness
sleep 1
done
termux-brightness auto
# Cores
log "${CYAN}Testando cores da tela...${NC}"
for color in "red" "green" "blue" "white" "black"; do
termux-toast -b $color -c white -g top "Teste de cor: $color"
sleep 1
done
# Toque (instruções)
log "${YELLOW}Para testar touch screen:"
log "1. Execute um aplicativo de desenho"
log "2. Verifique a resposta em toda a área da tela${NC}"
# Câmera traseira
test_component "Câmera traseira" termux-camera-photo -c 0
rear_camera.jpg
[ -f rear_camera.jpg ] && {
log "${GREEN}Foto da câmera traseira salva em rear_camera.jpg${NC}"
exiftool rear_camera.jpg | grep -E 'Camera|Resolution' | tee -a
"$ARQUIVO_LOG"
rm rear_camera.jpg
}
# Câmera frontal
test_component "Câmera frontal" termux-camera-photo -c 1
front_camera.jpg
[ -f front_camera.jpg ] && {
log "${GREEN}Foto da câmera frontal salva em front_camera.jpg${NC}"
exiftool front_camera.jpg | grep -E 'Camera|Resolution' | tee -a
"$ARQUIVO_LOG"
rm front_camera.jpg
}
# Flash
log "${CYAN}Testando flash...${NC}"
termux-torch on && sleep 2 && termux-torch off
}
# Alto-falante
log "${CYAN}Testando alto-falante...${NC}"
termux-tts-speak "Teste do alto-falante do dispositivo" -r 1.2
# Microfone
test_component "Microfone" termux-microphone-record -f audio_test.aac -l
3
[ -f audio_test.aac ] && {
log "${GREEN}Gravação de áudio salva em audio_test.aac${NC}"
rm audio_test.aac
}
# Ping
test_component "Ping básico" ping -c 4 "$TEST_SERVER"
log "${CYAN}Teste de ping avançado...${NC}"
ping -c 10 "$TEST_SERVER" | tee -a "$ARQUIVO_LOG" | grep -E
'rtt|packet loss'
# Velocidade
log "${CYAN}Testando velocidade da rede...${NC}"
speedtest-cli "$SPEEDTEST_SERVER" --simple | tee -a
"$ARQUIVO_LOG"
# Portas
test_component "Varredura de portas" nmap -Pn -T4 localhost
# DNS
test_component "Resolução DNS" dig "$TEST_SERVER" +short
# Wi-Fi
test_component "Conexão Wi-Fi" termux-wifi-connectioninfo
# GPS
test_component "GPS" termux-location
# Dados móveis
log "${CYAN}Verificando dados móveis...${NC}"
termux-telephony-cellinfo | tee -a "$ARQUIVO_LOG"
}
# Rootkits
test_component "Verificação de rootkits" rkhunter --check --sk --quiet
# Vírus
test_component "Varredura de vírus" clamscan -r --bell -i "$HOME"
# Arquivos suspeitos
log "${CYAN}Buscando arquivos suspeitos...${NC}"
find /data /storage -type f \( -name "*.exe" -o -name "*.bat" -o -name "*.sh" \)
-exec ls -la {} + 2>/dev/null | tee -a "$ARQUIVO_LOG"
# Conexões suspeitas
log "${CYAN}Verificando conexões de rede...${NC}"
netstat -tuln | grep -E '(6667|2339|4444|5555|6666|1337|31337)' | tee -a
"$ARQUIVO_LOG"
}
# Cache
test_component "Limpeza de cache" rm -rf ~/.cache/*
# Temporários
test_component "Limpeza de temporários" find /data /storage -name "*.tmp"
-delete 2>/dev/null
# RAM
test_component "Otimização de memória RAM" sync && echo 3 >
/proc/sys/vm/drop_caches
# Pacotes
test_component "Limpeza de pacotes" pkg autoclean
# Hardware
log "${CYAN}=== HARDWARE ==="
log "Placa-mãe/SoC: $(getprop ro.product.board)"
log "Plataforma: $(getprop ro.board.platform)"
log "GPU: $(getprop ro.opengles.version)"
dumpsys SurfaceFlinger | grep -i "GLES" | tee -a "$ARQUIVO_LOG"
# Memória
log "${CYAN}=== MEMÓRIA ==="
free -h | tee -a "$ARQUIVO_LOG"
cat /proc/meminfo | grep -E 'MemTotal|MemFree' | tee -a
"$ARQUIVO_LOG"
# Armazenamento
log "${CYAN}=== ARMAZENAMENTO ==="
df -h | tee -a "$ARQUIVO_LOG"
log "Maiores arquivos:"
find /storage /data -type f -size +100M -exec du -h {} + 2>/dev/null | sort -rh |
head -n 10 | tee -a "$ARQUIVO_LOG"
# Sistema
log "${CYAN}=== SISTEMA ==="
log "Kernel: $(uname -a)"
log "Uptime: $(uptime)"
log "Processos ativos: $(ps aux | wc -l)"
}
case $choice in
1) run_system_tests ;;
2) test_hardware_full ;;
3) test_screen ;;
4) test_camera ;;
5) test_audio ;;
6) test_network ;;
7) test_security ;;
8) get_system_info ;;
9) clean_system ;;
10) run_all_tests ;;
0) exit 0 ;;
*) echo -e "${RED}Opção inválida${NC}"; sleep 1; main_menu ;;
esac
run_system_tests() {
test_hardware_full
test_screen
test_camera
test_audio
test_network
generate_report
}
run_all_tests() {
check_dependencies
run_system_tests
test_security
get_system_info
clean_system
generate_report
}
main_menu