Forehead
MSN Messenger is a chat tool developed by Microsoft and is currently a large user group in China. Using MSN Messenger can perform text chat, voice conversation, video conferencing, etc., can also view contacts online by this software. The latest version of the software is 6.1.
In 1999, Microsoft submitted a draft "MSN Messenger Service 1.0 Protocol" draft to IETF, which is the original version of MSN Messenger protocol. In the next few years, the company no longer discloses an upgrade of the MSN Messenger protocol and modify the official documentation of the details. But whether it is developing third-party chat client software (such as GAIM, Myim, etc.) or to do protocol analysis, must have an in-depth understanding of its communication protocol. Because of this, some civilians have conducted research on these agreements (see "related resources" section of this article).
When we are still sighing "this world, change", the MSN Messenger's agreement has reached the 10th edition, referred to as MSNP10, corresponding to MSN Messenger 6.1. MSN Messenger 6.0 uses MSNP9. Now Microsoft forces MSN Messenger users upgrade to 6.0 or 6.1, because the server is no longer supported by the version below MSNP8. The MSN Messenger protocol described in this paper and subsequent article is mainly for MSNP9 / MSNP10.
Connected
The MSN Messenger protocol is established above TCP / IP. In addition to file transfer and voice chat, all other situations are performed through the server.
On logic, there are three types of servers, each of which:
Dispatch Server, DS) - the server initially connected. Responsible to assign a suitable notification server to the client. The domain name is Messenger.hotmail.com, and the standard service port is 1863. After completing the dispatched task, cut off the TCP connection. Notification Server (NS) - The client needs to keep a connection server. Many tasks should be completed in this session, including login, change status, get a list of users, modify user information, launch chat, accept calls, mail notifications, exit, and so on. The service port is specified by the dispatch server, usually 1863. Wiring Server (SS) - The transit server used by the client between the client. Every time you open a chat window, the client and server create a TCP session. When the client needs to be filed or voice chat, send the system message to create a "point-to-point" session channel (which may turn to use UDP). The service port is usually 1863. The port used by the "point-to-point" communication is determined by the client automatically, such as file transfer usually uses 6891 ports. 2. Command MSN Messenger command uses a pure ASCII code. Use URL encoding for non-ASCII code characters. The syntax of the command is XXX [
Content-type: text / plain; charset = UTF-8 / R / N
X-MMS-IM-FORMAT: FN =% E5% AE% 8B% E4% BD% 93; EF =; CO = 0; CS = 86; PF = 0 / r / N
/ r / n
BHW98 / XE4 / XBD / XA0 / XE5 / XA5 / XBD / XEF / XBC / X81 is simple to analyze, "% E5% AE% 8B% E4% BD% 93" is a UTF-8 plus URL encoding of "Song", "BHW98 / XE4 / XBD / XA0 / XE5 / XA5 / XBD / XEF / XBC / X81" is "BHW98 Hello!" UTF-8 encoding. Command list
The source of commands Go to the description note on the ACK SS Client confirmation, make a sure answer. The AcknowledgeMentAdd Client NS issues a request to add a new contact to the list. Add Userns Client Returns an answer to add a new contact request. The Adg Client NS issues a new contact group request. Add Groupns Client Returns an answer to add a new contact group request. ANS Client SS accepts a chat connection request. The Answerblp Client NS setting is a confidentiality policy that has not been included in the contact list that is clearly allowed / forbidden. Block List Privacyns Client Returns a response to setting a confidential policy request. BYE SS Client Notifies the client ending session. Byecal Client SS issued a request for a chat connection. Callss Client returns a response to establish a chat connection request. CHG Client NS issued a request for a change. Change Statens Client Returns a response to changing the status. The CHL NS Client server issues a verification requirement. Challenges CLIENTCVR Client NS issues information such as OS, language, MSN Messenger version. Client VersionClient Ssns Client Returns the recommended MSN Messenger version, upgrade the software you need download address and other information. SS Clientfln NS Client Notificates the user's underscore in the contact list. OFF-LineGTC Client NS Setup When a prompt given when a user status in a contact list is changed. Greeting to changes? ns client returns a response to the setup request. The INF Client NS asks the authentication method supported by the server. INFORMATION? Client SSNS Client Returns the authentication method supported by the server. SS Clientiln NS Client When the client logs in or adds a contact to a list, the status of the contact in the list is notified. Initial Online Stateiro SS Client When there is a new user to join a chat connection, inform the client list in this connection. Initial Roster InformationJio SS Client Notification The client has established a chat connection with additional users. Jionlsg Client NS issues a request for obtaining a list of contact groups. List groupsns client returns a response to get a list of contact groups. The LST Client NS issues a request for obtaining a list of contacts. Listns client returns a response to get a contact list request. MSG Client SS Sends a message to other users (chat objects). Messagens Client Transfer Server (System) message to the client. SS Client passes the message to the client (chat object) to the client. NAK SS Client makes a negative answer. NEGATIVE ACKNOWEDGEMENTNLN NS Client Notifies the client contact online or changed. ON-Lineout All ALL ends the client-server connection. OUTPNG Client NS Tests TCP Connection Status. PingClient SSPRP Client NS issues a request for a personal phone number. Personal Phone Numberns Client Returns the Connection of the Setup request PNG Client NS test TCP connection status. PingClient Ssqng NS Client Returns a response to test TCP connection status. QUIZ PING? SS ClientQry Client NS Client Answer Server Verification Requirements. Quiz Reply? Client SSREA Client NS issued a request to modify the user nickname. Rename Nicknamens Client returns a response to modify the user nickname request. The REG Client NS issues a request to modify the contact group. Rename Groupns Client returns a response to modify the contact group request. The REM Client NS issues a request from the contact list.
Rename Userns Client returns a response to delete user requests. RMG Client NS issues a request for deleting contact groups. Remove Groupns Client returns a response to deleting a contact group request. RNG NS Client Notifying the client Someone wants to establish a chat connection. Ringsyn Client NS Client - Server Synchronization. Synchronizationns ClientURL Client NS issues a request for acquiring the MSN service URL. URLNS Client returns a response to get URL requests. USR all all declarations, passes, identify user identity. Userver Client DS negotiation MSN Messenger protocol version. VersionClient NSDS Clientns ClientxFR DS Client assigns NS to the client (notifying the client steering connection specified NS). TransferClient NS issues a request for allocating SS. NS Client returns a response assigned an SS request. MSN Messenger Agreement - Error Code List
Code Meaning Possible Command Error Demonstology 200 illegal Command ABC 18 / R / N 200 18 / R / N 201 illegal parameters CHG 19 FLN 0 / R / N 201 19 / R / N Add 20 Al Aaa @ BBB @ CCC AAA @ BBB @ CCC / R / N 201 20 / R / N 205 User does not exist add add 21 al none@hotmail.com none@hotmail.com/r/N 205 21 / R / N 206 Miss Domain 207 has been logged in USR USR 20 TWN I example@hotmail.com/R/N 207 20 / R / N usr 21 TWN S 8D30FC782AA25EC9E1293FDDA13CAB42 / R / N 207 21 / R / N 208 illegal user name CAL CAL 2 @@ Hotmail.com / R / N 208 2 / R / N 209 illegal user nickname REA REA 18 One@hotmail.com kill% 20MICROSOFT / R / N 209 18 / R / N 210 User too many Add add 23 fl one@hotmail.com one@hotmail.com 0 / r / N 210 23 / R / N largest 150215 User has already in the list Add add 36 fl one@hotmail.com one@hotmail.com 2 / r / n add 36 825 fl one@hotmail.com one@hotmail.com 2 / R / n add 37 fl one@hotmail.com 2 / r / n 215 37 / r / n Cal Cal 5 Two@hotmail.com/r/n Cal 5 Ringing 213697 / R / N CAL 6 TWO @ Hotmail.com / R / N 215 6 / R / N 216 User is not in the list Rem Rem 14 fl three@hotmail.com/r/N 216 14 / R / N Rea REA 48 Three@hotmail.com Three / R / N 216 48 / r / n Cal Cal 2 three@hotmail.com/r/n 216 2 / r / n 217 users are not online Cal Cal 2 Two@hotmail.com/R / N 217 2 / R / N 218 already specified mode BLP BLP 17 BL / R / N BLP 17 151 BL / R / N BLP 18 BL / R / N 218 18 / R / N GTC GTC 19 A / R / N GTC 19 152 A / R / N GTC 20 A / R / N 218 20 / R / N 219 User already in the opposite list Add add 15 al fund@hotmail.com four@hotmail.com/r/n add 15 al 56 Four@hotmail.com Four / R / N Add 16 Bl Four@hotmail.com Four@hotmail.com/r/n 219 16 / R / N 223 User Group too many ADG 28 new% 20group 0 / R / N 223 28 / R / N Maximum 30224 illegal group number Add RMG 24 3 / R / N RMG 24 11506 3 / R / N Add 25 FL FIVE@hotmail.com 3 / R / N 224 25 / R / N Rem RMG 24 3 / R / N RMG 24 11506 3 / R / N Rem 25 fl five @
Hotmail.com 3 / R / N 224 25 / R / N R / N R / N R / N 224 25 / R / N R / N 224 25 / R / N R / N 224 25 / R / N R / N 224 25 / R / N R / N 224 25 / R / N R / N 224 3 / R / N R / N RMG 25 3 / R / N 224 25 / R / N 225 User is not in group Rem 26 fl six@hotmail.com 3 / r / n 225 26 / r / N 229 group name too long adg ADG 27 ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 0 / R / N 229 27 / R / N maximum 60230 can not delete group 0 RMG RMG 28 0 / R / N 230 28 / R / N 300 missing necessary parameter 302 has not been logged in 500 Server internal error 540 Verification Answer error 600 server busy 707 Unable to establish a connection 910 server busy 911 authentication failed? In the past MSN Messenger version (MSNP8 or less), simply use the MD5 and other Hash algorithms to authenticate the user identity. MSNP9 / MSNP10 uses a TWN (Twener) authentication method, connected to login.passport.com and loginnet.passport.com and Loginnet.passport.com and other servers, enters account and password by means of the HTTP protocol. A coupon. The true identity authentication occurs between the client and the notification server (NS). When the client logs in NS, the version information is first exchanged. Both parties support MSNP8 or above to perform an authentication process. If the client version is low, TWN is not supported? The server will take you with your foot, let me know? Ok, talk less, now take a successful example of the example. In the example below, the account is "eXample@passport.com", the password is "password".
Ver 4 MSNP10 MSNP9 CVR0 / R / N Ver 4 MSNP9 CVR0 / R / N CVR 5 0x0804 Winnt 5.0 i386 MSNMSGR 6.1.0203 msmsgs Example@passport.com / R / N CVR 5 6.0.0502 6.0.0602 5.0.0527 http: //download.microsoft.com/download/d/4/f/d4f560d5-6dc6-4901-b149-a568415561d7/setupnt.exe http://mesenger.msn.com/cn / r / n usr 6 TWN I Example @ Passport.com / R / N USR 6 TWN SLC = 1033, ID = 507, TW = 40, FS = 1, Ru = HTTP% 3A% 2F% 2FMessenger% 2EMSN% 2 ECOM, CT = 1073355862, KPP = 1, KV = 5, ver = 2.1.0173.1, tpf = ed1c2f217a21c191c61251eb8b73bb60 / r / n (at this time authentication over SSL, obtained "tickets") USR 7 TWN S t = 4m1wWfEupDgUNb53qys5gJdw8OTJEtT82fcuDbS3U672gTymOOs6cgKeafj7WjgZNcufAQggxqHRRXko02DoflZA $$ & p = 4QXNnX9rFDDgki9ZqvqPZGDGJa2Mrd5H13Zfl0NNjh4I78qPyfpzmkZPZEe0nxJTkzZSNDYtk! 57cVqiYVfO86KgCRYWhi2kudS0M! 7bdi82EDA1FYp3WboHD! sCQ17OZh7lPQI7fozrgsSMZwgSzRi2FNTPxf13oDNIfDCKCG! 2Gudvzkepk78a $$ / r / n usr 7 ok eXample@passport.com Example@passport.com 1 0 / r / n first round (TRID = 4), the two parties negotiated MSN version number. The client says "I can support MSNP9 and MSNP10", NS say "line, on MSNP9". Second round (Trid = 5), client reports this unit: OS = Windows 2000 (NT 5.0), Language = Simplified Chinese, MSN Mesn Messenger version = 6.1.0203, account = example@passport.com. Ns gives the recommended version number, the oldest version number, the new version of the download, the official website address, etc. Third round (TRID = 6), the client requires identity authentication (i = initial), and NS gives a long string information required (S = SubSequent). The TPF is equivalent to Challenge, participating in the Hash operation, ensures that the strings returned each time the check is different. The fourth round (Trid = 7), the client exhibits "adapter", NS release (OK) from the authentication server.
Third, between the four rounds, through the SSL authentication process is as follows: First, send a GET request to login.passport.com in the HTTPS port 443, send the account, password, and a long string information given by NS, Get /Login 2.SRF HTTP / 1.1 / R / N Authorization: Passport1.4 OrgverB = GET, ORGURL = HTTP% 3A% 2F% 2FMessenger% 2EMSN% 2 ECOM, SIGN-IN = EXAMPLE% 40Passport.com, PWD = Password, LC = 1033, ID = 507, TW = 40, FS = 1, Ru = HTTP% 3A% 2F% 2FMessenger% 2EMSN% 2ECOM, CT = 1073355862, KPP = 1, KV = 5, VER = 2.1.0173.1, TPF = ED1C2F217A21C191C61251EB8B73BB60 / R / N HOST : login.passport.com / R / N / R / N is redirected to different URLs.