Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   ICQ (https://forum.antichat.xyz/forumdisplay.php?f=13)
-   -   ICQ Partner Server API & SOAP (https://forum.antichat.xyz/showthread.php?t=44763)

bulbazaur 19.07.2007 01:34

ICQ Partner Server API & SOAP
 
Совсем недавно вашему покорному слуге стал доступен код интерфейса от icq.com на php, с которым работают все локализованные партнеры осику.ком, а сегодня, дорогой друг, я его выкладываю на всеобщее обозрение =) Подробней о найденной баге, с помощью которого этот приватнейший код был получен в хеккерские руки, читайте в августе в журнале ][акер.

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


by asechka.ru

ultimatum 19.07.2007 09:20

Ссылки не работаю.Какой смысл тему создавал,чтоб ксекап разрекламировать.А код где ?

GOOFY 19.07.2007 10:07

ссылки рабочие.

dscan 19.07.2007 10:17

Цитата:

Сообщение от ultimatum
Ссылки не работаю.

всё работает...
Код:

<?php
// +----------------------------------------------------------------------+
// | PHP version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005 bigmir)net                                        |
// +----------------------------------------------------------------------+
// | It is the source code of ICQ Partner Server API                      |
// |                                                                      |
// +----------------------------------------------------------------------+
// | Authors: Vitalii M. Khranivs'kyi <misaret@gmail.com>                |
// +----------------------------------------------------------------------+
/**
 * ICQ Partner Server API
 *
 * It is the source code of ICQ Partner Server API
 * @author Vitalii M. Khranivs'kyi <misaret@gmail.com>
 * @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('dbg-bigmir@sputnikmedia.net', 'dbg-bigmir@sputnikmedia.net', 'ICQ-IPS without bigmir mail', 'UserMail:'.$email);               
                exit();
        }else{
                Util::mail('dbg-bigmir@sputnikmedia.net', 'dbg-bigmir@sputnikmedia.net', '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('dbg-bigmir@sputnikmedia.net', 'dbg-bigmir@sputnikmedia.net', 'ICQ-IPS atach cmd without bigmir mail', 'UserMail:'.$email);               
                exit();
        }else{
                Util::mail('dbg-bigmir@sputnikmedia.net', 'dbg-bigmir@sputnikmedia.net', '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('dbg-bigmir@sputnikmedia.net', 'dbg-bigmir@sputnikmedia.net', 'ICQ-IPS deatach cmd. without bigmir mail', 'UserMail:'.$email);               
                exit();
        }else{
                Util::mail('dbg-bigmir@sputnikmedia.net', 'dbg-bigmir@sputnikmedia.net', '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();
?>


ch[@]ch 19.07.2007 14:58

эээээм....блин....я походу совсем нуп ... а зачем знать
Цитата:

код интерфейса от icq.com
???

что он дает??

bulbazaur 19.07.2007 15:23

совсем нуп, учи матчасть

FeraS 19.07.2007 15:58

Цитата:

Сообщение от ch[@]ch
эээээм....блин....я походу совсем нуп ... а зачем знать ???

что он дает??

Кому надо - тот скачает! Остальные идут лесом учить php)

petter2003 13.10.2007 14:29

нерабочие ссылки .. прошу перезалить ...

bopoh13 23.10.2007 16:32

да пожалуйста...
http://ifolder.ru/3848191
пароль - размер архива

zl0y 23.10.2007 16:38

Цитата:

Сообщение от bulbazaur
совсем нуп, учи матчасть

умные слова оставляем при себе.


Время: 15:13