Raised This Month: $51 Target: $400
 12% 

MSNChat Connection for mIRC


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
|2ob
Senior Member
Join Date: Mar 2004
Location: Ontario, Canada
Old 06-18-2004 , 20:21   MSNChat Connection for mIRC
Reply With Quote #1

Well.. i made a tutorial because well... this was my life afew years ago, tinkering with things to make it run faster and blah blah.

Main Idea:

You need to open a socket to msn which will be where u send commands such as FINDS to get room ip. To connect to this socket you need to "auth" youself. this involves connecting to the msnchat ocx to send strings of data to send back to the msnserver to "auth" yourself.
Then Send The Command To get the rooms ip.
Use this ip to connect to the room. authing it again using the ocx.
Alter messages to make mirc able to read them.

Note:

This is an old connection, one of my first, and i dont think it works anymore, because of all the MSNChat updates, and how you need to pay now (gay but i have an exploit)

Code:
alias msnconnect {
  unmsnconnect
  ;before u connect you want to make sure all the sockets are closed.
  if (!$hget(conex)) { hmake conex 100 }
  ;this makes a hash table where info will be stored
  ;we need to create a socket to send info to mirc. first find a freeport
  var %mircport $rand(1300,8000)
  while (!$portfree(%mircport)) { var %mircport $rand(1300,8000) }
  ;ok we got a freeport set to %mircport. now listen on this port.
  socklisten start %mircport
  ;were listening on a port. now connect to it.
  server 127.0.0.1 %mircport
  ;ok now we have a to make an event for the socklisten. on*:socklisten:start: ... look down for it. then come back here.
  sockopen msnserver 207.68.167.253 6667
  ;this connects to the msnserver
  authmsnserver
  ;this will be an alias to auth the msnserver socket. look down.
}

alias unmsnconnect {
  ;closes all sockets used in the msn connection
  sockclose msn*
  sockclose mircserver
  sockclose chan*
  sockclose auth*
  sockclose star*
  close -@ @msnchatcontrol
}

on *:socklisten:start:{
  ;the ports been connected to. now accept it
  sockaccept mircserver
  ;its been given a name. mircserver and this is where u sockwrite info u want mirc to show.
  sockclose start
  ;close the socklistening port as its nolonger needed.
  sockwrite -n mircserver :ConeX 001 $me : $+ Connecting
  ;this will show in the status. Connecting. change ConeX to whatever u want. it is what $server will return.
}

alias authmsnserver {
  ;this is to open a connection to the ocx for authing the msnsocket
  var %port = $rand(1111,9999)
  while (!$portfree(%port)) { var %port $rand(1111,9999) }
  ;same format as with the mircserver.
  socklisten msnauth %port
  ;listen on the socket. then open the ocx through nHTMLn.dll
  window -hpk0 @msnchatcontrol
  var %s = $dll($shortfn($scriptdirnHTMLn.dll),attach,$window(@msnchatcontrol).hwnd)
  var %s = $dll($shortfn($scriptdirnHTMLn.dll),select,$window(@msnchatcontrol).hwnd)
  var %s = $dll($shortfn($scriptdirnHTMLn.dll),navigate,about: $+ $&
    <OBJECT ID="ChatFrame" CLASSID="CLSID:ECCDBA05-B58F-4509-AE26-CF47B2FFC3FE"> $+ $&
    <PARAM NAME="RoomName" VALUE="ConeX"> $+ $&
    <PARAM NAME="NickName" VALUE="ConeX"> $+ $&
    <PARAM NAME="Server" VALUE="207.68.167.253: $+ %port $+ "> $+ $&
    </OBJECT>)
  ;now we need the socklisten event.
}

on *:socklisten:msnauth:{
  sockaccept msnocx
  ;msnocx is the name given to the socket connected to the ocx. we need a sockread on this.
  sockclose msnauth
}
on *:sockread:msnocx:{
  .var %read | .sockread %read | .tokenize 32 %read
  ;this allows us to use $1 etc.
  if ($1 == IRCVERS) || ($1 == AUTH) { sockwait msnserver $1- }
  ;sockwait is an alias to check wait for the socket to become active. this is because the msnserver socket takes longer to connect. u forward the msgs to the msnserver to start the auth process. it will return data which will be sent to the ocx. look for the on *:sockread:msnocx below.
  if ($1 == Nick) {
    sockwrite -n msnserver Nick $me
  }
  ;this is to finish the auth process when its asked for. this will trigger alot of raws in the msnserver sockread. look below.
}

on *:sockopen:msnserver:{
  .timerkeep 0 8 sockwrite -n msnserver $crlf
  ;this timer keeps the msnserver open.
}

on *:sockread:msnserver:{
  ;main msnserver sockread
  .var %read | .sockread %read | .tokenize 32 %read
  if ($1 == AUTH) { sockwrite -n msnocx $1- }
  ;this sends to the ocx to get the correct string to send back.
  if ($2 == 376) {
    sockwrite -n mircserver :ConeX 001 $me : $+ Connection Ready
    ;just a message to be seen in status.
    sockclose msnocx
    ;the ocx has done its job and can be closed.
    window -c @msnchatcontrol
    ;the window is nolonger needed so is closed.
    ;WE ARE NOW CONNECTED ( STAGE ONE COMPLETED ) we need to edit the join command in the mircserver sockread. look below for the mircserver sockread.
  }
  elseif ($2 == 613) {
    ;the room has been found. this is part of stage two. this is what triggers the next step.
    hadd conex ip $+ $hget(conex,room) $remove($4,:)
    ;this adds to the hash table the ip that was returned for the room.
    sockwrite -n mircserver :Conex 001 $me : Room Found $hget(conex,room)
    ;this puts a msg in status saying the room was found.
    hadd conex roomid $rand(1111,9999)
    ;this is so we can have multi rooms. each room is assigned an "ID" . this shortens sockets and other things. also there isnt a problem with %# .
    hadd conex $hget(conex,room) $hget(conex,roomid)
    ;asisigns the id to the room
    sockopen room $+ $hget(conex,roomid) $hget(conex,ip $+ $hget(conex,room)) 6667
    ;this connects opening a port with the roomid on the end. this is an example of the roomips use. it connects to the ip that was retrieved in the raw.
    sockmark room $+ $hget(conex,roomid) $hget(conex,room)
    ;marks the socket with the roomname. easy reference later on.
    ;now we need the ocx opened again to auth the rooms socket.
    var %port = $rand(1300,8000)
    while (!$portfree(%port)) { var %port = $rand(1300,8000) }
    hadd conex port $+ $hget(conex,roomid) %port
    ;assigns a freeport to the "rooms ocx". we now connect to the ocx
    window @msnchatcontrol $+ $hget(conex,roomid)
    var %s = $dll($shortfn($scriptdirnHTMLn),attach,$window(@msnchatcontrol $+ $hget(conex,roomid)).hwnd)
    var %s = $dll($shortfn($scriptdirnHTMLn),select,$window(@msnchatcontrol $+ $hget(conex,roomid)).hwnd)
    var %s = $dll($shortfn($scriptdirnHTMLn),navigate,about: $+ $&
      <OBJECT ID="ChatFrame" CLASSID="CLSID:ECCDBA05-B58F-4509-AE26-CF47B2FFC3FE"> $+ $&
      <PARAM NAME="RoomName" VALUE="ConeX"> $+ $&
      <PARAM NAME="NickName" VALUE="ConeX"> $+ $&
      <PARAM NAME="Server" VALUE=" $+ $hget(conex,ip $+ $hget(conex,room)) $+ : $+ $hget(conex,port $+ $hget(conex,roomid)) $+ "> $+ $&
      </OBJECT>)
    socklisten startchan $+ $hget(conex,roomid) $hget(conex,port $+ $hget(conex,roomid))
    ;this is the same as before but the ip is different. its the ip from the raw. now we need a on *:socklisten:startchan*: look down again.
  }
  elseif ($2 == 702) {
    ;if raw 702 is got then the room isnt found. this is where u can have msgs for things such as room creation.
  }
  else sockwrite -n mircserver $1-
  ;for all other msgs send to the mircserver.
}

alias sockwait {
  if ($sock($1)) {
    if ($sock($1).status == active) {
      sockwrite -n $1 $2-
    }
    else { .timer -m 1 20 sockwait $1 $2- }
  }
}
on *:sockread:mircserver:{
  .var %read | .sockread %read | .tokenize 32 %read
  if ($1 == Join) {
    if ($sock(room $+ $hget(conex,$2))) { sockwrite -n room $+ $hget(conex,$2)) Join $2 | return }
    ;if the socket is already open then send the join directly and thats it. else start opening it.
    sockwrite -n msnserver FINDS $2
    ;sends the command to find a room. this will return raw 613 if the room is found.
    hadd conex room $2
    ;we add the roomname to the hash table. this is a reference to later info. just returns room is being connected to later on. im expecting the room is there. so look in the msnserver sockread for raw 613. if it isnt found it is raw 702.
  }
  elseif ($sock(room $+ $hget(conex,$2))) { sockwrite -n room $+ $hget(conex,$2)) $1- }
  elseif ($sock(room $+ $hget(conex,$comchan($2,1)))) { sockwrite -n room $+ $hget(conex,$comchan($2,1))) $1- }
  elseif ($sock(room*,0)) { sockwrite -n room* $1- | halt }
}
on *:socklisten:startchan*:{
  sockaccept chanocx $+ $right($sockname,4)
  ; $right($sockname,4) is the roomid. this allows us to keep sockets grouped. now the sockread for the ocx.
  sockclose $sockname
}

on *:sockread:chanocx*:{
  .var %read | .sockread %read | .tokenize 32 %read
  %read = $replace(%read,gatekeeper,GateKeeperPassport)
  ;this switches from guest mode to passport mode. take it out for guest. however auths will also need to be changed. look at my connection for an example.
  if ($1 = IRCVERS) { sockwait room $+ $right($sockname,4) %read }
  if ($1 = AUTH) && ($4 != :ok) { sockwait room $+ $right($sockname,4) %read }
  ;these two start the auth process. now the room socket is below.
}

on *:sockread:room*: {
  .var %read | .sockread %read | .tokenize 32 %read
  ;THIS IS THE SOCKET WHERE MOST OF YOUR EDITING WILL TAKE PLACE. THIS IS WHERE U ADD PROTECTIONS AND SUCH THINGS. also where u edit info so mirc can understand.
  if ($1 = AUTH) && ($4 != :ok) {
    sockwrite -n chanocx $+ $right($sockname,4) $1-
  }
  ;part of the authprocess. just sends the string to the ocx to get the correct string back.
  if ($1 = AUTH) && ($4 == :ok) {
    sockwrite -n $sockname AUTH GateKeeperPassport S : $+ $base($len(%ticket),10,16,8) $+ %ticket $+ $base($len(%profile),10,16,8) $+ %profile $+ $lf $+ USER $me $me $me : $+ ConeX $+ $lf $+ Nick $me
  }
  ;when u get :ok in the auth string the passport info needs to be sent. the info is stored as %ticket + %profile. if u get raw 910 ure passport info is outdated/incorrect . it need updating.
  if ($2 = 002) { sockwrite -n $sockname JOIN $hget(conex,room) $hget(conex,$hget(conex,room)) | sockclose chanocx $+ $right($sockname,4) | close -@ @msnchatcontrol* }
  ; you will get raw 002 when uve finished the auth aslong as other raws. when we get this we send the join command through the server. and close the auth socket and its window as it is nolonger needed. you now have all you need to join the room. hopefully you have connected. however mirc dont know this. u need to alter the on join command.
  if ($2 == JOIN) {
    sockwrite -n mircserver $1 $2 $4-
    ;this takes out $3 which contains info about sex,profile and away status. an "msn" feature ;\ . mirc should now see people join. more importantly you join.
    if ($gettok($3,4,44)) {
      sockwrite -n mircserver :Server MODE $remove($4,:) + $+ $replace($gettok($3,4,44),.,q,@,o,+,v) $remove($gettok($1,1,33),:)
      ;this sends info like if the person entering was accessed. allows you to see them being +q,o,v etc bt "msn" .
    }
    halt
  }
  if ($2 == 353) {
    .var %i = 5, %n
    while (%i < $numtok($1-,32)) {
      inc %i
      .var %n = %n $gettok($gettok($1-,%i,32),-1,44)
    }
    sockwrite -n mircserver $1-5 : $+ %n
    halt
  }
  if ($2 == PRIVMSG) {
    ;format font codes out so mirc can read it.
    if ($left($4,3) == :S) { sockwrite -n mircserver $1-3 $+(:,$left($6-,$calc($len($6-) -1))) | return }
    elseif ($4 == :VERSION) {
      sockwrite -n $sockname NOTICE $gettok($gettok($1,1,33),1,58) :VERSION Connection Made With CodeX Tutorial By Cypher 
      ;version reply
      return
    }
    elseif ($4 == :Time) {
      sockwrite -n $sockname NOTICE $gettok($gettok($1,1,33),1,58) :Time $date $+ , $time 
      ;time reply
    }
    else { sockwrite -n mircserver $1- | return }
  }
  ;this again sorts the nicks info. takes out profile,away status info out so mirc can read it.
  sockwrite -n mircserver $1-
  ;send everything else to the mircserver.
}
I could shorten it, not sure if i should, since i want you people to understand it, i know mirc sucks (thats why i quit).

Things i might add later:

-Updater. To Update passport info when it gets old
-Auto Connect On Startup . lol not to hard.
-Protections. in the room* sockread.
-Debug Options. After .var %read | .sockread %read | .tokenize 32 %read put echo -s $sockname : $1- . then u can look at this and work out how to add things.
-Room Creation. on raw 702 open a dialog where options to make a room can be made.
-Font Options. on privmsg u want to make it how webchat can read it.
-Reopen Sockets When They Are Closed. Can Be Done With on *:sockclose: . little thought can get you relooking the msnserver socket when it closes.
__________________
24/7 Custom Maps Vitrus | Style by www.WebGZ.net
64.247.24.125:27015

Visit Vitrus's Clan Site!

I would put more, but they have a limit on chars
|2ob is offline
Send a message via AIM to |2ob Send a message via MSN to |2ob
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 06-19-2004 , 11:31  
Reply With Quote #2

D: Ugh... mIRC scripts... Good work, anyhow... I liked it
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
Neo-Vortex
Senior Member
Join Date: Jun 2004
Location: Australia
Old 06-19-2004 , 23:36   hmmm
Reply With Quote #3

*wonders what trick he was using to get around the subinfo crap*...

hmm. i used to script in mIRC for M$N Chat, created M$NChatX (cracked ocx that allowed you to authenticate with the new auth protocol, still works too if you fake the ircvers ), and stuff like that, but yeah, its too inefficent if you want it to do anything usefull...
Neo-Vortex is offline
|2ob
Senior Member
Join Date: Mar 2004
Location: Ontario, Canada
Old 06-19-2004 , 23:45  
Reply With Quote #4

creator of vincula, hello Neo...
__________________
24/7 Custom Maps Vitrus | Style by www.WebGZ.net
64.247.24.125:27015

Visit Vitrus's Clan Site!

I would put more, but they have a limit on chars
|2ob is offline
Send a message via AIM to |2ob Send a message via MSN to |2ob
Neo-Vortex
Senior Member
Join Date: Jun 2004
Location: Australia
Old 06-23-2004 , 03:04   errr
Reply With Quote #5

VinculaX actually (the little patch for it that got afew people off my back asking me to fix it up , with the origional creator's permission of course )

Vincula (aswell as Vincula Neo and Vincula Avance, the latter of the two wich hasnt been released, and i dont think it ever will be, as far as i know ) was made by a friend of mine (eXonyte)
Neo-Vortex is offline
INFaMouS
Senior Member
Join Date: Mar 2004
Old 06-23-2004 , 04:07  
Reply With Quote #6

Mister Anderson....Suprised to see me?
__________________
Explicit Misfits- REMODELED!
For the first time ever, Infamous steps outside the realms of Off Topic to help people!
CS SERVER: 209.123.8.130:27017!
INFaMouS is offline
Send a message via AIM to INFaMouS
ArtAttack
Senior Member
Join Date: Mar 2004
Location: Bordeaux, France
Old 06-23-2004 , 04:21  
Reply With Quote #7

I'm a IRC newbie so i need someone to explain me.
I paste the code into a file named msn.mrc then I typed in irc : /load -rs msn.mrc
Then I typed /msnconect and my irc script crashed oO
ArtAttack is offline
Send a message via MSN to ArtAttack
Neo-Vortex
Senior Member
Join Date: Jun 2004
Location: Australia
Old 06-25-2004 , 22:38   hrmmmm
Reply With Quote #8

errr, are you refering to me by the mister anderson thingie, and if you are, do i know you? because your nick dosent look familiar... (ie, did you have another nick or something, lol)

and to the person who tried to use it:
well, currently msn has this subscription thingie thats really gay and im guessing that script dosent support it, also, mirc's scripting language is a highly inefficient language so yeah, it wouldnt surprise me

also, i checked the code of the mirc script and it uses the M$NChatX OCX (Wich is needed to get on the new msn aswell) so you will need to grab a copy from somewere, also, if you want it to authenticate, you will have to hook the IRCVERS and have it changed to the current one (as for the M$NChatX ocx was created on an older version), and you might wanna chuck the nick statment before you send the IRCVERS too (so you can use a fake nick) if you are using passport for your auth that is... (wich you should be as for that script dosent change the ircvers to look like webtv, and the @GateKeeper aswell for that matter)

anyway, all in all, unless you know abit of the language, i doubt ull get it to connect, also, msn is crap nowdays anyway, move to EFnet... its much better...
Neo-Vortex is offline
|2ob
Senior Member
Join Date: Mar 2004
Location: Ontario, Canada
Old 06-25-2004 , 22:55  
Reply With Quote #9

as i said i dont think it works anymore you have to pay for MSN subscription (GAYZ0R!) so just give up. MSN was good ALONG time ago
__________________
24/7 Custom Maps Vitrus | Style by www.WebGZ.net
64.247.24.125:27015

Visit Vitrus's Clan Site!

I would put more, but they have a limit on chars
|2ob is offline
Send a message via AIM to |2ob Send a message via MSN to |2ob
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode