I look after a website that is currently being flooded with HTTP requests from different IP addresses but all using the same user agent string
I've grepped the log file and now have a file with all of the 2696 unique IP addresses per line. It looks every 20 or so IPs belong to the same IP range i.e the first, second and sometimes third octet are the same
Is there a way I can group these IPs together so I can see a list of each IP range? Either some sort of command line wizardry or a tool I can just drop the IPs in and get the IP ranges as output?
Edit:
For example, 24 of the IP addresses start with 104.140
and there are three different third octets. 8 IPs start with 104.140.183
, another 8 start with 104.140.211
and the final 8 start with 104.140.4
My firewall manager lets me block IP ranges with network prefix length and allows me to choose from /24
to /32
I don't know enough about subnetting to know what the output should be, but I'd like to A) see how many different ranges there are and B) ideally have the output in a format I can use to block the ranges at the firewall