Yahoo Chat Room Socket Connection

By evil-critter on Sep 05, 2012

This is from the script I use in yahoo rooms for a game/joke bot.
This snippet will allow you to chat in a yahoo room, rooms list, & captcha window.
this is very bare bones but it works.
copy the script paste it into a new 'remotes' file in mIRC
save it
right click on the status screen in mirc, click on sign into yahoo.
Enter your name and pass and the scriptsshould do the rest.
Have fun :-)

menu status {
  Sign Into Yahoo:/dialog -m ymchat ymchat
  Yahoo Rooms List:/dialog -m yrooms yrooms
  Visible Check:/dialog -m yvisible yvisible 
}
dialog YMChat {
  title "Yahoo Chat"
  size -1 -1 236 103
  option pixels notheme
  edit "", 1, 7 21 212 20, autohs
  edit "", 2, 7 49 212 20, pass autohs
  button "Button", 3, 147 74 65 25, default
  text "Yahoo Username - Password", 4, 7 3 212 17, center
}
on *:dialog:ymchat:sclick:3: { 
  if ($did(ymchat,1) && $did(ymchat,2)) { ymchat $did(ymchat,1) $did(ymchat,2) }
}

;============================================================================================
alias -l ymchat {
  %ycookie = $+(GET /config/login?login=,$1,&passwd=,$2,$chr(32),HTTP/1.0,$crlf,Host: login.yahoo.com,$crlf,Accept: text/html,$crlf,$crlf)
  sockopen ynt_cookie login.yahoo.com 80
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
on *:sockopen:ynt_cookie: sockwrite ynt_cookie %ycookie
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
on *:sockread:ynt_cookie: {
  var %ysl
  if ($sockerr > 0) return
  sockread -f %ysl
  if ($len(%ysl) = 0) { %ysl = Null }
  if (HTTP/1.1 200 OK isin %ysl) { sockclose $sockname | echo -a Login Error, Incorrect Name Or Pass. | halt }
  if (Set-Cookie: isin %ysl) && (Y=v= isin %ysl) { %ya_y = $remove(%ysl,path=/; domain=.yahoo.com,Set-Cookie:,$cr,$lf,$chr(32)) }
  if (Set-Cookie: isin %ysl) && (T=z= isin %ysl) { %ya_t = $remove(%ysl,path=/; domain=.yahoo.com,Set-Cookie:,$cr,$lf,$chr(32)) }
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
on *:sockclose:ynt_cookie: { 
  %ya_nik = $gettok($gettok(%ycookie,1,38),2,61)
  chitty 
  set %li_cookie %ya_y $+ $chr(32) $+ %ya_T
  unset %ycookie , %ya_y , %ya_t , %canswer
}
;============================================================================================
alias -l rtntok { var %test = $remove($bvar(&ysl,1-).text,) | return $gettok(%test,$calc($findtok(%test,$wildtok(%test,* $+ $1 $+ *,1,192),1,192) + 1),192) }
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l yahoo.size { var %a = $gettok($calc($len($1-) / 256),1,46) , %b = $calc($len($1-) - $calc(%a * 256)) | return %a %b }
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l spc {
  var %spc = $1- , %stp.spc = 1 , %spc.em
  while (%stp.spc <= $len(%spc)) {
    %spc.em = %spc.em $asc($mid(%spc,%stp.spc,1))
    inc %stp.spc
  }
  return %spc.em
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l chitty {
  if ($sock(yah_chat)) { sockclose yah_chat } 
  sockopen yah_chat 67.195.187. $+ $rand(192,254) 5050
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
on *:sockopen:yah_chat: { logpck }
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l logpck {
  %ya_nick = $decode_l($gettok($gettok(%li_cookie,1,47),5,61))
  var %ypack = $+(0À,%ya_nick,À2À,%ya_nick,À1À,%ya_nick,À244À0À6À,%li_cookie,À98ÀusÀ)
  bset &packt 1 Y M S G 0 19 0 $chr(1) $yahoo.size(%ypack) $chr(2) $chr(38) 0 0 0 0 0 0 0 0 $spc(%ypack)
  sockwrite yah_chat &packt
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
on *:sockread:yah_chat: {
  if ($sockerr > 0) return | sockread &ysl | breplace &ysl 0 160
  if ($bvar(&ysl,12) == 1) { echo -s 9,1Logged In To 6Yahoo!9 :) | joinit | halt }
  if ($bvar(&ysl,12) == 150) { prjoin | halt }
  if ($bvar(&ysl,12) == 2) { echo -s 4,1Error Logging Into Yahoo! :( | halt }
  if ($bvar(&ysl,12) == 6) { echo -a 4,1 PRVTMSG-FROM: $rtntok(4) $rtntok(14) }
  if ($bvar(&ysl,12) == 84) { echo 7 Yahoo Connection Closed. $rtntok(66) | halt }
  if ($bvar(&ysl,12) == 152) { 
    $d.nick($bvar(&ysl,21-).text) 
    if ($right($rtntok(130),1) == -) { echo -s $remove($rtntok(130),$chr(192),$chr(128)) %ya_nik %y.room $+ :: %y.rm2 }
    halt 
  }
  if ($bvar(&ysl,12) == 85) { 
    set -e %csid $gettok($bvar(&ysl,1,20),18-20,32)
    noop $tip(YChat,Yahoo!,Your Nick Is $rtntok(3)) 
    noop $tip(YChat,Yahoo!,Alias Names $rtntok(89)) 
    halt 
  }
  if ($bvar(&ysl,12) == 168) { rmtxt $rtntok(109) $rtntok(117) | halt }
}
;============================================================================================
alias -l spackets { 
  bset &pack 1 Y M S G 0 19 0 0 $yahoo.sz($2-) 0 $1 0 0 0 0 0 %csid $spc_out($2-) 
  sockwrite -n yah_chat &pack 
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l yahoo.sz { var %a = $gettok($calc($len($1-) / 256),1,46) , %b = $calc($len($1-) - $calc(%a * 256)) | return %a %b }
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l spc_out {
  var %spc = $1- , %stp.spc = 1 , %spc.em
  while (%stp.spc <= $len(%spc)) {
    %spc.em = %spc.em $asc($mid(%spc,%stp.spc,1))
    inc %stp.spc
  }
  return %spc.em
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l y.room return @ $+ $remove(%y.room,$chr(32))
;============================================================================================
alias joinit { 
  if (!%y.room) { dialog -m yrooms yrooms }
  if ($y.room) { /clear @ $+ $y.room | /clear -l @ $+ $y.room } 
  $spackets(150,$+(109À,%ya_nik,À1À,%ya_nik,À6À,$gettok($gettok(%ypack,2,32),1,192),À98ÀusÀ135Àym10.0.0.1270À))
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias prjoin { $spackets(152,$+(1À,%ya_nik,À104À,%y.room,À129À,%y.rm2,À62À2À24À1188648944À)) }
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias yaspk { $spackets(168,$+(1À,%ya_nik,À104À,%y.room,À117À,$1-,À124À1À)) | echo $y.room $1- }
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias ypmsg { $spackets(6,$+(1À,%ya_nik,À5À,$1,À14À,$2-,À97À1À63À;0À64À0À206À2À)) }
;============================================================================================
alias -l d.nick {
  var %d.nicks = $remove($1-,) , %t.nicks = $count(%d.nicks,À) , %n.nicks = 1
  $iif(captcha.chat.yahoo.com/go/captchat isin $rtntok(105),capwin $gettok($rtntok(105),$numtok($rtntok(105),32),32), $add.one) 
  :loop
  while (%n.nicks <= %t.nicks) {
    if ($gettok(%d.nicks,$calc($findtok(%d.nicks,109,%n.nicks,192) + 1),192) !isnum 104) && ($gettok(%d.nicks,$calc($findtok(%d.nicks,109,%n.nicks,192) + 1),192) !isnum 13) { 
      aline -ln $y.room $gettok(%d.nicks,$calc($findtok(%d.nicks,109,%n.nicks,192) + 1),192) 
    }
    inc %n.nicks
  }
  titlebar $y.room People in Room: $line($y.room ,0,1)
}
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l capwin {
  if (! $+ $y.room) { window -el15S $y.room yroompops.txt }
  captcha $1-
}
;============================================================================================
alias -l encode_L { return $replacex($1-,a,0,b,1,c,2,d,3,e,4,f,5,g,6,h,7,i,8,j,9,k,a,l,b,m,c,n,d,o,e,p,f,q,g,r,h,s,i,t,j,u,k,v,l,w,m,x,n,y,o,z,p,0,q,1,r,2,s,3,t,4,u,5,v,6,w,7,x,8,y,9,z) }
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alias -l decode_L { return $replacex($1-,0,a,1,b,2,c,3,d,4,e,5,f,6,g,7,h,8,i,9,j,a,k,b,l,c,m,d,n,e,o,f,p,g,q,h,r,i,s,j,t,k,u,l,v,m,w,n,x,o,y,p,z,q,0,r,1,s,2,t,3,u,4,v,5,w,6,x,7,y,8,z,9) }
;============================================================================================
;--Yahoo Rooms Dialog
;--------------------
alias -l oyrs {
  if ($exists(yrm_cat.yrm)) { .remove yrm_cat.yrm }
  if ($exists(yrm_lst.yrm)) { .remove yrm_lst.yrm }
  sockopen $1 %rm_srvr 80 
}
alias -l yrm_lst return $+(GET /ycontent/?chatroom_,%the.cat,$chr(32),HTTP/1.0,$crlf,Host: au.insider.msg.yahoo.com,$crlf,Accept-Language: en,$crlf,Accept: */*,$crlf,User-Agent: Mozilla/4.0 (compatible; mIRC6.35),$crlf,Cache-Control: no-cache,$crlf,Connection: close,$crlf,$crlf)
alias -l yrm_cat return $+(GET /ycontent/?chatcat,$chr(32),HTTP/1.0,$crlf,Host: au.insider.msg.yahoo.com,$crlf,Accept-Language: en,$crlf,Accept: */*,$crlf,User-Agent: Mozilla/4.0 (compatible; mIRC6.35),$crlf,Cache-Control: no-cache,$crlf,Connection: close,$crlf,$crlf)
on *:sockopen:*yrm_*: {
  if ($sockname == yrm_lst) { sockwrite $sockname $yrm_lst | halt }
  if ($sockname == yrm_cat) { sockwrite $sockname $yrm_cat | halt }
}
on *:sockread:*yrm_*: {
  var %ysl
  if ($sockerr > 0) return 
  sockread -f %ysl 
  if ($sockname == yrm_lst) { 
    if (room type isin %ysl) || (<lobby isin %ysl) { write yrm_lst.yrm $replace($remove(%ysl,<chatRooms>,<room type="yahoo",id=",name=",">,"),users=,Users:,voices=,Mic:,webcams=,Cam:,/>,$chr(32),<lobby count=,$str($chr(160),3),topic=,:) }
  }
  if ($sockname == yrm_cat) { 
    write yrm_cat.yrm %ysl
  }
}
on *:sockclose:yrm_*: {
  if ($sockname = yrm_cat) {
    var %blah = 1
    while (%blah <= $lines(yrm_cat.yrm)) {
      if (B= !isin $gettok($read(yrm_cat.yrm,s,Set-Cookie:),1,32)) { echo -s $gettok($read(yrm_cat.yrm,s,Set-Cookie:),1,32) }
      if (id=" isin $read(yrm_cat.yrm,%blah)) { did -a yrooms 1 $replace($remove($gettok($read(yrm_cat.yrm,%blah),4,34),"),&amp;,&) $remove($gettok($read(yrm_cat.yrm,%blah),2,34),") }
      inc %blah
    }
  }
  if ($sockname = yrm_lst) {
    var %blah = 1
    while (%blah <= $lines(yrm_lst.yrm)) {
      did -a yrooms 2 $read(yrm_lst.yrm,%blah)
      inc %blah
    }
  }
}
dialog yrooms {
  title "Yahoo Rooms"
  size -1 -1 315 284
  option pixels notheme
  list 1, 7 26 150 233
  list 2, 158 26 150 233
  text "Double Click In Window To Make Selections", 3, 40 7 235 17, center
  combo 4, 7 250 150 71, drop edit
  button "Close", 5, 197 256 65 25, ok cancel 
}
on *:dialog:yrooms:init:0: { 
  if (!%rm_srvr) { %rm_srvr = insider.msg.yahoo.com }
  oyrs yrm_cat 
  lst_yrms
}
on *:dialog:yrooms:dclick:*: {
  if ($did == 2) { var %blah = $did(yrooms,2).sel
    while (%blah >= 1) {
      if ($len($left($read(yrm_lst.yrm,%blah),4)) == 4) && ($chr(160) !isin $left($read(yrm_lst.yrm,%blah),4)) { set %y.room $gettok($gettok($did(yrooms,2,%blah),1,58),2-,32) $+ : $+ $remove($gettok($did(yrooms,2).seltext,1,32),$chr(160)) 
        set %y.rm2 $gettok($gettok($did(yrooms,2,%blah),1,58),1,32) 
        prjoin
        halt 
      }
      dec %blah
    }
  }
  if ($did == 1) {
    did -r yrooms 2
    set -u1 %the.cat $gettok($did(yrooms,1).seltext,$numtok($did(yrooms,1).seltext,32),32) 
    oyrs yrm_lst
  }
}
on *:dialog:yrooms:sclick:4: {
  if ($did == 4) { %rm_srvr = $did(yrooms,4,0).text | oyrs yrm_cat }
}
alias -l lst_yrms {
  did -i yrooms 4 0 $gettok(insider.msg.yahoo.com|United States,2,124)
  did -i yrooms 4 1 $gettok(au.insider.msg.yahoo.com|Australia,2,124)
  did -i yrooms 4 2 $gettok(br.insider.msg.yahoo.com|Brasil,2,124)
  did -i yrooms 4 3 $gettok(ca.insider.msg.yahoo.com|Canada,2,124)
  did -i yrooms 4 4 $gettok(de.insider.msg.yahoo.com|Deutschland,2,124)
  did -i yrooms 4 5 $gettok(dk.insider.msg.yahoo.com|Danmark,2,124)
  did -i yrooms 4 6 $gettok(es.insider.msg.yahoo.com|España,2,124)
  did -i yrooms 4 7 $gettok(fr.insider.msg.yahoo.com|France,2,124)
  did -i yrooms 4 8 $gettok(in.insider.msg.yahoo.com|India,2,124)
  did -i yrooms 4 9 $gettok(it.insider.msg.yahoo.com|Italy,2,124)
  did -i yrooms 4 10 $gettok(kr.insider.msg.yahoo.com|Korea,2,124)
  did -i yrooms 4 11 $gettok(mx.insider.msg.yahoo.com|México,2,124)
  did -i yrooms 4 12 $gettok(no.insider.msg.yahoo.com|Norge,2,124)
  did -i yrooms 4 13 $gettok(sg.insider.msg.yahoo.com|Singapore,2,124)
  did -i yrooms 4 14 $gettok(uk.insider.msg.yahoo.com|United Kingdom,2,124)
  did -i yrooms 4 15 $gettok(insider.msg.yahoo.com|United States,2,124)
}
;---------------------------------------------------------------------------
;Captcha-Thing
;---------------------------------------------------------------------------
alias -l captcha {
  if ($exists(captcha.jpg)) { .remove captcha.jpg }
  if ($exists(captcha.tmp)) { .remove captcha.tmp }
  set %cap_url = $1-
  %capt = $remove($gettok($gettok($1-,$calc($numtok($1-,38) - 1) - $numtok($1-,38),38),1,38),img=)
  %capt = / $+ $gettok(%capt,3-,$asc(/))
  sockopen fetcher c5.ah.yahoo.com 80
}
on *:sockopen:fetcher: { sockwrite fetcher $+(GET %capt,$chr(32),HTTP/1.0,$crlf,Host: captcha.chat.yahoo.com,$crlf,Accept: */*,$crlf,User-Agent: Mozilla/4.0 (compatible; YahELite 331) ,$crlf,Cache-Control: no-cache,$crlf,Connection: close,$crlf,Referer: http://c5.ah.yahoo.com,$crlf,$crlf) }
on *:sockclose:fetcher: { recapt | unset %capt }
on *:sockread:fetcher: {
  if ($sockerr > 0) return
  sockread -f &ysl 
  ; echo -a $bvar(&ysl,1-).text
  if ($sockbr == 0) return
  bwrite captcha.tmp -1 -1 &ysl
}
dialog cappic {
  title "cappic"
  size -1 -1 311 146
  option pixels notheme
  icon 1, 5 11 290 80, captcha.jpg, 0
  edit "", 2, 10 104 287 20, result %canswer 
  button "Button", 3, 12 127 282 15 , default
}
alias -l recapt {
  bread captcha.tmp 0 $file(captcha.tmp).size &blah 
  bcopy &ncaptcha.jpg 1 &blah 446 $bvar(&blah,0) 
  bwrite captcha.jpg -1 -1 &ncaptcha.jpg
  if ($dialog(Cappic)) { /dialog -x cappic }
  dialog -m cappic cappic
}
on *:dialog:cappic:sclick:3: { 
  set -u10 %canswer $did(cappic,2).text 
  if ($sock(send_cap_qs)) { sockclose send_cap_qs }
  send_cap_qs 
}
alias -l cap_url {
  var %ctx , %cdata , %class , %audio , %curl , %capt
  %capt = /img/ $+ $gettok($gettok(%cap_url,$numtok(%cap_url,47),47),1,38)
  if ($matchtok($1-,userctx=,1,38)) { %ctx = $ifmatch }
  if ($matchtok($1-,captchaCdata=,1,38)) { %cdata = $ifmatch }
  if ($matchtok($1-,captchaClassInfo=,1,38)) { %class = $ifmatch }
  if ($matchtok($1-,captchaAudioUrl=,1,38)) { %audio = $ifmatch }
  %curl = $+(question=http://c5.ah.yahoo.com:80,%capt,&captchaType=ClassicCaptcha&.intl=us&.lang=en-us&,%ctx,&,%cdata,&,%class,&captchaView=visual&,%audio,&answer=,%canswer,) 
  return %curl
}
alias -l cap_post return $+(POST /captcha1,$chr(32),HTTP/1.0,$crlf,Host: captcha.chat.yahoo.com,$crlf,Accept-Language: en,$crlf,Accept: */*,$crlf,User-Agent: Mozilla/4.0 (compatible; YahELite 331),$crlf,Cache-Control: no-cache,$crlf,Connection: close,$crlf,Referer: Http://captcha.chat.yahoo.com/go/captchat/,$crlf,Content-Type: application/x-www-form-urlencoded,$crlf,Content-Length: ,$len($cap_url(%cap_url)),$crlf,$crlf)
alias -l cap_quest return $cap_url(%cap_url)
alias send_cap_qs { sockopen send_cap_qs captcha.chat.yahoo.com 80 }
on *:sockopen:send_cap_qs: {
  echo -s $sockname Opened.
  sockwrite $sockname $cap_post  
  sockwrite send_cap_qs  $cap_url(%cap_url)
}
on *:sockread:send_cap_qs: {
  var %ysl
  if ($sockerr > 0) return
  sockread -f %ysl 
  if ($sockbr == 0) return
}
;============================================================================================
alias -l rmtxt {
  var %chatr = $1 
  var %chatrtxt = $striptags($2-)
  %chatrtxt = $remove($ytom(%chatrtxt),$chr(27))
  if ($read(iggyville.txt,w,%chatr)) { halt } 
  aline -p $y.room $timestamp $+ - %chatr $+ : %chatrtxt
}
;============================================================================================
alias -l striphex { var %z,%a = $regsub($1-,/[/[/#0-9A-Fa-fm]{9}/g,$null,%z) | return %z }
alias -l striptags { var %x,%y = $regsub($1-,/<[^>]+>/g,$null,%x) | return $striphex(%x) }
alias -l ytom { return $replace($1-,[1m,,[2m,,[4m,,[30m,1,[31m,12,[32m,11,[33m,15,[34m,3,[35m,13,[36m,6,[37m,7,[38m,4,[39m,10) }
alias -l add.one {
  echo $y.room 1,11Joined $rtntok(109)
  titlebar $y.room People in Room: $+ $line($y.room ,0,1)
}
;============================================================================================
on *:INPUT:@:{
  if (/* !iswm $1) {  
    ; if ($left($1,1) != /) { return }
    yaspk $1- 
  }

Comments

Sign in to comment.
raccoon   -  Nov 19, 2012

Looks like a lot of nice work. I'm going to test this one tomorrow. Though, it appears the bottom of the script might be cut off... at least a closing } anyway.

 Respond  
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.