diff --git a/Deobfuscated/MailerShell_54f520d4fd74f10be0e8f3121cc2a5d38bdc591c.php b/Deobfuscated/MailerShell_54f520d4fd74f10be0e8f3121cc2a5d38bdc591c.php
new file mode 100644
index 0000000..fb5decb
--- /dev/null
+++ b/Deobfuscated/MailerShell_54f520d4fd74f10be0e8f3121cc2a5d38bdc591c.php
@@ -0,0 +1,721 @@
+';
+ print_r($s);
+ if ( !defined('STDIN') ) echo '';
+ return;
+ }
+
+ if ( $s == '
' && defined('STDIN') ) {
+ echo "------------------------------------------------------------\n";
+ return;
+ }
+
+ if ( defined('STDIN') ) {
+ echo $s."\n";
+ } else {
+ echo htmlspecialchars($s)." ";
+ }
+ }
+
+}
+
+
+class smtp extends logger {
+ var $socket;
+ var $last_code = 0;
+ var $last_msg = '';
+ var $host = '';
+
+ var $error = false;
+ var $error_msg = '';
+
+ var $selfhost = '';
+ var $mailfrom = '';
+
+ var $mx_chache = array();
+ var $cachePlace = '';
+ var $cacheloaded = false;
+
+ var $command_results = array();
+
+ var $last_mx = array(); // array of 'domain':'mx index pairs' to loop through mx servers
+
+ // constructor
+ function smtp($selfhost = null) {
+ if ( $selfhost ) {
+ $this->selfhost = $selfhost;
+ } else {
+ $this->selfhost = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';
+ }
+ }
+
+ // gets command result
+ function cr($command) {
+ if ( isset($this->command_results[$command] ) ) {
+ $r = $this->command_results[$command];
+ return is_array($r) ? $r['msg'] : $r;
+ } else {
+ return null;
+ }
+ }
+
+ // ---- MX cache -------------
+
+ function ensureMXCache() {
+ global $CACHEPLACES;
+ if ( !$this->cacheloaded ) {
+
+ foreach ( $CACHEPLACES as $dir ) {
+ if ( $this->tryLoadCache($dir) ) {
+ break;
+ }
+ }
+ }
+ }
+
+ function tryLoadCache($dir) {
+ $cache = @file_get_contents($dir."/aevs_mx_cache");
+ if ( $cache ) {
+ $this->mx_cache = json_decode($cache, true);
+ $this->cacheloaded = true;
+ $this->cachePlace = $dir;
+ $this->log('MX Cache loaded from '.$dir);
+ return true;
+ }
+ }
+
+ function trySaveCache($dir) {
+ $content = json_encode($this->mx_cache);
+ $done = @file_put_contents($dir."/aevs_mx_cache", $content);
+ if ( $done ) {
+ $this->cachePlace = $dir;
+ $this->log('MX Cache saved to '.$dir);
+ return true;
+ }
+ }
+
+ function saveMXCache() {
+ global $CACHEPLACES;
+ foreach ( $CACHEPLACES as $dir ) {
+ if ( $this->trySaveCache($dir) ) {
+
+ break;
+ }
+ }
+ }
+
+ function getMXIndex($domain) {
+ $idx = 0;
+ if ( isset($this->last_mx) ) {
+ if ( isset($this->last_mx[$domain]) ) {
+ $this->last_mx[$domain]++;
+ $idx = $this->last_mx[$domain];
+ } else {
+ $this->last_mx[$domain] = $idx;
+ }
+ } else {
+ $this->last_mx = array( $domain => $idx);
+ }
+ return $idx;
+ }
+
+
+
+ function getMX($domain) {
+ $idx = $this->getMXIndex($domain);
+ $this->ensureMXCache();
+ if ( isset($this->mx_cache[$domain]) ) {
+ // getting mx from chache
+ return isset($this->mx_cache[$domain][$idx]) ? $this->mx_cache[$domain][$idx] : false;
+ } else {
+ // resolving mx hosts
+
+ if ( getmxrr($domain, $mx_hosts, $mx_weights) ) {
+ // Put the records together in a array we can sort
+ for ( $i=0; $i < count($mx_hosts); $i++ ) {
+ $mxs[$mx_hosts[$i]] = $mx_weights[$i];
+ }
+
+ // Sort them
+ asort($mxs);
+
+ // Since the keys actually hold the data we want, just put those in an array, called records
+ $records = array_keys($mxs);
+
+ $this->mx_cache[$domain] = $records;
+ $this->saveMXCache();
+ return isset($records[$idx]) ? $records[$idx] : false;
+ } else {
+ return false; //$results[$email] = 'Error: MX record is not found';
+ }
+ }
+ }
+
+ // ---------------------------
+
+ function connect($emaildomain) {
+
+ $this->error = false;
+
+ do {
+ $this->host = $this->getMX($emaildomain);
+
+ if ( !$this->host ) {
+ $this->error = true;
+ $this->error_msg = 'Working MX record for domain '.$emaildomain.' is not found.';
+ $this->command_results['connect'] = $this->error_msg;
+ return false;
+ }
+
+ $this->log("Connecting to ".$this->host."...");
+ $this->socket = @fsockopen($this->host, 25);
+ if ( $this->socket ) {
+ $this->log("Connected.");
+ $this->read_response();
+
+ if ( $this->last_code != 220 ) {
+ $this->error = true;
+ $this->command_results['connect'] = $this->last_resp;
+ return $this->last_resp;
+ }
+ $this->command_results['connect'] = 'OK';
+
+
+ $this->send_command('HELO '.$this->selfhost);
+ //$this->send_command('HELO localhost');
+ if ( $this->last_code != 250 ) {
+ $this->error = true;
+ $this->command_results['hello'] = $this->last_resp;
+ return $this->last_resp;
+ }
+ $this->command_results['hello'] = 'OK';
+
+ $mf = $this->mailfrom ? $this->mailfrom : 'support@'.$this->selfhost;
+
+ $this->send_command('MAIL FROM: <'.$mf.'>');
+ if ( $this->last_code != 250 ) {
+ $this->error = true;
+ $this->command_results['mailfrom'] = $this->last_resp;
+ return $this->last_resp;
+ }
+ $this->command_results['mailfrom'] = 'OK';
+
+ return true;
+ } else {
+ $this->command_results['connect'] = 'Cannot connect to '.$this->host;
+ }
+
+ } while(!$this->socket);
+
+ return false;
+ }
+
+ function verifyEmail($email) {
+ if ( $this->error ) {
+ return $this->last_resp;
+ }
+ return $this->send_command('RCPT TO: <'.$email.'>');
+ }
+
+ // if remote server returns error on RCPT TO after which all email checks will fails (you are blacklisted,
+ // graylisted, or some other error)
+ function isFatalError($msg) {
+ $result = false;
+ $rxs = array(
+ '550 5.7.1.*((Sender Blocked)|(cannot find your hostname)|(authentication required)|(IP name lookup failed)|(Invalid Host)|(Rejected by user)|(Prohibited or invalid sender)|(Your message was rejected)|(your IP has been)|(IP banned))',
+ '(spamhaus\.org)|(Helo command rejected)|(HELO\/EHLO was syntactically invalid)|(Your IP Address)|(Sender address rejected)|(helo has been denied)|(DNS PTR)|(Sender rejected)|(cannot find your hostname)',
+ '501.*((invalid host name)|(sender domain must exist)|(system is not configured to relay mail from)|(IP address is on an RBL))',
+ '504.*helo command rejected',
+ '554.*((spam-relay detected)|(refused)|(listed)|(blocked)|(Spamhaus Blacklist)|(www\.us\.sorbs\.net)|(unauthenticated connections)|(Helo command rejected)|(spamhaus))',
+ '553.*((spamcop)|(openproxy)|(open proxy)|(mail-abuse.org)|(rejected)|(blocked)|(mail from.* not allowed)|(block list)|(validating sender)(http\:\/\/dsbl\.org)|(badmailfrom list)|(relaying denied from your location)|(does not accept mail from)|(Wrong helo)|(www\.sorbs\.net)|(dynamic_ip\.html)|(Dynamic pool)|(reverse dns record)|(Attack detected)|(sender has been denied)|(reverse DNS)|(invalid HELO)|(reverse\-DNS)|(DNS blacklists))',
+ '550.*((blacklist)|(Sender address rejected)|(open proxy)|(openproxy)|(spamcop)|(mail-abuse\.com)|(spamhaus)|(sender verify failed)|(requires valid sender)|(sender address .* does not exist)|(return address not allowed)|(could not verify sender)|(invalid sender address)|(ip helo.* not allowed)(dsbl\.org)|(FROM address from sending host is invalid)|(Invalid HELO)|(from sending mail from)|(SORBS DNSBL database)|(Bad HELO)|(EHLO\/HEL0)|(spamming not allowed)|(SpamHaus)|(Reverse DNS)|(HELO is syntactically invalid)|(HELO string is incorrect)|(detected in HELO)|(you must be spam)|(HELO\/EHLO)|(HELO domain)|(IP name lookup)|(HELO name)|(bogus HELO)|(SPF NONE)|(problem with sender)|(Relaying is not permitted from IP)|(invalid sender))',
+ '511.*(www\.sorbs\.net)',
+ '^554 5.7.1',
+ '^4(21|50|51|52).*((re|)try|grey)'
+ );
+ foreach( $rxs as $rx ) {
+ if ( preg_match("#".$rx."#i", $msg)) {
+ $result = true;
+ break;
+ }
+ }
+ return $result;
+ }
+
+ function verifyEmails($emails) {
+ $results = array();
+ foreach ( $emails as $email ) {
+ $email = trim($email);
+ if ( $email == '' ) continue;
+ $r = $this->verifyEmail($email);
+ $msg = $r['code'] == 250 ? 'OK' : $r['msg'];
+
+ if ( $this->isFatalError($r['msg']) ) {
+ return $r['msg'];
+ }
+
+ $results[$email] = $msg;
+ }
+ return $results;
+ }
+
+ function quit() {
+ $this->send_command('QUIT', 'no response');
+ fclose($this->socket);
+ return $this->last_resp;
+ }
+
+ // lov level functions
+
+
+ function read_response($timeout = 5) {
+
+ $data = "";
+ while($str = @fgets($this->socket, 515)) {
+ $data .= $str;
+ $this->log('<'.$str);
+ // if 4th character is a space, we are done reading, break the loop
+ if(substr($str,3,1) == " ") { break; }
+ }
+
+ $xarr = preg_split("#\n#", $data, -1, PREG_SPLIT_NO_EMPTY);
+ $msg = '';
+ $code = '';
+ $xcode = '';
+ foreach ( $xarr as $line ) {
+ if ( preg_match('#(\d+)(?:[\s\-]+(\d\.\d\.\d)|)[\s\-]+?(.*)#i', $line, $res) ) {
+ if ( isset($res[1]) ) $code = $res[1];
+ if ( isset($res[2]) ) $xcode = $res[2];
+ $msg .= ' '.trim($res[3]);
+ }
+ }
+
+ $msg = $code.' '.$xcode.' '.$msg;
+ $this->last_code = $code;
+ $this->last_msg = $msg;
+ $this->last_resp = array(
+ 'code' => $code,
+ 'msg' => $msg
+ );
+
+ return $this->last_resp;
+
+ }
+
+ function send_command($command, $read_response = '') {
+ $this->log('>'.$command);
+ fputs($this->socket, $command.EOL);
+ if ( $read_response != 'no response' ) {
+ return $this->read_response();
+ }
+ }
+
+}
+
+class verifier extends logger {
+ var $mailfrom;
+
+ function verifier($mailfrom = '') {
+ //constructor
+ $this->mailfrom = $mailfrom;
+
+ }
+
+ function getdomain($email) {
+ $xEmail = explode('@', $email);
+ return $xEmail[1];
+ }
+
+ function checkemails($emails, $l = 0){
+ $tree = array();
+ $res = array();
+ if ($l) {
+ $emails = array_slice($emails, 0, $l);
+ }
+ foreach ( $emails as $email ) {
+ $email = trim($email);
+ $domain = $this->getdomain($email);
+ $this->log('domain >'.$domain);
+ if ( !isset($tree[$domain]) ) $tree[$domain] = array();
+ $tree[$domain][] = $email;
+ }
+
+ foreach ( $tree as $domain => $emails ) {
+ if (trim($domain) == '') continue;
+ $c = new smtp();
+ $c->mailfrom = $this->mailfrom;
+
+ if ( $c->connect($domain) ) {
+ $res[$domain] = array(
+ 'connect' => $c->cr('connect'),
+ 'hello' => $c->cr('hello'),
+ 'mailfrom' => $c->cr('mailfrom'),
+ 'emails' => null
+ );
+ if ( !$c->error ) {
+ $res[$domain]['emails'] = $c->verifyEmails($emails);
+ }
+ $c->quit();
+ } else {
+ $res[$domain] = array(
+ 'connect' => $c->cr('connect')
+ );
+ }
+
+
+ }
+
+ return $res;
+ }
+
+}
+
+function is_writableEx($path) {
+//will work in despite of Windows ACLs bug
+//NOTE: use a trailing slash for folders!!!
+//see http://bugs.php.net/bug.php?id=27609
+//see http://bugs.php.net/bug.php?id=30931
+
+ if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
+ return is_writableEx($path.uniqid(mt_rand()).'.tmp');
+ else if (is_dir($path))
+ return is_writableEx($path.'/'.uniqid(mt_rand()).'.tmp');
+ // check tmp file for read/write capabilities
+ $rm = file_exists($path);
+ $f = @fopen($path, 'a');
+ if ($f===false)
+ return false;
+ fclose($f);
+ if (!$rm)
+ unlink($path);
+ return true;
+}
+
+function compatibility_check($v = 0) {
+ global $CACHEPLACES;
+
+ $results = array();
+
+ // checking if mx cache dir is writable
+ $has_writable_dir = false;
+
+ foreach ( $CACHEPLACES as $dir ) {
+ if ( is_writableEx($dir."/") ) {
+ $has_writable_dir = true;
+ if ( $v == 2 ) {
+ $results[] = array( 'code' => 'OK', 'msg' => "Directory $dir is writable" );
+ }
+ } else {
+ if ( $v >= 1 ) {
+ //$results[] = array( 'code' => 'WARNING', 'msg' => "Directory $dir is not writable");
+ }
+ }
+ }
+ if ( !$has_writable_dir ) {
+ $results[] = array(
+ 'code' => 'WARNING',
+ 'msg' => 'Theres no writable dir for MX chache. This will decrease script performance.'
+ );
+ }
+
+ // checking for disabled function
+ $functions_to_check = array(
+ 'fsockopen',
+ 'getmxrr',
+ 'json_encode',
+ 'dns_get_record'
+ );
+
+ foreach ( $functions_to_check as $fn ) {
+ if ( function_exists($fn) ) {
+ if ($v == 2)
+ $results[] = array(
+ 'code' => 'OK',
+ 'msg' => "Function $fn exists"
+ );
+ } else {
+ $results[] = array(
+ 'code' => 'ERROR',
+ 'msg' => "Function $fn does not exists."
+ );
+ }
+ }
+
+ $d_functions = ini_get('disable_functions');
+ if ( $d_functions ) {
+ $df_list = explode(' ', $d_functions);
+ foreach ( $functions_to_check as $fn ) {
+ if ( in_array($fn, $df_list) ) {
+ $results[] = array(
+ "code" => 'ERROR',
+ "msg" => "function $fn is disabled by administrator. It's needed for script to work."
+ );
+ } else {
+ if ( $v == 2 ) {
+ $results[] = array( 'code' => 'OK', "msg" => "function $fn allowed.");
+ }
+ }
+ }
+ }
+
+ // checking for allowed 25 port
+ $con = new smtp();
+ $mxhost = $con->getMX('gmail.com');
+ $sock = @fsockopen($mxhost, 25);
+ if ( $sock ) {
+ if ( $v == 2 ) {
+ $results[] = array(
+ 'code' => 'OK',
+ 'msg' => '25 port is allowed'
+ );
+ }
+ fclose($sock);
+ } else {
+ $results[] = array(
+ 'code' => 'ERROR',
+ 'msg' => '25 port seems to be forbidden by firewall rules'
+ );
+ }
+
+
+ // checking FCrDNS
+ $rdns_err = '';
+ $rdns = fcrdns_check($rdns_err);
+
+ if ( $rdns == 0 ) {
+ if ( $v == 2 ) {
+ $results[] = array(
+ 'code' => 'OK',
+ 'msg' => 'Forward Confirmed reverse DNS check passed.'
+ );
+ }
+ } else {
+
+ $s = "Forward Confirmed reverse DNS check failed. \n".$rdns_err;
+
+ $note = "
Note: This means that you cannot use the script to verify email addresses from the @yahoo.co*, @live.com, @hotmail.com, and @aol.com domains because these ISP use FCrDNS lookup to authenticate the IP address the connection is coming from. If the FCrDNS lookup fails, the incoming IP address goes to a blacklist. See the Advanced Email Verifier Help for more information.