Yahoo Chat Socket Connection YMSG 102

By evil-critter on Dec 25, 2009

Here's the begining to a nice yahoo script if anyone is interested.
Made by me, with the help of a lot of yahoo sites, forums.
This is the YMSG 102 protocol, with the 'magic' log in.
To use it paste it into a new remotes file, name it anything you want.
close remotes, and in the mirc command line type /gochat.
It should ask for a yahoo nickname and password.
(the password box is plain text just fyi, change it if you like.)
Once those are filled in it sends the name an pass to yahoo through http socket.
If sucesful yahoo responds with 4 or 5 cokies, you need 2 of them for logging into yahoo chat, and one of those 2 for entering a room, (using this 102 method only, this is the 'magic' part, once you have gotten your cookies if you keep them accesebile you can relog into yahoo without fetching cookies or any other thing, thanks for this to makers of YSupra Client and Yahelite forums).
I tried to make this simple to use for ppl to figure out 'how' to log into yaho and enter rooms as well as see and send room text, room enters, and room leaves, send text to a room using
/gochat <-starts it all
I'm getting ridiculously addicted to making this.
this is the last time im updating this snippet unless there is a problem found in it.
I just added /aline and /dline for the nick list, there are tokens in the nick info i dont fully understand so i left them all showing in the list.
Ive tested this a few times and have no error msg's at all, very clean on my pc.
/prejn <--once you have cookies this will begin room join if it didnt happen automatically.
/talk text to send <--to speak into a room
there are some prompts as you login, and I added alot of comments hoping something there might help ppl trying to build anything from this.
I added an alias at the bottom of the script to remove cookies and password if you are the paranoid type use--> /clean

I've posted another snippet for a yahoo room list 'grabber', if you need help finding room id's, it may help.
I'm a n00b at this stuff, so dont be afraid to laugh i need to know what im doing wrong.
hope it works for ya, enjoy :)

I revamped it a little bit now it has a custom window for the room and a list of the names, ive yet to fix the list to show who has entered or left, otherwise this is 100% working to best of my knowledge. I am the only tester, so please try it out an tell me how it works so i can make it work for everyone.

;===========================================GRAB COOKIES NON SSL===========================================
;=== /gochat ===|This checks for yahoo nick and pass , if none found it asks for them.|
;=== It sends your name and password to, port 80 yahoo responds with the cookies you need to log into chat.
alias gochat {
  if (! = $?="Yahoo Nick Name" 
  if (! = $?="Yahoo Password" 
  echo -s Attempting to retrieve yahoo cookies.
  sockopen ycookie 80
alias -l ycookie return  $+(POST /config/login?login=,,&amp;passwd=,,$chr(32),HTTP/1.0,$crlf,Host:,$crlf,Accept: text/html,$crlf,$crlf)
on *:sockclose:*: {
  if ($sockname == ycookie) { .timer 1 1 ychat }
  echo -s $sockname 4CLOSED
on *:sockopen:ycookie: sockwrite -e ycookie $ycookie
on *:sockread:ycookie: {
  if ($sockerr > 0) return 
  sockread -f $sock(ysl).rq &ysl 
  var %len $bvar(&ysl,0).text 
  if (Set-Cookie: isin $bvar(&ysl,1,%len).text) var %them $gettok($bvar(&ysl,1,%len).text,3-6,13)
  var 1
  while ( <= $numtok(%them,13)) {
    set %y.cookie $+ $remove($gettok(%them,,13),Set-Cookie: ,$chr(10))
;===========================================Grab Cookies NON SSL End===========================================
;==========================================="Generic\Magic" Chat Login=========================================
:==Type /ychat to begin connecting to yahoo chat server.=-=
;==This method selects a rand server from ( to (
alias ychat sockopen chat_ymsg102 68.180.217. $+ $rand(6,34) 5050 
;==This is the login packet, Thanks sites for Yahelite YSupra and Viprasys site.=-= 
alias -l return $+(0,,2,%Y.ID,1,%Y.ID,24406,$gettok(%y.cookie2,1,32) $gettok(%y.cookie4,1,32),98us)
;=== Here is where the login packet is sorted out and converted to a binary variable, as well as sent to yahoo.=-=
on *:sockopen:chat_ymsg102: {
  bset &head 1 Y M S G 0 102 0 1 $yahoo.size($ $chr(2) 38 0 0 0 0 0 0 0 0
  bwrite &packt 1 -1 &head 
  bwrite &packt -1 -1 $
  bread &packt 1 $calc($len($ + 20) &ysend
  sockwrite chat_ymsg102 &ysend
  .remove &packt 
;===This Sorts out a few packet type , pre join room, join room, text from room, who joined room, who left room.
;===If the incoming packet is other than above mentioned it will echo in red in the status window.
;===The packets are read into $binvar's (binary variables), the 12th bytes are checked for the packet types.
on *:sockread:chat_ymsg102: {
  if ($sockerr > 0) return 
  sockread -f $sock(ysl).rq &ysl 
  breplace &ysl 0 160
  var %len $bvar(&ysl,0).text 
  var = $bvar(&ysl,1,%len).text
  if ($bvar(&ysl,12).text = ñ) { set %y.ssid $bvar(&ysl,18,3).text | echo -s You Are Logged Into Yahoo! Chat. | echo -s TYPE /prejn to enter a yahoo room. | halt }
  if ($bvar(&ysl,12).text = U) { echo -s 12 Your Alias Names: $remove($gettok(,4,192),€) | halt }
  if ($bvar(&ysl,12) = 168) { 
    var %yr.chatr = $remove($gettok(,4,192),€)
    var %yr.chatrtxt = $remove($gettok(,6,192),€)
    disp.txt %yr.chatr $ansi2mirc($striptags(%yr.chatrtxt))
  if ($bvar(&ysl,12) = 155) { disp.txt 14 $+ $remove($gettok(,6,192),€) Left $+ . | /dline -l @ $+ $fline(@ $+,* $+ $remove($gettok(,6,192),€) $+ *,1,1) | halt }
  if ($bvar(&ysl,12) = 152) && ($+( isin { echo -s 15 $remove($gettok(,6,192),€) | halt }
  if ($bvar(&ysl,12) = 152) && ($bvar(&ysl,0) > 200) { $ynick_list( | halt }
  if ($bvar(&ysl,12) = 152) { disp.txt 15 $+ $remove($gettok(,8,192),€) Joined $+ . | aline -l @ $+ $remove($gettok(,8,192),€) | halt }
  if ($bvar(&ysl,12) = 150) { disp.txt 8,1 Preparing To Join Room. | /yjoin | halt }
  echo -s chat_ymsg102: $+ $bvar(&ysl,12) $+ 4 $+ $bvar(&ysl,1,$bvar(&ysl,0).text).text 
;=== $ypack(PacketType,PacketPayload) =-=|Handles sending all your packets to yahoo.It Needs $yahoo.size to work right.|
alias -l yapack {
  bset &head 1 Y M S G 0 102 0 0 $yahoo.size(%y.pack) 0 $1 0 0 0 0 0 
  bwrite &packt 1 -1 &head 
  bwrite &packt -1 -1 %y.ssid 
  bwrite &packt -1 -1 %y.pack
  bread &packt 1 $calc($len(%y.pack) + 20) &ysend
  sockwrite -n chat_ymsg102 &ysend 
  .remove &packt 
  unset %y.pack
alias -l yahoo.size {
  var %a = $gettok($calc($len($1-) / 256),1,46)
  var %b = $calc($len($1-) - $calc(%a * 256))
  return %a %b
;=== /prejn =-=|sends a packet to yahoo saying you're going to join a room *shrug*|
alias prejn {
  if ($window(@ $+ { window -c @ $+ }
  if (! { = $?="Enter Room Name"
    %y.rm2 = $?+"Enter Room ID (Astrology = 1353)" 
  %y.pack = $+(109,,1,,6,$gettok(%y.cookie4,1,32),98us135ym8.1.0.219)
;=== /yjoin =-=|After pre join packet use /yjoin to get captcha code and enter room.|
alias yjoin {
  %y.pack = $+(1À€,,À€104À€,,À€129À€,%y.rm2,À€62À€2À€24À€1188648944À€)
;=== /talk sends this text to room =-=
alias talk {
  var %y.text = $1-
  %y.pack = $+(1À€,,À€104À€,,À€117À€<font INF ID:Orcus PROT:YMSG-102\mIRC VER: $+ $version $+ ></font><font face="Arial Black">[1m[#000000m,%y.text,</font>À€124À€1À€) 
  $disp.txt( $+ : $ansi2mirc(%y.text))
;=== $striptags(TEXT-TO-BE-STRIPPED) =-=|works along with $striphex, these 2 aliases remove font tags and hex colors from incoming yahoo text|
alias -l striptags { var %x,%y = $regsub($1-,/<[^>]+>/g,$null,%x) | return $striphex(%x) } 
alias -l striphex { var %z,%a = $regsub($1-,/[/[/#0-9A-Fa-fm]{9}/g,$null,%z) | return %z }
;=== /clean =-= |removes stored cookies and password|
alias clean { unset %y.cookie* | echo -a Flushed cookies and password. }
alias disp.txt if (!@ $+ { } | aline @ $+ $1-
alias window -el15 @ $+ 
alias ynick_list {
  var %num.nix $numtok($1-,192)
  var %list.nix 1
  var %nix.list $remove($replace($1-,€109,$chr(160)),$gettok($1-,1-6,160))
  while (%list.nix <= %num.nix) {
    var %nix.add $replace($gettok(%nix.list,%list.nix,160),À€,$chr(32))
    if ($len(%nix.add) > 4) && ( !isin %nix.add) { aline -l @ $+ %nix.add }
    inc %list.nix


Sign in to comment.
montague   -  Mar 03, 2011

i got this error when tries to login:

Attempting to retrieve yahoo cookies.

  • String too long: $bvar (line 22, YM Socket Login.txt)
  • ycookie CLOSED

  • /sockwrite: 'chat_ymsg102' not connected (line 42, YM Socket Login.txt)

im using mirc6.31 & mirc6.17

on line 22 the code is: if (Set-Cookie: isin $bvar(&ysl,1,%len).text) var %them $gettok($bvar(&ysl,1,%len).text,3-6,13)

on line 42 the code is: sockwrite chat_ymsg102 &ysend
can anyone help me out?

montague   -  Mar 03, 2011

does it have an update? does anyone have any ym login script.. pls kindly distribute it, tbh.. im addicted with ym

KevKev   -  Dec 28, 2009

This could really make it somewhere, i enjoy mIRC quite well, and making more external stuff to be accessible by mIRC is grande to me :) Maybe a bit more user interfaced, who knows how far it can go?!

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.