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;" 2>/dev/null`;
        }
        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! Please escalate the issue to the 'L3 Support' call/chat queue if a live interaction.\n";
        } elsif (grep(/$iptocheck/,@route)) {
                print "[!] IP found in route! Please escalate the issue to the 'L3 Support' call/chat queue if a live interaction.\n";
        } elsif (grep(/$iptocheck/,@iproute)) {
                print "[!] IP found in ip route! Please escalate the issue to the 'L3 Support' call/chat queue if a live interaction.\n";
        } elsif (grep(/$iptocheck/,@cphulk)) {
                print "[!] IP Found in cphulkd! Please escalate the issue to the 'L3 Support' call/chat queue if a live interaction.\n";
        } elsif (@messages) {
                print "[!] IP Found to be ratelimited by the firewall " . scalar @messages . " times! Please escalate the issue to the 'L3 Support' call/chat queue if a live interaction.\n";
        } else {
                print "[*] IP not found blocked in iptables/route/ip route/cphulkd/ratelimiting\n";
        }
}
EOF
