I noticed that every single WordPress bruteforce attempt on the server came from a Cloudflare IP. So I had to write this:
#!/usr/bin/perl # Program to download cloudflare ip ranges and block them use strict; use warnings; use LWP::Simple; my $url='https://www.cloudflare.com/ips-v4'; my $file = '/tmp/cloudflareip.txt'; getstore($url, $file); open my $info, $file or die "Could not open $file: $!"; while( my $line = <$info>) { chomp $line; my $cmd='iptables -A INPUT -s '.$line.' -j DROP'; print $cmd."\n"; `$cmd`; } close $info; print "Listing current iptables rules:\n"; my $cmd='iptables -L -n'; `$cmd`;
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.