silverhand
سه شنبه 04 تیر 1387, 21:38 عصر
سلام
شايد براتون جالب باشه كه بدونيد، وقتی كه با دوستتون بوسيله ی ياهو چت می كنيد چه اتفاق هایی روی ميده تا اين عمل انجام بشه يا packet های ياهو مسنجر چطوری بين Client و Server رد و بدل میشن و محتوای اونا چيه !؟
اين پست رو با همين هدف دادم كه كسانی كه علاقه دارن درمورد packetهای ياهو مسنجر بيشتر بدونن، از اين پست استفاده كنن.
چيزهای اوليه رو خودتون می دونيد ولی شايد كسی هم باشه كه ندونه! پس ميگم...
پروتكل Yahoo! Messenger يك Application Layer هست كه در اكثر زمان بروی TCP فعال هستش، مگر اينكه خود كاربر و يا دقيق تر بگم، چتر تنظبم كنه كه بروی UDP فعاليت كنه.
البته بروی HTTP هم فعال هست و ارسال و دريافت داره، چطوری !؟ <~ شايد اين اگهی های زير Messenger يا جاهای ديگه شما رو اذيت كرده باشه !!
--- Y!_MSNGR_ads_remover.bat ---
کد:
@ECHO OFF
TITLE Remove ads from Yahoo Messenger 8
> %TEMP%.\noYMads.reg ECHO REGEDIT4
>>%TEMP%.\noYMads.reg ECHO.
>>%TEMP%.\noYMads.reg ECHO [HKEY_CURRENT_USER\Software\Yahoo\Pager\YUrl]
>>%TEMP%.\noYMads.reg ECHO "Messenger Ad"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Upload Ad"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad Big"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad Medium"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Change Room Banner"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Conf Adurl"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Chat Adurl"="NULL"
REGEDIT /S %TEMP%.\noYMads.reg
DEL %TEMP%.\noYMads.reg
ATTRIB -R "%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"
ECHO "NULL" >"%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"
ATTRIB +R "%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"
--- EOF ---
حالا درمورد packetهای Yahoo! Messenger، كه همون بسته های اطلاعاتی هستند كه به Server ارسال می شه و server هم از اونور، (البته بستگی به نوع درخواست داره) به يك Client ديگه ميفرسته...
شكل مجازي از اين packet بصورت زير هست :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/YMSG-packet.gif
از بالا سمت چپ :
YMSG: يك مقدار 4byte هست كه دارای يك رشته ی ثابت هست و در همه نوع packetها تغيير نمیكنه. اون رشته YMSG هست. كه برای معرفی packet به سرور استفاده میشه (منم! از مسنجر، مسيج دارم...).
Version: همون وژن Messenger هست، كه دارای مقدار 4byte هست. مثلا : 0x09 0x00 0x00 0x00 . (حتما بايد فضای 4byteی نوشته بشه، با null-byte ).
pkt_len: مخفف Packet Length هست به معنی طول بسته، همينطور كه از اسمش پيداست مقدار طول رشته ی packet رو در بر داره. مقدار فضای 2byte هم بهش اختصاص دهد شده.
سطر بعدی، از چپ :
Service : (بدلبل كمبود جا، شما Serv می بينيد (در عكس)) اينجا opcode قرار می گيره كه به client/server ميگه، چه سرويسی درخواست میشه. مثلا YAHOO_SERVICE_LOGOFF. فقط يادتون باشه كه به هركدوم از سرويس های Yahoo! Messenger يك مقدار مشخص داده شده مثلا برای YAHOO_SERVICE_LOGON مقدار 0x01 تعيين شده.
Status: اونی كه میزاري : pm bedi ignore mishi, busssyyyy badjoor… ،همونه... . وضيعت سرويس درخواست شده رو هم نشون می ده...كه برای درخواست سرويس مقدارش 0 هست.
در اكثر packetها مثل فرستادن پيام و ... مقدار قسمت status، 0 هست. چون قبلا با تغيير status برای clientهای buddylist فرستاده شده، اين امر برای Custom Status صدق ميكنه.
Session_id: از اين قسمت زمانیهست كه از HTTP id proxy استفاده بشه، البته مقدار فضاش بايد پر بشه كه خود مسنجر از null-byte استفاده می كنه كه بروی connection اثری نداره... وقتی اولين packet به server ارسال میشه مقدارش 0 هست و در جواب، server مقداری برای شما (بهمراه چيز های ديگر كه بستگی به درخواستتون داره) می فرسته
كه در packet بعدی از اون بايد استفاده بشه. ممكن هست چندين بار id، HTTP PROXY شما عوض بشه، كه برای مسايل امنيتی Yahoo! هست...
DATA : يك رشته كه مقدار طولش (فضاش) برابر مقداری هست كه تو pkt_len تعيين شده و شامل: پيام، سرويس درخواستی، تعيين Custom Status و ... هست.
درون DATA كاراكترها بصورت numeric بايد باشند ، مثلا:
کد:
1 = 0x31 , 2 = 0x32 => 21 = 0x3231
و اين رو هم بدونيد كه 0x32 0x31 بصورت 0x3231 خلاصه می شوند كه نشان از آن است كه اين دو باهم يك رقم، كلمه و ... رو می سازند :
کد:
2121 => 0x32313231
salam , khoobi ? => 0x73616c616d 0x2c 0x6b686f6f6269 0x3f
packetهایی كه برای فرستادن يك پيام (PM) به server ارسال میشه بصورت زير است :
- اطلاعاتی كه نشون می ده طرف مقابل در حال type كردن است :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/typing1_pkt.gif
- پيامی كه بايد ارسال شود :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/msg_pkt.GIF
- حالا بايد نشان دهيم كه type كردن قطع شده است :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/typing0_pkt.GIF
*بايد بگم كه در اين ميان يك سری packet از سرور به client می رسه كه ازتون اطلاعاتی مثل : id خودتون، id مخاطب و ...رو سوال می كنه يا حتی ميگه كه شما برای مخاطبتون ignore هستيد يا نه و از اين قبيل.كه خود Yahoo! Messenger بصورت خودكار جواب اونها رو میده.
چگونگی رد و بدل شدن اين packetها هم سخت نيست :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/pkt_con.gif
در تمامی سرويس های Y! Messenger بغير ازYAHOO_SERVICE_P2PFILEXFER كه با فلشهای قرمز نشون داده شده، همه ی packetها از فرستنده به سرور و از سرور به گيرنده ارسال ميشه.
P2PFILEXFER * يك سرويس برای فرستادن فايل بدون واسطه ی سرور (يعنی ازClient به Client) است.
45تا از سرويس های شناخته شده بعلاوه ی opcode آنها :
کد:
YAHOO_SERVICE_LOGON = 0x01
YAHOO_SERVICE_LOGOFF
YAHOO_SERVICE_ISAWAY
YAHOO_SERVICE_ISBACK
YAHOO_SERVICE_IDLE = 0x05
YAHOO_SERVICE_MESSAGE = 0x06
YAHOO_SERVICE_IDACT
YAHOO_SERVICE_IDDEACT
YAHOO_SERVICE_MAILSTAT
YAHOO_SERVICE_USERSTAT = 0x0a
YAHOO_SERVICE_NEWMAIL
YAHOO_SERVICE_CHATINVITE
YAHOO_SERVICE_CALENDAR
YAHOO_SERVICE_NEWPERSONALMAIL
YAHOO_SERVICE_NEWCONTACT = 0x0f
YAHOO_SERVICE_ADDIDENT = 0x10
YAHOO_SERVICE_ADDIGNORE
YAHOO_SERVICE_PING
YAHOO_SERVICE_GROUPRENAME
YAHOO_SERVICE_SYSMESSAGE = 0x14
YAHOO_SERVICE_PASSTHROUGH2 = 0x16
YAHOO_SERVICE_CONFINVITE = 0x18
YAHOO_SERVICE_CONFLOGON
YAHOO_SERVICE_CONFDECLINE = 0x1a
YAHOO_SERVICE_CONFLOGOFF
YAHOO_SERVICE_CONFADDINVITE
YAHOO_SERVICE_CONFMSG
YAHOO_SERVICE_CHATLOGON
YAHOO_SERVICE_CHATLOGOFF = 0x1f
YAHOO_SERVICE_CHATMSG = 0x20
YAHOO_SERVICE_GAMELOGON = 0x28
YAHOO_SERVICE_GAMELOGOFF
YAHOO_SERVICE_GAMEMSG = 0x2a
YAHOO_SERVICE_FILETRANSFER = 0x46
YAHOO_SERVICE_VOICECHAT = 0x4a
YAHOO_SERVICE_NOTIFY = 0x4b
YAHOO_SERVICE_P2PFILEXFER = 0x4d
YAHOO_SERVICE_PEERTOPEER = 0x4f
YAHOO_SERVICE_AUTHRESP = 0x54
YAHOO_SERVICE_LIST = 0x55
YAHOO_SERVICE_AUTH = 0x57
YAHOO_SERVICE_ADDBUDDY = 0x83
YAHOO_SERVICE_REMBUDDY = 0x84
YAHOO_SERVICE_IGNORECONTACT = 0x85
YAHOO_SERVICE_REJECTCONTACT = 0x86
اينم statusها با opcodeهاشون(البته اونایی كه شناخته شده) :
کد:
YAHOO_STATUS_AVAILABLE = 0
YAHOO_STATUS_BRB
YAHOO_STATUS_BUSY
YAHOO_STATUS_NOTATHOME
YAHOO_STATUS_NOTATDESK
YAHOO_STATUS_NOTINOFFICE = 5
YAHOO_STATUS_ONPHONE
YAHOO_STATUS_ONVACATION
YAHOO_STATUS_OUTTOLUNCH
YAHOO_STATUS_STEPPEDOUT = 9
YAHOO_STATUS_INVISIBLE = 12
YAHOO_STATUS_CUSTOM = 99
YAHOO_STATUS_IDLE = 999
YAHOO_STATUS_OFFLINE = 0x5a55aa56
YAHOO_STATUS_TYPING = 0x16
موفق باشيد
شايد براتون جالب باشه كه بدونيد، وقتی كه با دوستتون بوسيله ی ياهو چت می كنيد چه اتفاق هایی روی ميده تا اين عمل انجام بشه يا packet های ياهو مسنجر چطوری بين Client و Server رد و بدل میشن و محتوای اونا چيه !؟
اين پست رو با همين هدف دادم كه كسانی كه علاقه دارن درمورد packetهای ياهو مسنجر بيشتر بدونن، از اين پست استفاده كنن.
چيزهای اوليه رو خودتون می دونيد ولی شايد كسی هم باشه كه ندونه! پس ميگم...
پروتكل Yahoo! Messenger يك Application Layer هست كه در اكثر زمان بروی TCP فعال هستش، مگر اينكه خود كاربر و يا دقيق تر بگم، چتر تنظبم كنه كه بروی UDP فعاليت كنه.
البته بروی HTTP هم فعال هست و ارسال و دريافت داره، چطوری !؟ <~ شايد اين اگهی های زير Messenger يا جاهای ديگه شما رو اذيت كرده باشه !!
--- Y!_MSNGR_ads_remover.bat ---
کد:
@ECHO OFF
TITLE Remove ads from Yahoo Messenger 8
> %TEMP%.\noYMads.reg ECHO REGEDIT4
>>%TEMP%.\noYMads.reg ECHO.
>>%TEMP%.\noYMads.reg ECHO [HKEY_CURRENT_USER\Software\Yahoo\Pager\YUrl]
>>%TEMP%.\noYMads.reg ECHO "Messenger Ad"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Upload Ad"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad Big"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad Medium"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Change Room Banner"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Conf Adurl"="NULL"
>>%TEMP%.\noYMads.reg ECHO "Chat Adurl"="NULL"
REGEDIT /S %TEMP%.\noYMads.reg
DEL %TEMP%.\noYMads.reg
ATTRIB -R "%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"
ECHO "NULL" >"%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"
ATTRIB +R "%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"
--- EOF ---
حالا درمورد packetهای Yahoo! Messenger، كه همون بسته های اطلاعاتی هستند كه به Server ارسال می شه و server هم از اونور، (البته بستگی به نوع درخواست داره) به يك Client ديگه ميفرسته...
شكل مجازي از اين packet بصورت زير هست :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/YMSG-packet.gif
از بالا سمت چپ :
YMSG: يك مقدار 4byte هست كه دارای يك رشته ی ثابت هست و در همه نوع packetها تغيير نمیكنه. اون رشته YMSG هست. كه برای معرفی packet به سرور استفاده میشه (منم! از مسنجر، مسيج دارم...).
Version: همون وژن Messenger هست، كه دارای مقدار 4byte هست. مثلا : 0x09 0x00 0x00 0x00 . (حتما بايد فضای 4byteی نوشته بشه، با null-byte ).
pkt_len: مخفف Packet Length هست به معنی طول بسته، همينطور كه از اسمش پيداست مقدار طول رشته ی packet رو در بر داره. مقدار فضای 2byte هم بهش اختصاص دهد شده.
سطر بعدی، از چپ :
Service : (بدلبل كمبود جا، شما Serv می بينيد (در عكس)) اينجا opcode قرار می گيره كه به client/server ميگه، چه سرويسی درخواست میشه. مثلا YAHOO_SERVICE_LOGOFF. فقط يادتون باشه كه به هركدوم از سرويس های Yahoo! Messenger يك مقدار مشخص داده شده مثلا برای YAHOO_SERVICE_LOGON مقدار 0x01 تعيين شده.
Status: اونی كه میزاري : pm bedi ignore mishi, busssyyyy badjoor… ،همونه... . وضيعت سرويس درخواست شده رو هم نشون می ده...كه برای درخواست سرويس مقدارش 0 هست.
در اكثر packetها مثل فرستادن پيام و ... مقدار قسمت status، 0 هست. چون قبلا با تغيير status برای clientهای buddylist فرستاده شده، اين امر برای Custom Status صدق ميكنه.
Session_id: از اين قسمت زمانیهست كه از HTTP id proxy استفاده بشه، البته مقدار فضاش بايد پر بشه كه خود مسنجر از null-byte استفاده می كنه كه بروی connection اثری نداره... وقتی اولين packet به server ارسال میشه مقدارش 0 هست و در جواب، server مقداری برای شما (بهمراه چيز های ديگر كه بستگی به درخواستتون داره) می فرسته
كه در packet بعدی از اون بايد استفاده بشه. ممكن هست چندين بار id، HTTP PROXY شما عوض بشه، كه برای مسايل امنيتی Yahoo! هست...
DATA : يك رشته كه مقدار طولش (فضاش) برابر مقداری هست كه تو pkt_len تعيين شده و شامل: پيام، سرويس درخواستی، تعيين Custom Status و ... هست.
درون DATA كاراكترها بصورت numeric بايد باشند ، مثلا:
کد:
1 = 0x31 , 2 = 0x32 => 21 = 0x3231
و اين رو هم بدونيد كه 0x32 0x31 بصورت 0x3231 خلاصه می شوند كه نشان از آن است كه اين دو باهم يك رقم، كلمه و ... رو می سازند :
کد:
2121 => 0x32313231
salam , khoobi ? => 0x73616c616d 0x2c 0x6b686f6f6269 0x3f
packetهایی كه برای فرستادن يك پيام (PM) به server ارسال میشه بصورت زير است :
- اطلاعاتی كه نشون می ده طرف مقابل در حال type كردن است :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/typing1_pkt.gif
- پيامی كه بايد ارسال شود :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/msg_pkt.GIF
- حالا بايد نشان دهيم كه type كردن قطع شده است :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/typing0_pkt.GIF
*بايد بگم كه در اين ميان يك سری packet از سرور به client می رسه كه ازتون اطلاعاتی مثل : id خودتون، id مخاطب و ...رو سوال می كنه يا حتی ميگه كه شما برای مخاطبتون ignore هستيد يا نه و از اين قبيل.كه خود Yahoo! Messenger بصورت خودكار جواب اونها رو میده.
چگونگی رد و بدل شدن اين packetها هم سخت نيست :
http://mfoxihst.persiangig.com/image/Y%21_Protocol/pkt_con.gif
در تمامی سرويس های Y! Messenger بغير ازYAHOO_SERVICE_P2PFILEXFER كه با فلشهای قرمز نشون داده شده، همه ی packetها از فرستنده به سرور و از سرور به گيرنده ارسال ميشه.
P2PFILEXFER * يك سرويس برای فرستادن فايل بدون واسطه ی سرور (يعنی ازClient به Client) است.
45تا از سرويس های شناخته شده بعلاوه ی opcode آنها :
کد:
YAHOO_SERVICE_LOGON = 0x01
YAHOO_SERVICE_LOGOFF
YAHOO_SERVICE_ISAWAY
YAHOO_SERVICE_ISBACK
YAHOO_SERVICE_IDLE = 0x05
YAHOO_SERVICE_MESSAGE = 0x06
YAHOO_SERVICE_IDACT
YAHOO_SERVICE_IDDEACT
YAHOO_SERVICE_MAILSTAT
YAHOO_SERVICE_USERSTAT = 0x0a
YAHOO_SERVICE_NEWMAIL
YAHOO_SERVICE_CHATINVITE
YAHOO_SERVICE_CALENDAR
YAHOO_SERVICE_NEWPERSONALMAIL
YAHOO_SERVICE_NEWCONTACT = 0x0f
YAHOO_SERVICE_ADDIDENT = 0x10
YAHOO_SERVICE_ADDIGNORE
YAHOO_SERVICE_PING
YAHOO_SERVICE_GROUPRENAME
YAHOO_SERVICE_SYSMESSAGE = 0x14
YAHOO_SERVICE_PASSTHROUGH2 = 0x16
YAHOO_SERVICE_CONFINVITE = 0x18
YAHOO_SERVICE_CONFLOGON
YAHOO_SERVICE_CONFDECLINE = 0x1a
YAHOO_SERVICE_CONFLOGOFF
YAHOO_SERVICE_CONFADDINVITE
YAHOO_SERVICE_CONFMSG
YAHOO_SERVICE_CHATLOGON
YAHOO_SERVICE_CHATLOGOFF = 0x1f
YAHOO_SERVICE_CHATMSG = 0x20
YAHOO_SERVICE_GAMELOGON = 0x28
YAHOO_SERVICE_GAMELOGOFF
YAHOO_SERVICE_GAMEMSG = 0x2a
YAHOO_SERVICE_FILETRANSFER = 0x46
YAHOO_SERVICE_VOICECHAT = 0x4a
YAHOO_SERVICE_NOTIFY = 0x4b
YAHOO_SERVICE_P2PFILEXFER = 0x4d
YAHOO_SERVICE_PEERTOPEER = 0x4f
YAHOO_SERVICE_AUTHRESP = 0x54
YAHOO_SERVICE_LIST = 0x55
YAHOO_SERVICE_AUTH = 0x57
YAHOO_SERVICE_ADDBUDDY = 0x83
YAHOO_SERVICE_REMBUDDY = 0x84
YAHOO_SERVICE_IGNORECONTACT = 0x85
YAHOO_SERVICE_REJECTCONTACT = 0x86
اينم statusها با opcodeهاشون(البته اونایی كه شناخته شده) :
کد:
YAHOO_STATUS_AVAILABLE = 0
YAHOO_STATUS_BRB
YAHOO_STATUS_BUSY
YAHOO_STATUS_NOTATHOME
YAHOO_STATUS_NOTATDESK
YAHOO_STATUS_NOTINOFFICE = 5
YAHOO_STATUS_ONPHONE
YAHOO_STATUS_ONVACATION
YAHOO_STATUS_OUTTOLUNCH
YAHOO_STATUS_STEPPEDOUT = 9
YAHOO_STATUS_INVISIBLE = 12
YAHOO_STATUS_CUSTOM = 99
YAHOO_STATUS_IDLE = 999
YAHOO_STATUS_OFFLINE = 0x5a55aa56
YAHOO_STATUS_TYPING = 0x16
موفق باشيد