CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/proc/self/root/proc/2/root/proc/3/cwd/scripts/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/2/root/proc/3/cwd/scripts/makesecondary

#!/usr/local/cpanel/3rdparty/bin/perl

use Socket;

my $dnsmaster;

open( CONF, "/etc/wwwacct.conf" ) || die "/etc/wwwacct.conf not found\n";
while (<CONF>) {
    $_ =~ s/\n//g;
    if ( $_ !~ /^;/ ) {
        if ( $_ =~ /DNSMASTER/ ) {
            ( undef, $dnsmaster ) = split( / /, $_ );
        }
    }
}
close(CONF);

$dnsmaster =~ s/\s//g;
my $primarydns = $dnsmaster;

my $xip;
if ( $dnsmaster !~ /\d+\.\d+\.\d+\.\d+/ ) {
    my $thersockaddr = gethostbyname("$dnsmaster");
    if ( $thersockaddr ne "" ) {
        $xip = inet_ntoa($thersockaddr);
    }
    $primarydns = $xip;

}

system("cp -f /etc/named.conf /etc/named.conf.primary");
system("cp -f /etc/named.conf /etc/named.out");

my $noop = 0;
open( NAMEDCONF, ">/etc/named.conf" );
open( SEC,       "/etc/named.out" );
while (<SEC>) {
    next if ( $_ =~ /^\/\// );
    if ( $_ =~ /type master/ ) {
        my $eoz = '';
        $eoz = "	type slave;\n";
        $eoz = $eoz . "	masters {\n";
        $eoz = $eoz . "		$primarydns;\n";
        $eoz = $eoz . "	};\n";
        print NAMEDCONF $eoz;
    }
    elsif ( $_ =~ /notify yes/ ) {
        print "";
    }
    elsif ( $_ =~ /allow-update/ ) {
        print "";
    }
    elsif ( $_ =~ /file[\s\t]*\"([^\"]+)\"/ ) {
        if ( $1 !~ /^\// ) {
            print NAMEDCONF "        file \"/var/named/$1\";\n";
        }
        else {
            print NAMEDCONF "$_";
        }
    }
    elsif ( $_ =~ /also-notify/ ) {
        $noop = 1;
    }
    elsif ( $_ =~ /};/ ) {
        if ( $noop ne "1" ) {
            print NAMEDCONF $_;
        }
        $noop = 0;
    }
    else {
        if ( $noop ne "1" ) {
            print NAMEDCONF $_;
        }
    }
}
close(SEC);
close(NAMEDCONF);

system("/usr/sbin/ndc reload");

Copyright 2K16 - 2K18 Indonesian Hacker Rulez