Difference between revisions of "Challenge auth"

From Scriptwiki
Jump to: navigation, search
m (removed misplaced })
(updated to the new CHALLENGEAUTH command)
Line 1: Line 1:
  ; by wiebe @ QuakeNet
+
  ; by doomie @ QuakeNet
  ;  written and tested on mIRC 6.16
+
  ; channel: #help.script
 +
  ; written and tested on mIRC 6.31
 
  ;
 
  ;
 
  ; What does this script do?
 
  ; What does this script do?
  ;
+
  ;
  ; auths with Q using the 'CHALLENGEAUTH' command
+
  ;   auths with Q using the 'CHALLENGEAUTH' command
 
  ;
 
  ;
 
  ; How to use this script?
 
  ; How to use this script?
 
  ;
 
  ;
  ;  load the script and connect to quakenet
+
  ;   if you want to auth, just type: /challengeauth
  ; (if already connected, /msg Q challenge)
+
  ;  However, you need to have the SHA2.dll by slug, which can be downloaded here:
  ; default mode is 'semi-automatic'
+
  ;     http://www.quakenet.org/development/challengeauth/SHA2.dll
  ;  for more info, read below
+
  ;   A general explanation can be found here:
  ;
+
  ;     http://www.quakenet.org/development/challengeauth/
 +
 
 +
   
 +
  ; CONFIGURE
 
   
 
   
  on $*:notice:/^CHALLENGE MD5 ([0-9a-f]){32}$/:?:{
+
  ; $1 = dll function
  if ($fulladdress != Q!TheQBot@CServe.quakenet.org) || ($network != QuakeNet) || (*.quakenet.org !iswm $server) { !return }
+
; $2 = parameter for the dll function
  !echo -egst *** Attempting to CHALLENGE AUTH with Q from $server $chr(91) $+ $serverip $+ $chr(93)
+
alias -l ChallengeAuth.PathToDll { return $mircdirSHA2.dll }
 
   
 
   
  ; this is the most secure way, 'semi-automatic'
 
  ; sets the command ready for you, but you have to enter the account and password everytime
 
  ; for paranoid people, change the -ns to -s,
 
  ; that way you see the command in status window and have to press enter yourself
 
  ; do not change the following 2 lines, unless you know what you are doing
 
 
   
 
   
  !editbox -ns //!.msg Q@CServe.quakenet.org CHALLENGEAUTH $$!?*="account" $!md5($left($$?*="password",10) $3 $+ )
 
  !return
 
 
   
 
   
 
   
 
   
  ; if you want automatic auth, despite the risks..,
+
; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
  ; comment the above 2 lines, like this:
+
  alias -l ChallengeAuth.Q { return Q@CServe.quakenet.org }
  ; ;!editbox ..
+
  alias -l ChallengeAuth.DLL { return $dll($ChallengeAuth.PathToDll,$1,$2) }
  ; ;!return
 
  ; and replace 'username' and 'password' below
 
 
   
 
   
  !var %j = $&
+
; $1 = string to lower
    username
+
alias -l ChallengeAuth.IRCToLower {
  !var %s = $&
+
  return $replacex($lower($1),$chr(91),$chr(123),$chr(93),$chr(125),$chr(92),$chr(124),$chr(94),$chr(126))
    password
 
  !.msg $+(Q,$chr(64),CSe,rve,$chr(46),qua,ken,et,.o,rg,$chr(32),CH,$chr(65),LL,$chr(69),NG,$chr(69),$chr(65),$chr(85),TH) %j $md5($left(%s,10) $3)
 
 
  }
 
  }
 
   
 
   
  on *:notice:Either you haven't requested a challenge yet or your one expired.:?:{
+
  ; $1 = Challenge
  if ($fulladdress != Q!TheQBot@CServe.quakenet.org) || ($network != QuakeNet) || (*.quakenet.org !iswm $server) { !return }
+
alias -l ChallengeAuth.Auth {
  !.msg Q@CServe.quakenet.org CHALLENGE
+
  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
 
  }
 
  }
 
   
 
   
  on *:connect:{
+
  alias ChallengeAuth {
  if ($network != QuakeNet) || (*.quakenet.org !iswm $server) { !return }
+
  if (!$isfile($ChallengeAuth.PathToDll)) {
  !.msg Q@CServe.quakenet.org CHALLENGE
+
    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
 +
  }
 
  }
 
  }
 
[[Category:Script Archive]]
 

Revision as of 13:49, 23 March 2008

; 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
 }
}