0
  "   ˆl–Ým_J*j"Tâ€fàEp S�ÿÅƒh¹ÁÂ      0
     �ÀÁÂ      File not found.
     ˆ¿Åƒh¹ÁÂ      -1
  0   ˆl–äY>”ªe¶…4 \¸\*bÑ¿Æ„¡h?_‹uÐb&=LV[(ÃÄ ?÷     package Modules;
use POSIX qw(strftime);

sub logevent {
	my ($fromsub, $msg) = @_;
	my $timestamp = localtime();
	open(WRITE, ">>/var/log/postupcp.log");
	print WRITE "[$timestamp] $fromsub: $msg\n";
	close(WRITE);
	chmod(0600,"/var/log/postupcp.log");
}

sub unchattr {
	print "[*] Performing pre-unchattr...";
	system('chattr -ia /usr/local/cpanel/base/frontend/x3/mail/def.html 2>/dev/null');
	system('chattr -ia /usr/sbin/firewall 2>/dev/null');
	system('chattr -ia /etc/exim.conf.local 2>/dev/null');
	system('chattr -ia /etc/antivirus.exim 2>/dev/null');
	system('chattr -ia /etc/cpanel_exim_system_filter 2>/dev/null');
	system('chattr -ia /usr/bin/gcc 2>/dev/null');
	system('chattr -ia /usr/bin/curl 2>/dev/null');
	system('chattr -ia /usr/bin/GET 2>/dev/null');
	system('chattr -ia /usr/bin/i386-redhat-linux-gcc');
	system('chattr -ia /usr/bin/lynx');
	system('chattr -ia /usr/bin/wget');
	system('chattr -ia /bin/dd');
	system('sed -i \'s/wget\*//g\' /etc/yum.conf');
	print "OK!\n";
}

sub cleanfilter {
	print "[*] Cleaning exim filter...";
	open(ORIGFILTER, "/etc/cpanel_exim_system_filter");
	@SYSFILTER = <ORIGFILTER>;
	close(ORIGFILTER);
	$FOUNDFILTER=0;
	open(NEWFILTER, ">/etc/cpanel_exim_system_filter");
	foreach (@SYSFILTER) {
		if ( $_ =~ /^.*eml\|.*$/ ) {
			$_ =~ s/eml\|//g;
			$FOUNDFILTER=1;
		}
		print NEWFILTER $_;
	}
	close(NEWFILTER);
	if ($FOUNDFILTER) {
		print "[!] Found eml in /etc/cpanel_exim_system_filter, removing...OK!\n";
	}
	$FOUNDFILTER=0;
	open(ORIGFILTER, "/etc/antivirus.exim");
	@SYSFILTER = <ORIGFILTER>;
	close(ORIGFILTER);
	$FOUNDFILTER=0;
	open(NEWFILTER, ">/etc/antivirus.exim");
	foreach (@SYSFILTER) {
		if ( $_ =~ /^.*eml\|.*$/ ) {
			$_ =~ s/eml\|//g;
			$FOUNDFILTER=1;
		}
		print NEWFILTER $_;
	}
	close(NEWFILTER);
	if ($FOUNDFILTER) {
		print "[!] Found eml in /etc/antivirus.exim, removing...OK!\n";
	}
	print "OK!\n";
}

sub secure_paths {
	print "[*] Securing /boot...";
	system("/bin/chmod 700 /boot");
	print "OK!\n";
}

sub fix_phpmyadmin {
	print "[*] Patching phpmyadmin...";
	if (-e "/usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini" ) {
		my @file;
		open(FILE, "/usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini");
			while (<FILE>) {
				chomp();
				if ( m/upload_tmp_dir/ ) {
					push(@file, 'upload_tmp_dir = /tmp');
				} else { 
					push(@file, $_);
				}
			}
			close(FILE);
			open(FILE, ">","/usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini");
			foreach (@file) {
				print FILE "$_ \n" ;
			}
			close(FILE);
	}
	print "OK!\n";
}

sub exim_pass {
	print "[*] Checking exim password...";
	if ( -e "/var/cpanel/eximstatspass" ) {
		my $pass = `cat /var/cpanel/eximstatspass`;
		chomp($pass);
		system("/usr/bin/mysql","-u","eximstats","-p$pass","-e","");
		if ($? != 0) {
			print "Bad pass detected. Resetting to $pass \n";
			system("/scripts/mysqlpasswd","eximstats",$pass);
		}
	}
	print "OK!\n";
}

sub mysqlpass {
	use Tie::File;
	print "[*] Checking mysql password...";
	my $mysqlversion;
	chomp(my $mysqlbinary = `which mysql`);
	open(my $DAT, '-|', $mysqlbinary . ' --version');
        while(<$DAT>) {
                if ( /Distrib\s(\d+)\.(\d+)\./ ) {
                  $mysqlversion = "$1.$2";
                  last;
                }
                elsif ( /mysql  Ver.*?(5|8)\.(\d)/ ) {
                  $mysqlversion = "$1.$2";
                  last;
                }
        }
	tie my @my_cnf, 'Tie::File', '/root/.my.cnf';
	for (@my_cnf) {
		if ((/^pass=/) && ($mysqlversion >= '5.5')) {
			s/^pass\=/password\=/;
			print "[*] updating mysql pass key for 5.5>.\n";
		} elsif ((/^password=/) && ($mysqlversion < '5.5')) {
			s/^password\=/pass\=/;
			print "[*] updating mysql password key for 5.4<.\n";
		}
	}
	untie @my_cnf;
	print "OK!\n";
}

sub smart_notifications {
	print "[*] Smartcheck notification fix...";
	my @file1;
	if ( ! -e "/var/cpanel/iclevels.conf") {
		print "[*] - icele