perl <<'EOF'
chomp($hostname = `hostname`);
chomp($ourip = `hostname -i`);
chomp($iptocheck = "ip_placeholder");
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}/) {
        $sanitized = 1;
}
if ($sanitized) {
        if ( -e "/etc/hgseo") {
                print "[!] This is an SEO server. Cannot collect information\n";
                exit;
        }
        @onthisbox = `ifconfig | grep "inet addr" | grep -v 127.0.0.1 | awk '{print \$2}' | cut -d: -f2`;
        foreach (@onthisbox) {
                chomp;
                if ($_ =~ /$iptocheck/) {
                        $onserver = 1;
                        if ($ourip eq $iptocheck) {
                                print "\n[*] Matched primary shared!\n";
                                $shared = 1;
                        }
                        foreach(@reasons) {
                                ($sharedip,undef) = split('=',$_);
                                if ( ($sharedip =~ /$iptocheck/) || ($ourip == /$iptocheck/) ) {
                                        print "\n[*] Matched multi shared.\n";
                                        $shared = 1;
                                        last;
                                }
                        }
                }
        }
        if ( ($shared) && ($onserver) ) {
                        print "\n[*] This is a SHARED ip on $hostname\n\n";
        }

        if ( !($shared) && ($onserver) ) {
                        print "\n[*] This is a DEDICATED ip on $hostname\n\n";
        }
} else {
        print "[*] Invalid argument.\n";
        exit;
}
EOF
