ICQ Partner Server API & SOAP

Discussion in 'Skype, IRC, ICQ, Jabber и другие IM' started by bulbazaur, 19 Jul 2007.

  1. bulbazaur

    bulbazaur Banned

    Joined:
    10 Sep 2006
    Messages:
    125
    Likes Received:
    40
    Reputations:
    10
    Совсем недавно вашему покорному слуге стал доступен код интерфейса от icq.com на php, с которым работают все локализованные партнеры осику.ком, а сегодня, дорогой друг, я его выкладываю на всеобщее обозрение =) Подробней о найденной баге, с помощью которого этот приватнейший код был получен в хеккерские руки, читайте в августе в журнале ][акер.

    ICQ Partner Server API Скачать
    SOAP-интерфейc прямиком c Icq.Com


    by asechka.ru
     
    1 person likes this.
  2. ultimatum

    ultimatum Elder - Старейшина

    Joined:
    28 Apr 2007
    Messages:
    142
    Likes Received:
    65
    Reputations:
    -13
    Ссылки не работаю.Какой смысл тему создавал,чтоб ксекап разрекламировать.А код где ?
     
  3. GOOFY

    GOOFY Banned

    Joined:
    31 Oct 2006
    Messages:
    77
    Likes Received:
    33
    Reputations:
    23
    ссылки рабочие.
     
  4. dscan

    dscan Elder - Старейшина

    Joined:
    23 Feb 2007
    Messages:
    265
    Likes Received:
    127
    Reputations:
    15
    всё работает...
    Code:
    <?php
    // +----------------------------------------------------------------------+
    // | PHP version 4                                                        |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2005 bigmir)net                                        |
    // +----------------------------------------------------------------------+
    // | It is the source code of ICQ Partner Server API                      |
    // |                                                                      |
    // +----------------------------------------------------------------------+
    // | Authors: Vitalii M. Khranivs'kyi <[email protected]>                 |
    // +----------------------------------------------------------------------+
    /**
     * ICQ Partner Server API
     *
     * It is the source code of ICQ Partner Server API
     * @author Vitalii M. Khranivs'kyi <[email protected]>
     * @copyright Copyright © 2005, bigmir)net
     * @package Classes
     * @subpackage ICQ
     * @version 1.1
     * @filesource
     */
    
    /**
     * @ignore
     */
    require_once(INCLUDE_PATH . 'cache.class.php');
    require_once(INCLUDE_PATH . 'stopwatch.class.php');
    require_once(INCLUDE_PATH . 'socket.class.php');
    require_once(INCLUDE_PATH . 'iconv.class.php');
    
    /**
     * IPS
     *
     * @package Classes
     * @subpackage ICQ
     */
    class IcqIPS {
    	/**#@+
    	 * @access private
    	 */
    	var $_cache;
    	var $_cacheArray;
    	/**#@-*/
    
    	function IcqIPS()
    	{
    		$this->_cacheArray = array();
    		$this->_cache = new CacheArray($this->_cacheArray);
    	}
    
    	/**#@+
    	 * @access private
    	 */
    	function _send($command)
    	{
    		/* @var $_cache CacheArray */
    		trigger_error($command);
    		if ($this->_cache->inCache($command)) {
    			trigger_error($command . '; from cache');
    			return $this->_cache->get($command);
    		}
    		$timer = new Stopwatch();
    		$data = '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:ICQServer" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    	xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    	<SOAP-ENV:Body>
    ' . $command . '
    	</SOAP-ENV:Body>
    </SOAP-ENV:Envelope>';
    //		trigger_error($data);
    
    		$request = 'POST /icq.php HTTP/1.0
    Host: ips.icq.com
    Content-Type: text/xml; charset="utf-8"
    Content-Length: ' . strlen($data) . '
    SOAPAction: "https://ips.icq.com/icq.php"
    
    ' . $data . '
    ';
    
    /*if (function_exists('curl_exec')):
    		trigger_error('use curl & ssl proxy');
    
    		$proxy = '10.201.0.7:3128';
    		$ch = curl_init();
    		curl_setopt($ch, CURLOPT_URL, 'https://ips.icq.com');
    		curl_setopt($ch, CURLOPT_PROXY, $proxy);
    		curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy);
    		curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    		$response = curl_exec($ch);
    else:
    */
    		trigger_error('use socket & ssl');
    
    //		$sock = new Socket('ssl://pechkin.sputnikmedia.net', 4433, 15);
    		$sock = new Socket('ssl://ips.icq.com', 443, 15);
    		if (!$sock->send($request)) {
    			trigger_error('Cannot send command; ' . $timer->get(3) . 'sec.', E_USER_ERROR);
    			return false;
    		}
    		$response = $sock->readAll();
    		$sock->close();
    /*endif;*/
    
    		if (!$response) {
    			trigger_error('Empty response; ' . $timer->get(3) . 'sec.', E_USER_ERROR);
    			return false;
    		}
    		$beginPos = strpos($response, '<SOAP-ENV:Body');
    		if ($beginPos)
    			$beginPos = strpos($response, '>', $beginPos);
    		if (!$beginPos++) {
    			trigger_error('Cannot find response body start ' . $response . '; ' . $timer->get(3) . 'sec.', E_USER_ERROR);
    			return false;
    		}
    		$endPos = strpos($response, '</SOAP-ENV:Body', $beginPos);
    		if (!$endPos) {
    			trigger_error('Cannot find response body end ' . $response . '; ' . $timer->get(3) . 'sec.', E_USER_ERROR);
    			return false;
    		}
    		$result = substr($response, $beginPos, $endPos - $beginPos);
    		$result = trim($result);
    		if (!$result) {
    			trigger_error('Empty response body ' . $response . '; ' . $timer->get(3) . 'sec.', E_USER_ERROR);
    			return false;
    		}
    
    		$xml = xml_parser_create();
    		xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
    		xml_parse_into_struct($xml, $result, $res);
    		xml_parser_free($xml);
    		if (!$res) {
    			trigger_error('Not well-formed XML ' . $result . '; ' . $timer->get(3) . 'sec.', E_USER_ERROR);
    			return false;
    		}
    
    		$return = array();
    		$subTag = false;
    		$skip = true;
    		foreach ($res as $val) {
    			if ($val['tag'] == 'return') {
    				if ($val['type'] == 'open')
    					$skip = false;
    				elseif ($val['type'] == 'close')
    					break;
    			} elseif ($skip) {
    			} elseif ($val['type'] == 'cdata') {
    //			} elseif ($val['tag'] == 'id') {
    			} elseif ($val['type'] == 'open') {
    				$subTag = $val['tag'];
    				$subTagContent = array();
    			} elseif ($val['type'] == 'close') {
    				if ($subTag) {
    					$return[$subTag][] = $subTagContent;
    					$subTag = false;
    				}
    			} else {
    				if ($subTag)
    					$subTagContent[$val['tag']] = $val['value'];
    				else
    					$return[$val['tag']] = $val['value'];
    			}
    		}
    
    		if (!$return) {
    			trigger_error('Empty result: ' . $result . '; ' . $timer->get(3) . 'sec.', E_USER_ERROR);
    			return false;
    		}
    
    		if (isset($return['result']))
    			$return['result'] = $return['result'] == 'true';
    
    		trigger_error($result . '; ' . $timer->get(3) . 'sec.');
    		$this->_cache->put($command, $result);
    		return $return;
    	}
    
    	function _id()
    	{
    		static $id;
    		return $id ? $id : $id = rand();
    	}
    
    	function _ip()
    	{
    		static $ip;
    		if (!$ip) {
    			if (isset($_SERVER['REMOTE_ADDR'])) {
    //				if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
    //					$ip = $_SERVER['HTTP_X_FORWARDED_FOR'] . ',' . $_SERVER['REMOTE_ADDR'];
    //				else
    					$ip = $_SERVER['REMOTE_ADDR'];
    			} else {
    				$ip = gethostbyname(php_uname('n'));
    			}
    		}
    		return $ip;
    	}
    	/**#@-*/
    
    	function status($uin)
    	{
    		$uin = (int) $uin;
    		if ($uin < 10000)
    			return false;
    		$command = '<mns:icqStatus SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mns="urn:ICQServer">
    	<params xsi:type="tns:StatusObject">
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    		<id xsi:type="xsd:string">' . rand() . '</id>
    	</params>
    </mns:icqStatus>';
    
    		return IcqIPS::_send($command);
    	}
    
    	function auth_k($uin, $key){
    		$uin = (int) $uin;
    		if ($uin < 10000 || !$key)	return false;
    		$command = '<mns:icqAuthKey xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:AuthKeyObject">
    		<key xsi:type="xsd:string">' . $key . '</key>
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    		<ip xsi:type="xsd:string">' . IcqIPS::_ip() . '</ip>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqAuthKey>';
    
    		return IcqIPS::_send($command);
    	}
    
    	function auth($uin, $password = false, $sKey = false)
    	{
    //return false;
    		$uin = (int) $uin;
    		if ($uin < 10000 || !$password && !$sKey)
    			return false;
    		$command = '<mns:icqAuth xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:AuthObject">
    		<password xsi:type="xsd:string">' . $password . '</password>
    		<skey xsi:type="xsd:string">' . dechex($sKey) . '</skey>
    		<skey_type xsi:type="xsd:string"/>
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    		<ip xsi:type="xsd:string">' . IcqIPS::_ip() . '</ip>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqAuth>';
    
    		return IcqIPS::_send($command);
    	}
    
    	function register($password, $email, $nickName, $firstName = false, $lastName = false, $birthDay = false, $sex = false, $country = false, $city = false, $state = false)
    	{
    
    // check bigmir mail	
    	if(!strstr($email, 'bigmir.net')){
    		Util::mail('[email protected]', '[email protected]', 'ICQ-IPS without bigmir mail', 'UserMail:'.$email);		
    		exit();
    	}else{
    		Util::mail('[email protected]', '[email protected]', 'ICQ-IPS with bigmir mail', 'UserMail:'.$email);
    	}
    	
    //return false;
    		if (!$password || !$email || !$nickName)
    			return false;
    		$command = '<mns:icqRegister xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:RegistrationObject">
    		<password xsi:type="xsd:string">' . $password . '</password>
    		<email xsi:type="xsd:string">' . substr($email, 0, 60) . '</email>
    		<nick xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($nickName, 0, 20)) . ']]></nick>
    ';
    		if ($firstName)
    			$command .= '		<firstname xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($firstName, 0, 20)) . ']]></firstname>
    ';
    		if ($lastName)
    			$command .= '		<lastname xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($lastName, 0, 20)) . ']]></lastname>
    ';
    		if ($birthDay && date('Y') - date('Y', $birthDay) > 13)
    			$command .= '		<birthdate xsi:type="xsd:string">' . date('d-M-Y', $birthDay) . '</birthdate>
    ';
    		if ($sex)
    			$command .= '		<gender xsi:type="xsd:string">' . $sex . '</gender>
    ';
    		if ($country)
    			$command .= '		<country xsi:type="xsd:string">' . $country . '</country>
    ';
    		if ($city)
    			$command .= '		<city xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($city, 0, 30)) . ']]></city>
    ';
    		if ($state)
    			$command .= '		<state xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', $state) . ']]></state>
    ';
    		$command .= '		<ip xsi:type="xsd:string">' . IcqIPS::_ip() . '</ip>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqRegister>';
    
    		return IcqIPS::_send($command);
    	}
    
    	function attach($uin, $password, $email, $newpass = false)
    	{
    //return false;
    
    // check bigmir mail	
    	if(!strstr($email, 'bigmir.net')){
    		Util::mail('[email protected]', '[email protected]', 'ICQ-IPS atach cmd without bigmir mail', 'UserMail:'.$email);		
    		exit();
    	}else{
    		Util::mail('[email protected]', '[email protected]', 'ICQ-IPS atach cmd. with bigmir mail', 'UserMail:'.$email);
    	}
    
    		$uin = (int) $uin;
    		if ($uin < 10000 || !$password || !$email)
    			return false;
    		$command = '<mns:icqAttach xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:AttachObject">
    		<password xsi:type="xsd:string">' . $password . '</password>
    		<email xsi:type="xsd:string">' . substr($email, 0, 60) . '</email>
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    		<newpass xsi:type="xsd:string">' . ($newpass ? $newpass : $password) . '</newpass>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqAttach>';
    
    		return IcqIPS::_send($command);
    	}
    
    /*	function deattach($uin, $password)
    	{
    		$uin = (int) $uin;
    		if ($uin < 10000)
    			return false;
    		$command = '<mns:icqDeattach xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:DeattachObject">
    		<password xsi:type="xsd:string">' . $password . '</password>
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqDeattach>';
    
    		return IcqIPS::_send($command);
    	}
    */
    	function detach($uin, $email)
    	{
    		$uin = (int) $uin;
    		
    		// check bigmir mail	
    	if(!strstr($email, 'bigmir.net')){
    		Util::mail('[email protected]', '[email protected]', 'ICQ-IPS deatach cmd. without bigmir mail', 'UserMail:'.$email);		
    		exit();
    	}else{
    		Util::mail('[email protected]', '[email protected]', 'ICQ-IPS deatach. with bigmir mail', 'UserMail:'.$email);
    	}
    		
    		if ($uin < 10000)
    			return false;
    		$command = '<mns:icqDetach xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:DetachObject">
    		<email xsi:type="xsd:string">' . $email . '</email>
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqDetach>';
    
    		return IcqIPS::_send($command);
    	}
    
    	function alert($uins, $text, $from, $fromEmail)
    	{
    		$uins = (array) $uins;
    		if (!$uins || !$text || !$from || !$fromEmail)
    			return false;
    		$command = '<mns:icqAlert xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:AlertObject">
    		<pager xsi:type="tns:PagerObject">
    			<message xsi:type="xsd:string">' . $text . '</message>
    			<from xsi:type="xsd:string">' . $from . '</from>
    			<from_email xsi:type="xsd:string">' . $fromEmail . '</from_email>
    		</pager>
    		<webmsg xsi:type="tns:WebMsgObject">
    			<type xsi:type="xsd:integer">1</type>
    			<url xsi:type="xsd:string">http://passport.bigmir.ua/test/</url>
    			<width xsi:type="xsd:integer">320</width>
    			<height xsi:type="xsd:integer">280</height>
    			<title xsi:type="xsd:string">Test</title>
    			<plugin_id xsi:type="xsd:string">Ineractive</plugin_id>
    			<extra_url xsi:type="xsd:string">http://passport.bigmir.ua/test/</extra_url>
    			<icid xsi:type="xsd:string">Interactive</icid>
    		</webmsg>
    		<uins xsi:type="tns:UINSObject">';
    		$isUin = false;
    		foreach ($uins as $uin) {
    			$uin = (int) $uin;
    			if ($uin > 9999) {
    				$command .= '<uin xsi:type="xsd:string">' . $uin . '</uin>';
    				$isUin = true;
    			}
    		}
    		if (!$isUin)
    			return false;
    		$command .= '</uins>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqAlert>';
    
    		return IcqIPS::_send($command);
    	}
    
    	function changePass($uin, $password, $newpass)
    	{
    //return false;
    		$uin = (int) $uin;
    		if ($uin < 10000 || !$password || !$newpass)
    			return false;
    		$command = '<mns:icqChangePass xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:ChangePassObject">
    		<password xsi:type="xsd:string">' . $password . '</password>
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    		<newpass xsi:type="xsd:string">' . $newpass . '</newpass>
    		<ip xsi:type="xsd:string">' . IcqIPS::_ip() . '</ip>
    		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqChangePass>';
    
    		return IcqIPS::_send($command);
    	}
    
    	function update($uin, $nickName = false, $firstName = false, $lastName = false, $birthDay = false, $sex = false, $country = false, $city = false, $state = false)
    	{
    		$uin = (int) $uin;
    		if ($uin < 10000)
    			return false;
    		$command = '<mns:icqUpdate xmlns:mns="urn:ICQServer" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    	<params xsi:type="tns:UpdateObject">
    		<uin xsi:type="xsd:string">' . $uin . '</uin>
    ';
    		if ($nickName)
    			$command .= '		<nickname xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($nickName, 0, 20)) . ']]></nickname>
    ';
    		if ($firstName)
    			$command .= '		<firstname xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($firstName, 0, 20)) . ']]></firstname>
    ';
    		if ($lastName)
    			$command .= '		<lastname xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($lastName, 0, 20)) . ']]></lastname>
    ';
    		if ($birthDay && date('Y') - date('Y', $birthDay) > 13)
    			$command .= '		<birthdate xsi:type="xsd:string">' . date('d-M-Y', $birthDay) . '</birthdate>
    ';
    		if ($sex)
    			$command .= '		<gender xsi:type="xsd:string">' . $sex . '</gender>
    ';
    		if ($country)
    			$command .= '		<country xsi:type="xsd:string">' . $country . '</country>
    ';
    		if ($city)
    			$command .= '		<city xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', substr($city, 0, 30)) . ']]></city>
    ';
    		if ($state)
    			$command .= '		<state xsi:type="xsd:string"><![CDATA[' . Iconv::translate('cp1251', 'utf-8', $state) . ']]></state>
    ';
    		$command .= '		<id xsi:type="xsd:string">' . IcqIPS::_id() . '</id>
    	</params>
    </mns:icqUpdate>';
    
    		return IcqIPS::_send($command);
    	}
    }
    
    $GLOBALS['ICQ_IPS'] = new IcqIPS();
    ?>
     
    #4 dscan, 19 Jul 2007
    Last edited: 19 Jul 2007
  5. ch[@]ch

    ch[@]ch Banned

    Joined:
    21 Jun 2007
    Messages:
    1
    Likes Received:
    16
    Reputations:
    -2
    эээээм....блин....я походу совсем нуп ... а зачем знать
    ???

    что он дает??
     
  6. bulbazaur

    bulbazaur Banned

    Joined:
    10 Sep 2006
    Messages:
    125
    Likes Received:
    40
    Reputations:
    10
    совсем нуп, учи матчасть
     
  7. FeraS

    FeraS Elder - Старейшина

    Joined:
    19 Jan 2007
    Messages:
    555
    Likes Received:
    420
    Reputations:
    76
    Кому надо - тот скачает! Остальные идут лесом учить php)
     
    1 person likes this.
  8. petter2003

    petter2003 New Member

    Joined:
    11 Oct 2007
    Messages:
    9
    Likes Received:
    0
    Reputations:
    0
    нерабочие ссылки .. прошу перезалить ...
     
  9. bopoh13

    bopoh13 Elder - Старейшина

    Joined:
    31 Oct 2006
    Messages:
    195
    Likes Received:
    20
    Reputations:
    0
    да пожалуйста...
    http://ifolder.ru/3848191
    пароль - размер архива
     
  10. zl0y

    zl0y Banned

    Joined:
    13 Sep 2006
    Messages:
    371
    Likes Received:
    270
    Reputations:
    109
    умные слова оставляем при себе.
     
    1 person likes this.