Challenge auth

From Scriptwiki
Revision as of 13:49, 23 March 2008 by Doomie (talk | contribs) (updated to the new CHALLENGEAUTH command)

Jump to: navigation, search
; by doomie @ QuakeNet
; channel: #help.script
; written and tested on mIRC 6.31
;
; What does this script do?
;  
;   auths with Q using the 'CHALLENGEAUTH' command
;
; How to use this script?
;
;   if you want to auth, just type: /challengeauth
;   However, you need to have the SHA2.dll by slug, which can be downloaded here: 
;      http://www.quakenet.org/development/challengeauth/SHA2.dll
;   A general explanation can be found here: 
;      http://www.quakenet.org/development/challengeauth/
  

; CONFIGURE

; $1 = dll function
; $2 = parameter for the dll function
alias -l ChallengeAuth.PathToDll { return $mircdirSHA2.dll }




; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
alias -l ChallengeAuth.Q { return Q@CServe.quakenet.org }
alias -l ChallengeAuth.DLL { return $dll($ChallengeAuth.PathToDll,$1,$2) }

; $1 = string to lower
alias -l ChallengeAuth.IRCToLower {
 return $replacex($lower($1),$chr(91),$chr(123),$chr(93),$chr(125),$chr(92),$chr(124),$chr(94),$chr(126))
}

; $1 = Challenge
alias -l ChallengeAuth.Auth {
 var %ChallengeAuth.Username = $ChallengeAuth.IRCToLower($?="Username")
 if ($len(%ChallengeAuth.Username) == 0) {
   echo -s ChallengeAuth: No Username specified.
   return
 }

 var %ChallengeAuth.Password = $left($?="Password",10)
 if ($len(%ChallengeAuth.Password) == 0) {
   echo -s ChallengeAuth: No Password specified.
   return
 } 

 var %ChallengeAuth.PasswordHash = $ChallengeAuth.DLL(sha256_hex, %ChallengeAuth.Password)
 var %ChallengeAuth.Key = $ChallengeAuth.DLL(sha256_hex, %ChallengeAuth.Username $+ : $+ %ChallengeAuth.PasswordHash)
 var %ChallengeAuth.Response = $ChallengeAuth.DLL(hmac_sha256, %ChallengeAuth.Key $1)
 !.msg $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.Username %ChallengeAuth.Response HMAC-SHA-256
}

alias ChallengeAuth {
 if (!$isfile($ChallengeAuth.PathToDll)) {
   echo -s ChallengeAuth: The path to your SHA2.dll is wrong. Please configure the challengeauth script correctly and/or download the dll from
   echo -s ChallengeAuth: http://www.quakenet.org/development/challengeauth/SHA2.dll
   return
 }
}