| 1 |
/*
|
| 2 |
* $Id: challenge.irc 33 2005-10-02 20:50:00Z knight $
|
| 3 |
|
| 4 |
CHALLENGE.IRC
|
| 5 |
|
| 6 |
Original code/idea by xyst
|
| 7 |
Rewritten by BlackJac [December 22, 2002]
|
| 8 |
*/
|
| 9 |
|
| 10 |
# make it /unloadable
|
| 11 |
package challenge
|
| 12 |
|
| 13 |
# Location and filename of your private key
|
| 14 |
@ challenge.keypath = [~/.irc/challenge/identity]
|
| 15 |
|
| 16 |
# Does your private key require a passphrase [yes/no]?
|
| 17 |
@ challenge.passphrase = [yes]
|
| 18 |
|
| 19 |
# Location of the 'respond' binary
|
| 20 |
@ challenge.resppath = [~/.irc/challenge/respond]
|
| 21 |
|
| 22 |
# Location and filename of your saved configuration file
|
| 23 |
@ challenge.savepath = [~/.irc/challenge/config]
|
| 24 |
|
| 25 |
/******************************************************************************/
|
| 26 |
|
| 27 |
alias challenge {
|
| 28 |
if ((fexist($challenge.keypath) != -1) && (fexist($challenge.resppath) != -1)) {
|
| 29 |
quote CHALLENGE ${[$0] ? [$0] : servernick()}
|
| 30 |
}{xecho $G Challenge error - make sure keypath and resppath are set correctly.;rsaconfig}
|
| 31 |
}
|
| 32 |
|
| 33 |
alias rsaconfig {
|
| 34 |
if ([$0]) {
|
| 35 |
switch ($0) {
|
| 36 |
(keypath) (passphrase) (resppath) {
|
| 37 |
if ([$1]) {@ challenge[$0] = [$1]}
|
| 38 |
fe (keypath passphrase resppath) cc {xecho $G Challenge -- $cc: ${challenge[$cc]}}
|
| 39 |
}
|
| 40 |
(save) {
|
| 41 |
@ unlink($challenge.savepath)
|
| 42 |
@ :fd = open($challenge.savepath W)
|
| 43 |
fe (keypath passphrase resppath) cc {@ write($fd @ challenge.$cc = [${challenge[$cc]}])}
|
| 44 |
@ close($fd)
|
| 45 |
xecho $G Challenge -- saved settings.
|
| 46 |
}
|
| 47 |
(*) {xecho $G Usage: /rsaconfig <keypath|passphrase|resppath> [value]}
|
| 48 |
}
|
| 49 |
}{
|
| 50 |
xecho $G Current settings for challenge.irc:
|
| 51 |
fe (keypath passphrase resppath) cc {xecho $G Challenge -- $cc: ${challenge[$cc]}}
|
| 52 |
xecho $G Type "/rsaconfig <keypath|passphrase|resppath> <value>" to change values, "/rsaconfig save" to save them.
|
| 53 |
}
|
| 54 |
}
|
| 55 |
|
| 56 |
^on ^386 "% %" {
|
| 57 |
@ challenge.num++
|
| 58 |
^on ^exec "chall$challenge.num *" {
|
| 59 |
if ([$2]) {xecho $G Challenge error -- $1-}{quote CHALLENGE +$1}
|
| 60 |
^on ^exec -"chall$challenge.num *"
|
| 61 |
}
|
| 62 |
^on ^exec_exit "chall$challenge.num *" {^on exec_exit -"chall$challenge.num *"}
|
| 63 |
^exec -name chall$challenge.num $challenge.resppath $challenge.keypath $1
|
| 64 |
if (challenge.passphrase == [yes]) {
|
| 65 |
input -noecho "Enter passphrase for challenge: " {^msg %chall$challenge.num $*}
|
| 66 |
}
|
| 67 |
^on ^464 * {xecho $G Challenge error -- password incorrect. Check your key.}
|
| 68 |
}
|
| 69 |
|
| 70 |
if (fexist($challenge.savepath) != -1) {
|
| 71 |
xecho $G Loading settings from $challenge.savepath\...
|
| 72 |
load $challenge.savepath
|
| 73 |
}{xecho $G Config file not found, use "/rsaconfig save"\; using defaults.}
|
| 74 |
|
| 75 |
rsaconfig
|