• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            子彈 の VISIONS

            NEVER back down ~~

            C++博客 首頁(yè) 新隨筆 聯(lián)系 聚合 管理
              112 Posts :: 34 Stories :: 99 Comments :: 0 Trackbacks

            Quote of the Day:
            To create you must quiet your mind. You need a quiet mind so that ideas will have a chance of connecting.
            --Eric Maisil

             

            飛信 發(fā)短信 流程
            Sending SMS Flow of Fection

            Scratch from youwang’s MFCFetionSDK ,

            一點(diǎn)說(shuō)明:我沒(méi)有分析過(guò)飛信的協(xié)議,甚至沒(méi)有研究過(guò)飛信的協(xié)議。故不能保證這些東西的準(zhǔn)確性。這些程序員角度的流程是從MFCFetionSDK的代碼中提取出來(lái)的。條件允許的話,可以自己寫(xiě)個(gè)飛信發(fā)短信的程序;顯然,也可以使用現(xiàn)成的MFCFetionSDK。

            可能會(huì)涉及到的一些技術(shù)細(xì)節(jié):
            HTTP GET/POST, RFC2616,http://www.ietf.org/rfc/rfc2616.txt
            CODEPAGE CONVERSION, UTF-8, UNICODE, http://msdn.microsoft.com/en-us/library/aa914568.aspx, libiconv, Unicode
            MD5 HASH, CryptoAPI:http://msdn.microsoft.com/en-us/library/aa380252(VS.85).aspx
            SOCKET, http://www.sockets.com/, http://msdn.microsoft.com/en-us/library/ms740673(VS.85).aspx
            REGULAR EXPRESSION,http://www.boost.org/doc/libs/1_41_0/libs/regex/doc/html/index.html

            ------------------------------------------------------------------------
            1. Get system config
            1.0 Send post data(UTF-8) to: https://nav.fetion.com.cn/nav/getsystemconfig.aspx
            1.1 Convert post data to UTF-8 code:
            <config><user mobile-no="123456789" /><client type="PC" version="2.3.0230" platform="W5.1" /><servers version="0" /><service-no version="12" /><parameters version="15" /><hints version="13" /><http-applications version="14" /><client-config version="17" /></config>
            1.2 Send post data(UTF-8 encoded) to above URL, HTTP POST
            1.3 Receive post result (UTF-8 format)
            1.4 Convert result to Unicode: system config xml

            2. Parse the system config xml
            2.1 get "ssi-app-sign-in" nodes
            2.2 get "sipc-proxy" nodes

            3. Get fection NO.
            3.1 HTTP GET, URL= "ssi-app-sign-in".value + "?mobileno=123456789&pwd=111111"
            3.2 get above GET result(UTF-8 format) xml
            3.3 Convert GET result xml to Unicode
            3.4 Parse xml and get "user" nodes and "uri" nodes and "user-id" nodes
            3.5 Get "sip:{([0-9]+)}@fetion.com.cn" using RegEx
            3.6 Get the fection NO.

            4. SIPC
            4.1 Init SIPC with "sipc-proxy".value
            4.2 Parse the ip and port
            4.3 Connect above ip and port using socket

            5. Login
            5.1 login xml data:
            <args><device type="PC" version="6" client-version="2.3.0230" /><caps value="simple-im;im-session;temp-group" /><events value="contact;permission;system-message" /><user-info attributes="all" /><presence><basic value="400" desc="" /></presence></args>
            5.2 Generate login request
            Format("R %s SIP-C/2.0\r\nF: %s\r\nI: 1\r\nQ: 1 R\r\nL: %d\r\n\r\n"), domain, fetionNo, login xml length)
            domain="fetion.com.cn"
            fectionNO. from 3.6
            5.3 Login data = login request + login xml
            5.4 Convert to UTF-8 and send login data to SIPC using socket
            5.5 Receive the response from above send using socket and convert from UTF-8 to Unicode, pause when find "\r\n\r\n", the HEADER
            5.6 RegEx get matched "L: {([0-9]+)}", to parse out the buffer length
            5.7 Get the left data(UTF-8) with the Length(above), convert to Unicode, the CONTENT
            5.8 Above(HEADER+CONTENT) as the login response
            5.9 Parse out "nonce=\"{([0-9A-Z]+)}\"" using RegEx
            5.10 Calculate the NONCE
            5.10.1 Get random number, convert to UTF-8 string, get MD5 Hash string in HEX, the nonceMD5
            5.10.2 Format("%s:%s:%s", fectionNo, domain, pwd),  convert to UTF-8 string, get MD5 Hash string in HEX, the INFO_STRING_MD5
              fectionNO. from 3.6
              domain="fetion.com.cn"
              pwd=111111
            5.10.3 Format(":%s:%s", nonce, nonceMD5), convert to UTF-8 string, the NONCE_STRING
              nonce from 5.9
              nonceMD5 from 5.10.1
            5.10.4 INFO_STRING_MD5+NONCE_STRING, the LOGIN_STRING, MD5 of the LOGIN_STRING, the LOGIN_STRING_MD5
            5.10.5 Format("REGISTER:%s", fetionNo), convert to UTF-8 string, get MD5 Hash string in HEX, REG_STRING_MD5
            5.10.6 Format("%s:%s:%s", LOGIN_STRING_MD5, nonce, REG_STRING_MD5), convert to UTF-8 string, get MD5 Hash string in HEX, the nonceResponse
              LOGIN_STRING_MD5 from 5.10.4
              nonce from 5.9
              REG_STRING_MD5 from 5.10.5
            5.11 the second login, login xml data:
            <args><device type="PC" version="6" client-version="2.3.0230" /><caps value="simple-im;im-session;temp-group" /><events value="contact;permission;system-message" /><user-info attributes="all" /><presence><basic value="400" desc="" /></presence></args>
            5.12 Generate login request
            Format("R %s SIP-C/2.0\r\nF: %s\r\nI: 1\r\nQ: 2 R\r\nA: Digest response=\"%s\",cnonce=\"%s\"\r\nL: %d\r\n\r\n", domain, fetionNo, nonceResponse, nonceMD5, login xml length)
            domain="fetion.com.cn"
            fectionNO. from 3.6
            nonceResponse from 5.10
            nonceMD5 from 5.10.1
            5.13 Login data = login request + login xml
            5.14 Convert to UTF-8 and send login data to SIPC using socket
            5.15 Receive the response from above send using socket

            6. Send SMS to target phone
            6.1 Convert sms content to UTF-8 format
            6.2 Format("M %s SIP-C/2.0\r\nF: %s\r\nI: 2\r\nQ: 1 M\r\nT: tel:%s\r\nN: SendSMS\r\nL: %d\r\n\r\n", domain, fetionNo, phone, sms length)
            domain="fetion.com.cn"
            fectionNO. from 3.6
            phone: target phone number
            sms length: byte count, not character count
            6.3 Send login data to SIPC using socket

            7. Logout
            7.1 logout request data:
            Format("R %s SIP-C/2.0\r\nF: %s\r\nI: 1 \r\nQ: 3 R\r\nX: 0\r\n\r\n", domain, fetionNo)
            7.2 Send login data to SIPC using socket

            Hope it helps~
            ------------------------------------------------------------------------

            歡迎補(bǔ)充~~

            posted on 2010-01-06 13:50 子彈のVISIONS 閱讀(1183) 評(píng)論(1)  編輯 收藏 引用 所屬分類(lèi): 1.51 工具箱

            Feedback

            # re: [存照] 飛信 發(fā)短信 流程 2010-01-07 22:36 xiao
            能不能幫忙修改一個(gè)飛信協(xié)議升級(jí)后不能使用的php代碼,如果可以,請(qǐng)聯(lián)系 xiaorf#gmail.com,謝謝了  回復(fù)  更多評(píng)論
              

            久久人人爽人人人人爽AV| 99国内精品久久久久久久| 久久久亚洲精品蜜桃臀| 久久免费香蕉视频| 亚洲人成无码网站久久99热国产 | 亚洲中文字幕无码一久久区| 国产亚洲色婷婷久久99精品| 久久综合久久性久99毛片| 久久久噜噜噜久久中文字幕色伊伊 | 久久久无码精品亚洲日韩蜜臀浪潮| 人妻久久久一区二区三区| 日本国产精品久久| 成人免费网站久久久| 无码AV波多野结衣久久| 亚洲Av无码国产情品久久| 久久久久久夜精品精品免费啦| 亚洲精品无码久久不卡| 久久久久久综合一区中文字幕| 久久精品亚洲日本波多野结衣| 久久er国产精品免费观看8| 精品午夜久久福利大片| 久久精品黄AA片一区二区三区| 国产高清国内精品福利99久久| 色综合久久综精品| 久久精品aⅴ无码中文字字幕重口 久久精品a亚洲国产v高清不卡 | 久久99精品久久久久婷婷| 日日狠狠久久偷偷色综合0| 99久久国产综合精品成人影院| 蜜臀av性久久久久蜜臀aⅴ| 国产精品久久新婚兰兰| 国产69精品久久久久观看软件| 国产成人AV综合久久| 伊人久久综在合线亚洲2019| 国产精品久久久久久久久鸭| 久久亚洲AV成人无码国产 | 亚洲国产日韩欧美久久| 久久中文字幕无码专区| 免费精品国产日韩热久久| 伊人久久综合无码成人网| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 久久一日本道色综合久久|