perl <<'EOF'
chomp($hostname = `hostname`);
chomp($ourip = `hostname -i`);
$iptocheck = "ip_placeholder";
chomp($iptocheck);
open(my $DAT, '<', "/etc/reservedipreasons");
        @reasons = <$DAT>;
close($DAT);
if ($iptocheck =~ /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/) {
        chomp(@localips = `ifconfig`);
        chomp(@iptables = `iptables -L -n`);
        chomp(@route = `route -n`);
        chomp(@iproute = `ip route`);
        chomp(@messages = `grep 'SRC=$iptocheck' /var/log/messages`);
        if ( -d "/var/lib/mysql/cphulkd" ) {
                @cphulk = `mysql -o cphulkd -e "select IP from brutes; select IP from logins;"`;
        }
        print "\n";

        if (grep(/$iptocheck/, @localips)) {
                print "[!] This IP is a local IP on this server.\n";
                exit();
        }

        if (grep(/$iptocheck/,@iptables)) {
                print "[!] IP found in iptables! An Admin will need to investigate. Please create a ticket for the customer.\n";
        } elsif (grep(/$iptocheck/,@route)) {
                print "[!] IP found in route! An Admin will need to investigate. Please create a ticket for the customer.\n";
        } elsif (grep(/$iptocheck/,@iproute)) {
                print "[!] IP found in ip route! An Admin will need to investigate. Please create a ticket for the customer.\n";
        } elsif (grep(/$iptocheck/,@cphulk)) {
                print "[!] IP Found in cphulkd! An Admin will need to investigate. Please create a ticket for the customer.\n";
        } elsif (@messages) {
                print "[!] IP Found to be ratelimited by the firewall " . scalar @messages . " times! An Admin will need to investigate. Please create a ticket for the customer.\n";
        } else {
                print "[*] IP not found blocked in iptables/route/ip route/cphulkd/ratelimiting\n";
        }
}
EOF
