passportupdater.mrc
                        
                             · 2.3 KiB · Text
                        
                    
                    
                      
                        Raw
                      
                      
                        
                          
                        
                    
                    
                
                
            ; The last ever MSN Chat passport updater - 16/05/2017
; - Based on my previous work (sslupdatefix.mrc) - 10/04/2006
; - Update $sockerr check for AdiIRC compatibility - 14/01/2025
; - Why doesn't it get my PassportProfile? It's no longer sent by MSN.
;Just type /ppu.update to update passport
;You may need to change the %variables to suit your connection
alias PPU.Update {
  if (!$sslready) { PPU.Result NeedSSL | halt }
  if ($2) getinfo $1 $2
  else {
    if (!%Email) set %Email $$?"Please enter your email address"
    if (!%Passwd) set %Passwd $$?"Please enter your password"
    PPU.Getinfo %Email %Passwd
  }
  set %PPU.time $ticks
}
alias PPU.Result {
  if ($1 == Fail) echo -at [Update Status] Passport Update Failed. Please check your username and password
  elseif ($1 == GotTP) {
    if ($right($gettok($2,1,38), -2) != $null) {
      set %Ticket $ifmatch
    }
    if ($right($gettok($2,2,38), -2) != $null) {
      set %Profile $ifmatch
    }
    echo -at [Update Status] Complete ( $+ $iif(%Email,%Email,unknown) - $calc(($ticks - %PPU.time) / 1000) $+ s)
    unset %PPU.time
  }
  elseif ($1 == NeedSSL) {
    echo -at [Update Status] Passport Update Failed. SSL not available.
  }
  else echo -at [Update Status] Unknown. (An Error Has Occurred) $1-
}
on 1:SOCKOPEN:PPU.Update.*:{
  if (!$sockerr) {
    sockwrite -t $sockname GET /login2.srf HTTP/1.0 $+ $crlf $+ $&
      Authorization: Passport1.4 OrgVerb=GET,OrgURL=?,sign-in= $+ $PPU.URLEncode(%Email) $+ ,pwd= $+ $PPU.URLEncode(%Passwd) $+ ,id=507 $+ $crlf $+ $&
      Host: login.live.com $+ $crlf $+ $crlf
  }
}
on 1:sockread:PPU.Update.*:{
  var %x | sockread %x | tokenize 32 %x
  if ($1 isin authentication-info: www-authenticate:) {
    if ($gettok($3,1,44) == da-status=failed) PPU.Result Fail NoRetry
    elseif ($gettok($3,1,44) == da-status=success) PPU.Result GotTP $gettok($3,2,39)
  }
  elseif ($1 == Location:) { sockopen -e PPU.Update. $+ $r(1111,9999) $gettok($2-,2,47) 443 }
}
alias PPU.URLEncode {
  var %encode = $1-
  while ($regex($eval(%encode,1), /([^a-zA-Z0-9_\-\.])/)) {
    var %t = $regsub($eval(%encode,1), /([^a-zA-Z0-9_\-\.])/, $+(,$base($asc($regml(1)),10,16,2)), %encode)
  }
  return $replace(%encode, , %)
}
alias PPU.GetInfo {
  if ($2) { set %Email $1 | set %Passwd $2 }
  sockopen -e PPU.Update. $+ $r(1111,9999) login.live.com 443
}
                | 1 | ; The last ever MSN Chat passport updater - 16/05/2017 | 
| 2 | ; - Based on my previous work (sslupdatefix.mrc) - 10/04/2006 | 
| 3 | ; - Update $sockerr check for AdiIRC compatibility - 14/01/2025 | 
| 4 | |
| 5 | ; - Why doesn't it get my PassportProfile? It's no longer sent by MSN. | 
| 6 | |
| 7 | ;Just type /ppu.update to update passport | 
| 8 | ;You may need to change the %variables to suit your connection | 
| 9 | |
| 10 | alias PPU.Update { | 
| 11 | if (!$sslready) { PPU.Result NeedSSL | halt } | 
| 12 | if ($2) getinfo $1 $2 | 
| 13 | else { | 
| 14 | if (!%Email) set %Email $$?"Please enter your email address" | 
| 15 | if (!%Passwd) set %Passwd $$?"Please enter your password" | 
| 16 | PPU.Getinfo %Email %Passwd | 
| 17 | } | 
| 18 | set %PPU.time $ticks | 
| 19 | } | 
| 20 | |
| 21 | alias PPU.Result { | 
| 22 | if ($1 == Fail) echo -at [Update Status] Passport Update Failed. Please check your username and password | 
| 23 | elseif ($1 == GotTP) { | 
| 24 | if ($right($gettok($2,1,38), -2) != $null) { | 
| 25 | set %Ticket $ifmatch | 
| 26 | } | 
| 27 | if ($right($gettok($2,2,38), -2) != $null) { | 
| 28 | set %Profile $ifmatch | 
| 29 | } | 
| 30 | echo -at [Update Status] Complete ( $+ $iif(%Email,%Email,unknown) - $calc(($ticks - %PPU.time) / 1000) $+ s) | 
| 31 | unset %PPU.time | 
| 32 | } | 
| 33 | elseif ($1 == NeedSSL) { | 
| 34 | echo -at [Update Status] Passport Update Failed. SSL not available. | 
| 35 | } | 
| 36 | else echo -at [Update Status] Unknown. (An Error Has Occurred) $1- | 
| 37 | } | 
| 38 | |
| 39 | on 1:SOCKOPEN:PPU.Update.*:{ | 
| 40 | if (!$sockerr) { | 
| 41 | sockwrite -t $sockname GET /login2.srf HTTP/1.0 $+ $crlf $+ $& | 
| 42 | Authorization: Passport1.4 OrgVerb=GET,OrgURL=?,sign-in= $+ $PPU.URLEncode(%Email) $+ ,pwd= $+ $PPU.URLEncode(%Passwd) $+ ,id=507 $+ $crlf $+ $& | 
| 43 | Host: login.live.com $+ $crlf $+ $crlf | 
| 44 | } | 
| 45 | } | 
| 46 | |
| 47 | on 1:sockread:PPU.Update.*:{ | 
| 48 | var %x | sockread %x | tokenize 32 %x | 
| 49 | if ($1 isin authentication-info: www-authenticate:) { | 
| 50 | if ($gettok($3,1,44) == da-status=failed) PPU.Result Fail NoRetry | 
| 51 | elseif ($gettok($3,1,44) == da-status=success) PPU.Result GotTP $gettok($3,2,39) | 
| 52 | } | 
| 53 | elseif ($1 == Location:) { sockopen -e PPU.Update. $+ $r(1111,9999) $gettok($2-,2,47) 443 } | 
| 54 | } | 
| 55 | |
| 56 | alias PPU.URLEncode { | 
| 57 | var %encode = $1- | 
| 58 | while ($regex($eval(%encode,1), /([^a-zA-Z0-9_\-\.])/)) { | 
| 59 | var %t = $regsub($eval(%encode,1), /([^a-zA-Z0-9_\-\.])/, $+(,$base($asc($regml(1)),10,16,2)), %encode) | 
| 60 | } | 
| 61 | return $replace(%encode, , %) | 
| 62 | } | 
| 63 | |
| 64 | alias PPU.GetInfo { | 
| 65 | if ($2) { set %Email $1 | set %Passwd $2 } | 
| 66 | sockopen -e PPU.Update. $+ $r(1111,9999) login.live.com 443 | 
| 67 | } | 
| 68 |