Sincronizando seu hosts.deny com blacklist online
Publicado por Fernando (última atualização em 25/11/2013)
[ Hits: 5.541 ]
Homepage: https://github.com/phoemur/
Download synchosts.py (versão 2)
Este script atualiza o seu /etc/hosts e /etc/hosts.deny baseado na blacklist localizada em: http://someonewhocares.org/hosts/
Desta forma você irá bloquear diversos sites maliciosos, inclusive aqueles da oix.net.
#!/bin/sh # # This script was made to update your /etc/hosts and /etc/hosts.deny with a blacklist located in http://someonewhocares.org/hosts/ # Written by phoemur - apr/2013 ############# # Variables # ############# TMP_DIR=/tmp ROOT_UID=0 #Only users with $UID 0 have root privileges. E_NOTROOT=87 #Non-root exit error. E_INVALID=88 #Invalid file exit E_ARGUMENTS=89 # Invalid arguments exit WGET=`which wget` SED=`which sed` HOSTS_URL=http://someonewhocares.org/hosts/hosts #File already in txt format # If possible, log events in /var/log/messages: if [ -f /var/run/syslogd.pid -a -x `which logger` ]; then LOGGER=`which logger` else # output to stdout/stderr: LOGGER=/bin/cat fi ###################### # To be or not to be # ###################### if [ "$UID" -ne "$ROOT_UID" ]; then echo "Must be root to run this script." exit $E_NOTROOT fi ############# # Functions # ############# get_hosts() { if [ -f "$TMP_DIR/hosts" ]; then mv $TMP_DIR/hosts $TMP_DIR/hosts.oldtmp fi $WGET -c $HOSTS_URL -O $TMP_DIR/hosts } update_etc() { diff -q $TMP_DIR/hosts /etc/hosts if [ "$?" -eq 0 ]; then echo "It is not necessary to update your hosts file" | $LOGGER echo "Your hosts are already up-to-date!!!" else grep -q ^127.0.0.1 $TMP_DIR/hosts > /dev/null # Validating the downloaded file if [ ! $? ]; then echo "The hosts file downloaded is invalid" exit $E_INVALID else # Upgrading cp /etc/hosts /etc/hosts.old cp $TMP_DIR/hosts /etc/hosts cp /etc/hosts.deny /etc/hosts.deny.old $SED 's/^127\.0\.0\.1/ALL:/g;/localhost/d' $TMP_DIR/hosts > /etc/hosts.deny echo "There is new version of hosts avaiable which was already upgraded" | $LOGGER $SED -n '/Last.updated/{s/^#.*updated: \(.*$\)/\1/p}' $TMP_DIR/hosts | $LOGGER echo "Hosts Upgraded Successfully!!!" fi fi } usage() { cat << EOF This script updates your /etc/hosts and your /etc/hosts.deny based in the blacklist located here: http://someonewhocares.org/hosts/hosts Options: --upgrade (Updates your hosts) --update (Only downloads the new file for inspection. Location: /tmp/hosts) --help (Displays this help) EOF } ############ ### MAIN ### ############ case "$1" in '--upgrade') get_hosts update_etc exit 0 ;; 'upgrade') get_hosts update_etc exit 0 ;; '--update') get_hosts echo "Your hosts file is located at /tmp for inspection" exit 0 ;; 'update') get_hosts echo "Your hosts file is located at /tmp for inspection" exit 0 ;; '--help') usage exit 0 ;; 'help') usage exit 0 ;; *) usage exit $E_ARGUMENTS esac # End of script
Front para o slackpkg em dialog
Seletor de wallpaper para fluxbox modo grafico
Script - muda conteúdo de arquivos texto de iso-8859-1 para utf8 recursivamente
Automatizar scan e atualização com o ClamAV
Nenhum comentário foi encontrado.
Compartilhando a tela do Computador no Celular via Deskreen
Como Configurar um Túnel SSH Reverso para Acessar Sua Máquina Local a Partir de uma Máquina Remota
Configuração para desligamento automatizado de Computadores em um Ambiente Comercial
Efeito "livro" em arquivos PDF
Como resolver o erro no CUPS: Unable to get list of printer drivers
Flatpak: remover runtimes não usados e pacotes
Mudar o gerenciador de login (GDM para SDDM e vice-versa) - parte 2
Wifi não funciona no Aspire ES 15 com o Debian (8)
Como atualizar o Debian 8 para o 10 (10)
Dica sobre iptables ACCEPT e DROP (6)
NGNIX - Aplicar SNAT para evitar roteamento assimetrico (29)
[Python] Automação de scan de vulnerabilidades
[Python] Script para analise de superficie de ataque
[Shell Script] Novo script para redimensionar, rotacionar, converter e espelhar arquivos de imagem
[Shell Script] Iniciador de DOOM (DSDA-DOOM, Doom Retro ou Woof!)
[Shell Script] Script para adicionar bordas às imagens de uma pasta