Skip to content

Instantly share code, notes, and snippets.

@augcesar
Last active April 27, 2016 14:25
Show Gist options
  • Save augcesar/f49a44f19523e0d72ccb to your computer and use it in GitHub Desktop.
Save augcesar/f49a44f19523e0d72ccb to your computer and use it in GitHub Desktop.
#Quantidade de conexões do dia no postfix
cat /var/log/mail.log | grep disconnect | grep "Nov 10" | wc -l
# Lista de IPs conectados na máquina
netstat -tn 2>/dev/null | grep : | awk '{print $5}' | sort | uniq -c | sort -nr | head
# conexões abertas em tcp:80
lsof -i TCP:80
#RESTORE PG
psql -f /home/augusto/sistema.prod.dump -h 127.0.0.1 -U user sistema
#Links
http://www.mkyong.com/linux/how-to-block-attackers-ip-with-null-route-command/
http://www.mkyong.com/linux/how-to-encrypt-text-file-in-linux-vim/
http://www.mkyong.com/linux/how-to-limit-the-application-cpu-usage-in-linux-cpulimit/
#https://coderwall.com/p/plejka/forward-port-80-to-port-3000
sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 3000
cat /var/log/mail.log | grep 'Feb 20' | grep ' connect from unknown' | grep : | awk '{print $8}' | uniq -c | sort -nr | head
lsof -i TCP | grep nginx | grep ESTABLISHED
cat /var/log/mail.log | grep 'Apr 27' | grep 'Recipient address rejected: Access denied' | awk '{print $19}' | sort | uniq -c | sort -nr | head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment