1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Script to count IPs in the server and add high number automatically block in the CSF...

Discussão em 'Python' iniciado por Stack, Outubro 8, 2024.

  1. Stack

    Stack Membro Participativo

    I'm using this command line to list the IPs in the server

    netstat -ntu|awk '{print $5}'|cut -d: -f1 -s|sort|uniq -c|sort -nk1 -r

    I'm always getting results like this:

    36 142.251.9.26
    31 64.233.184.27
    26 142.250.153.27
    23 142.250.27.26
    22 142.250.27.27
    19 142.250.153.26
    15 64.233.184.26
    13 142.251.0.27
    11 195.3.223.154


    Then I'm blocking the IPs manually with high numbers.

    I have already blocked the bots in the robots, htaccess, apache configuration and mod_security, but it is not helping the bots are overloading the server

    Is there any bash, shell or python script that can help me block the high number of IPs and add to the CSF, please?

    I appreciate any help or suggestion

    Thank you.

    Continue reading...

Compartilhe esta Página