#!/usr/bin/perl
use vars qw($installerPath $sourcePath);
print "Content-type: text/html\r\n\r\n";
my (%FORMS) = %{parseform()};
$installerPath = '/usr/local/cpanel/whostmgr/docroot/cgi/rvsitebuilderinstaller';
$sourcePath = 'sources';
downloadIoncubeLoader($FORMS{'loaderPackage'});
if ( -d '/usr/local/cpanel/3rdparty/etc/ioncube') {
system('rsync -avz --timeout=60 /usr/local/cpanel/3rdparty/etc/ioncube/ ' . '/usr/local/cpanel/3rdparty/etc/ioncube-' . time() . ' >/dev/null');
system('rsync -avz --timeout=60 /ioncube/ /usr/local/cpanel/3rdparty/etc/ioncube >/dev/null');
}
if ($FORMS{'ref'}) {
print '<meta HTTP-EQUIV=Refresh CONTENT="0; URL=' . $FORMS{'ref'} . '">' . "\n";
}
else {
print '<meta HTTP-EQUIV=Refresh CONTENT="0; URL=/cgi/rvsitebuilder/index.php/sitebuilder/admin">' . "\n";
}
sub downloadIoncubeLoader{
my ($packageName) = @_ ;
chdir($installerPath);
if ( !-d $installerPath . '/' . $sourcePath ) {
mkdir($installerPath . '/' . $sourcePath);
system('chmod 777 -R ' . $installerPath . '/' . $sourcePath . ' >/dev/null');
}
if ( -e $installerPath . '/' . $sourcePath . '/' . $packageName ) {
unlink($installerPath . '/' . $sourcePath . '/' . $packageName);
}
chdir($installerPath . '/' . $sourcePath);
system('wget http://download.rvglobalsoft.com/loader/ioncube/' . $packageName . ' >/dev/null');
if ( !-e $installerPath . '/' . $sourcePath . '/' . $packageName ) {
print 'ERROR : Cannot download ' . $packageName ;
exit;
}
system('bunzip2 -d ' . $packageName . ' >/dev/null');
$tarball = $packageName;
$tarball =~s/\.bz2//gi;
if ( !-e $installerPath . '/' . $sourcePath . '/' . $tarball ) {
print 'ERROR : Cannot bunzip ' . $packageName ;
exit;
}
system('tar -xvf ' . $tarball . ' >/dev/null');
if ( !-d $installerPath . '/' . $sourcePath . '/ioncube') {
print 'ERROR : Cannot tar ' . $tarball ;
exit;
}
if (!-d '/ioncube') {
mkdir('/ioncube');
system('chmod 0755 /ioncube >/dev/null');
}
system('rsync -avz --timeout=60 ' . $installerPath . '/' . $sourcePath . '/' . 'ioncube/ ' . '/ioncube');
system('chmod 755 -R /ioncube/* >/dev/null');
}
sub parseform{
my ($buffer, @pairs, $name, $value, %form, $pair);
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if ( length($buffer) <5) {
$buffer = $ENV{'QUERY_STRING'};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value=~tr/+/ /;
$value =~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$form{$name} = $value;
}
return \%form;
}
1;
__END__
Copyright 2K16 - 2K18 Indonesian Hacker Rulez