realJoshByrnes revised this gist . Go to revision
1 file changed, 4 insertions, 2 deletions
README.md
| @@ -4,11 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | 5 | * [x] AdiIRC-first - Works with both mIRC and AdiIRC | |
| 6 | 6 | * [x] Native GateKeeper / GateKeeperPassport Authentication | |
| 7 | - | * [ ] Support WHISPER (and converts PRIVMSG to WHISPER) | |
| 8 | - | * [ ] Concert IRC8 JOIN to IRC JOIN | |
| 7 | + | * [ ] Support WHISPER (and converts WHISPER to & from PRIVMSG) | |
| 8 | + | * [ ] Convert IRC8 JOIN to IRC JOIN | |
| 9 | 9 | * [ ] Support MODE on IRC8 JOIN (+v/o/q) | |
| 10 | 10 | * [ ] Convert IRC8 NAMES to IRC NAMES | |
| 11 | 11 | ||
| 12 | + | ## Nice to haves | |
| 13 | + | ||
| 12 | 14 | * [ ] Convert styled PRIVMSG to normal PRIVMSG | |
| 13 | 15 | * [ ] Supports CTCP "ERR NOUSERWHISPER". | |
| 14 | 16 | ||
realJoshByrnes revised this gist . Go to revision
2 files changed, 94 insertions, 3 deletions
IRC8.mrc
| @@ -1 +1,89 @@ | |||
| 1 | - | ; IRC8 connection by JD | |
| 1 | + | ; IRC8 connection by JD | |
| 2 | + | ||
| 3 | + | on ^1:LOGON:*:{ | |
| 4 | + | raw -q IRCVERS IRC8 MSN-OCX!9.02.0310.2401 | |
| 5 | + | raw -q AUTH GateKeeper I : $+ $gk.header(1) | |
| 6 | + | haltdef | |
| 7 | + | } | |
| 8 | + | ||
| 9 | + | on 1:PARSELINE:in:*:{ | |
| 10 | + | tokenize 32 $parseline | |
| 11 | + | if ($1 == AUTH) { | |
| 12 | + | if ($2 == GateKeeper || $2 == GateKeeperPassport) { | |
| 13 | + | if ($3 == S) { | |
| 14 | + | ; Extended (Passport) Authentication. Send %ticket and %passport to server. | |
| 15 | + | if ($2- == GateKeeperPassport S :OK) { | |
| 16 | + | raw -qn $1-3 $+($base($len(%ticket), 10, 16, 8), %ticket, $base($len(%profile), 10, 16, 8), %profile) | |
| 17 | + | } | |
| 18 | + | ; Attempt to find GateKeeper v3 Challenge (8 bytes, escaped) | |
| 19 | + | elseif ($regex($gettok($parseline,4-,32), /^:GKSSP\\0(?:[^\\]|\\.){2}\x03\\0\\0\\0\x02\\0\\0\\0((?:[^\\]|\\.){8})$/u) > 0) { | |
| 20 | + | ; Escaped text can contain characters the client can't handle (eg. 0x00), so convert to &binvar | |
| 21 | + | bset -a &challenge 1 $regsubex($regml(1) $+ $servertarget, /([^\\]|\\.)/gu, $gk.asc(\1) $+ $chr(32)) | |
| 22 | + | ; GateKeeper authenticaiton is a HMAC-MD5 with fixed key | |
| 23 | + | var %result = $hmac(&challenge, SRFMKSJANDRESKKC, md5, 1) | |
| 24 | + | .parseline -it | |
| 25 | + | .raw -n $1-3 $+(:,$gk.header(3),$regsubex(%result $+ $gk.guid($2), /([0-9a-f]{2})/g, $gk.hex2chr(\1))) | |
| 26 | + | } | |
| 27 | + | else { | |
| 28 | + | echo $color(info2) -t * GateKeeper Authentication Failed | |
| 29 | + | } | |
| 30 | + | } | |
| 31 | + | elseif ($3 == *) { | |
| 32 | + | var %oid = $iif($5 != 0, $+($chr(40),OID: $5,$chr(41))) | |
| 33 | + | echo $color(info) -t * Logged in as $4 %oid | |
| 34 | + | .parseline -it | |
| 35 | + | raw -q USER $username * * : $+ $iif($fullname, $ifmatch, ...) | |
| 36 | + | raw -q NICK $me | |
| 37 | + | } | |
| 38 | + | else { | |
| 39 | + | echo $color(info2) -t * GateKeeper Authentication Failed | |
| 40 | + | } | |
| 41 | + | } | |
| 42 | + | else { | |
| 43 | + | ; This is not GateKeeper. | |
| 44 | + | echo $color(info2) -t * ERROR: Unknown Authentication Package $+($chr(40),$2,$chr(41)) | |
| 45 | + | } | |
| 46 | + | } | |
| 47 | + | } | |
| 48 | + | ||
| 49 | + | ; Usage: $gk.header(sequence) - Returns GateKeeper v3 header with specified sequence (1 or 3 for client) | |
| 50 | + | alias -l gk.header return $+(GKSSP\0JD,$chr(3),\0\0\0,$chr($$1),\0\0\0) | |
| 51 | + | ||
| 52 | + | ; Usage: $gk.asc(char) - Returns $asc equivalent for a potentially escaped character (eg. \n) | |
| 53 | + | alias -l gk.asc { | |
| 54 | + | ; Not escaped | |
| 55 | + | if ($left($1, 1) != \) return $asc($1) | |
| 56 | + | ; Invalid escape | |
| 57 | + | elseif ($mid($1, 2, 1) !isincs 0tnrbc\) return $asc($mid($1, 2, 1)) | |
| 58 | + | ; Valid escape (\0 doesn't need replacement) | |
| 59 | + | return $replacecs($mid($1, 2, 1), t, 9, n, 10, r, 13, b, 32, c, 44, \, 92) | |
| 60 | + | } | |
| 61 | + | ||
| 62 | + | ; Usage: $gk.hex2chr(hex) - Returns an escaped $chr equivalent from hex | |
| 63 | + | alias -l gk.hex2chr { | |
| 64 | + | ; Normalise - Remove zero padding | |
| 65 | + | var %h = $base($1, 16, 16) | |
| 66 | + | ||
| 67 | + | ; Chars need escapinh | |
| 68 | + | if (%h == 0) return \0 | |
| 69 | + | elseif (%h == 9) return \t | |
| 70 | + | elseif (%h == A) return \n | |
| 71 | + | elseif (%h == D) return \r | |
| 72 | + | elseif (%h == 20) return \b | |
| 73 | + | elseif (%h == 2C) return \c | |
| 74 | + | elseif (%h == 5C) return \\ | |
| 75 | + | ; Chars don't need escaping | |
| 76 | + | else return $chr($base($1, 16, 10)) | |
| 77 | + | } | |
| 78 | + | ||
| 79 | + | alias -l gk.guid { | |
| 80 | + | if ($1 == GateKeeperPassport) return $str(00,16) | |
| 81 | + | if (!$var(%GK.GUID)) set %GK.GUID $md5($time $date $gmt $ctime $ticks) | |
| 82 | + | return %GK.GUID | |
| 83 | + | } | |
| 84 | + | ||
| 85 | + | ; Adds $username for mIRC (Built-in for AdiIRC) | |
| 86 | + | alias -l username { | |
| 87 | + | if (@ isin $emailaddr) return $gettok($emailaddr, 1, 46) | |
| 88 | + | else return $me | |
| 89 | + | } | |
README.md
| @@ -3,11 +3,14 @@ | |||
| 3 | 3 | ## Requirements | |
| 4 | 4 | ||
| 5 | 5 | * [x] AdiIRC-first - Works with both mIRC and AdiIRC | |
| 6 | - | * [ ] Native GateKeeper / GateKeeperPassport Authentication | |
| 6 | + | * [x] Native GateKeeper / GateKeeperPassport Authentication | |
| 7 | 7 | * [ ] Support WHISPER (and converts PRIVMSG to WHISPER) | |
| 8 | 8 | * [ ] Concert IRC8 JOIN to IRC JOIN | |
| 9 | 9 | * [ ] Support MODE on IRC8 JOIN (+v/o/q) | |
| 10 | 10 | * [ ] Convert IRC8 NAMES to IRC NAMES | |
| 11 | 11 | ||
| 12 | 12 | * [ ] Convert styled PRIVMSG to normal PRIVMSG | |
| 13 | - | * [ ] Supports CTCP "ERR NOUSERWHISPER". | |
| 13 | + | * [ ] Supports CTCP "ERR NOUSERWHISPER". | |
| 14 | + | ||
| 15 | + | ## Known Issues | |
| 16 | + | * Auth doesn't always work with AdiIRC (probably due to UTF8 quirks) | |
realJoshByrnes revised this gist . Go to revision
2 files changed, 14 insertions
IRC8.mrc(file created)
| @@ -0,0 +1 @@ | |||
| 1 | + | ; IRC8 connection by JD | |
README.md(file created)
| @@ -0,0 +1,13 @@ | |||
| 1 | + | # MSN (IRC8) compatible connection script | |
| 2 | + | ||
| 3 | + | ## Requirements | |
| 4 | + | ||
| 5 | + | * [x] AdiIRC-first - Works with both mIRC and AdiIRC | |
| 6 | + | * [ ] Native GateKeeper / GateKeeperPassport Authentication | |
| 7 | + | * [ ] Support WHISPER (and converts PRIVMSG to WHISPER) | |
| 8 | + | * [ ] Concert IRC8 JOIN to IRC JOIN | |
| 9 | + | * [ ] Support MODE on IRC8 JOIN (+v/o/q) | |
| 10 | + | * [ ] Convert IRC8 NAMES to IRC NAMES | |
| 11 | + | ||
| 12 | + | * [ ] Convert styled PRIVMSG to normal PRIVMSG | |
| 13 | + | * [ ] Supports CTCP "ERR NOUSERWHISPER". | |