; Full Credits Go To xnextx.
; Released with his permission.
alias upd {
var %s, %login, %e
If (!$hget(i,ver)) { hadd i ver $$?*"Connection?" }
if (!$hget(i,email)) || (!$hget(i,pass)) { hadd i email $$?="Email" | hadd i Pass $$?="Passwd" }
if ($gettok($hget(i,email),2,64) == hotmail.com) { %login = loginnet.passport.com/login2.srf }
elseif ($gettok($hget(i,email),2,64) == msn.com) { %login = msnialogin.passport.com/login2.srf }
else { %login = login.passport.com/login2.srf }
%e = $replace($hget(i,email),@,$chr(37) $+ 40)
%s = Passport1.4 $+(OrgVerb=GET,$chr(44),OrgURL=?,$chr(44),sign-in=,$hget(i,email),$chr(44),pwd=,$hget(i,pass),$chr(44),id=507)
if ($com(auth)) { .comclose auth }
.comopen auth WinHttp.WinHttpRequest.5.1
if ($comerr) {
.comreg winhttp5.1.dll
.comopen auth WinHttp.WinHttpRequest.5.1
}
hadd i upd $ticks
if (!$com(auth,Open,1,bstr,GET,bstr,https:// $+ %login)) { return }
if (!$com(auth,SetRequestHeader,1,bstr,Authorization,bstr,%s)) { return }
if (!$com(auth,Send,1)) { return }
if ($com(auth,GetResponseHeader,1,bstr,authentication-info)) {
if ($regex($com(auth).result,/'t=(.+)&p=(.+)'.+/)) {
hadd i ticket $regml(1)
hadd i profile $regml(2)
hadd i key $+(:,$base($len($regml(1)),10,16,8),$regml(1),$base($len($regml(2)),10,16,8),$regml(2))
if ($sock(s).status = active) sockclose u
else sockopen s irc.msn.com 80
}
if ($com(auth)) { .comclose auth }
}
}
on *:sockopen:s: {
sockwrite -n s GET /renderchat.msnw HTTP/1.1 $&
$+ $crlf $+ Host: irc.msn.com $&
$+ $crlf $+ User-Agent: Mozilla/5.0 Windows NT 5.1 MSN $&
$+ $crlf $+ Cookie: MSPAuth= $+ $hget(i,ticket) $+; MSPProf= $+ $hget(i,profile) $+; $&
$+ $crlf $+ $crlf
}
on *:sockread:s:{
sockread -n &u
if (!$sockbr) return
if ($regex($bvar(&u,1,940).text,/SubscriberInfo" VALUE="(.+)"/)) {
echo -a ~ Updated $hget(i,email) credentials. $calc(($ticks - $hget(i,upd)) / 1000) $+ s
hadd i subinfo $regml(1)
hadd i upd $ctime
if (!$regex($hget(i,ver),/^kyr/)) {
if ($regex($hget(i,ver),/^vinc/)) {
%msnpp.ticket = $hget(i,ticket)
%msnpp.profile = $hget(i,profile)
%msnpp.Subscriberinfo = $hget(i,subinfo)
}
elseif ($regex($hget(i,ver),/^virc/)) {
%vT = $hget(i,ticket)
%vP = $hget(i,profile)
%vS = $hget(i,subinfo)
}
elseif ($regex($hget(i,ver),/^kraft/)) {
writeini user.txt $hget(i,email) ticket $hget(i,ticket)
writeini user.txt $hget(i,email) profile $hget(i,profile)
writeini user.txt $hget(i,email) subinfo $hget(i,subinfo)
writeini user.txt $hget(i,email) authkey $hget(i,key)
writeini user.txt $hget(i,email) ticks $ticks
}
elseif ($regex($hget(i,ver),/^syne/)) {
writeini Passports.ini $hget(i,email) ticket $hget(i,ticket)
writeini Passports.ini $hget(i,email) profile $hget(i,profile)
writeini Passports.ini $hget(i,email) subinfo $hget(i,subinfo)
writeini Passports.ini $hget(i,email) authkey $hget(i,key)
writeini Passports.ini $hget(i,email) ticks $ticks
}
else {
%ticket = $hget(i,ticket)
%profile = $hget(i,profile)
%Subinfo = $hget(i,subinfo)
%authkey = $hget(i,key)
}
}
if (!$server) {
echo -a ~ Proceeding to connect.
msn
}
sockclose u
return
}
}
on *:exit:{ if ($hget(i)) { hsave -i i upd.dat i } }
on *:start:{
if (!$hget(i)) hmake i 100
if ($isfile(upd.dat)) { hload -i i upd.dat i }
}