mIRC SHITTY SASL

By raccoon on Feb 14, 2017

Yes. It's here! The long awaited SASL script for mIRC. Super Shitty Edition!
I have a more protocol appropriate version on the way, but this one is short, sweet, elegant and shitty as fuck!
Actually, it works on every version of mIRC ever made since 1776. Or there abouts. Enjoy!

; r_shitty_sasl.mrc                           http://hawkee.com/snippet/17983/
; ----------------------------------------------------------------------------
;  SUPER SHITTY SASL Script by Raccoon 2017-Feb-14 for mIRC 6.10 to 7.47 up.
;  FIRST RELEASE. SUPER SHITTY. VALENTINE'S DAY EDITION. 2/14/2017 -- ENJOY!
; ----------------------------------------------------------------------------
;
; Q. Can I have other SASL scripts loaded?
; A. NO! No, no no. Uninstall all other SASL scripts!
;
; Q. How do I work it?
; A. Just edit your Server settings, plugging your
;    nickname:password into the Password field.
;
; /------------------------------------------------------------\  ==========
; | Edit Server                                          [ X ] |  ATTENTION!
; | +--------------------------------------------------------+ |  ==========
; | |                                                        | |
; | |  Description:  [ chat.freenode.net               ]     | |   PUT YOUR
; | |                                                        | |
; | |   IRC Server:  [ chat.freenode.net               ]     | |   NICKNAME
; | |                                                        | |
; | |        Ports:  [ +6697,+7000,+7070               ]     | |     AND
; | |                                                        | |
; | |        Group:  [ Freenode                   ]          | |   PASSWORD
; | |                                                        | |
; | |  -> Password:  [ Raccoon:MySeKrItPaSsWoRd   ] <-------------- HERE!! <-
; | |                                                        | |
; | |     *------------*  *------------*  *------------*     | |   SEPARATED
; | |     |     OK     |  |   Cancel   |  |    Help    |     | |
; | |     *------------*  *------------*  *------------*     | |    WITH A 
; | +-rac----------------------------------------------------+ |
; \------------------------------------------------------------/   COLON ':'
;
; This script will utilize your nickname:password information that
; is supplied by the PASS command to initiate the SASL handshake.
; The PASS command will still be sent, and acts as a fallback.
;
; This script is SUPER SHITTY because it gives no shits about the proper
; back-and-forth exchange of CAP negotiation.  It just fires off commands.
; It works almost all the time. Your results may vary. No warranty.
;
; If you have any questions, ask for help in ##mIRC on freenode. -- Raccoon
;
; Advice: Always connect to IRC via encrypted SSL port. eg: +6697 (not 6667)
;
; ----------------------------------------------------------------------------

On ^*:LOGON:*: {
  if ($version < 7.42) {
    .debug -ip $iif($debug,$debug,on) SHITTY_SASL
} }

ALIAS SHITTY_SASL {
  if ($regex($1-,/^-> \S+ PASS (\S+?):(\S+)$/)) {
    noop $SUPER_SHITTY_SASL_AUTH($regml(1),$regml(2))
    .debug $iif($window($debug),$debug,off)
  }
  if ($1 == <-) { .debug $iif($window($debug),$debug,off) }
  return $1-
}

On $*:PARSELINE:out:/^PASS (\S+):(\S+)$/: {
  ; versions >= 7.42 (2015)
  noop $SUPER_SHITTY_SASL_AUTH($regml(1),$regml(2))
}

ALIAS -l SUPER_SHITTY_SASL_AUTH {
  var %u = $1, %p = $2
  .raw CAP REQ :sasl
  .raw AUTHENTICATE PLAIN
  bset -t &auth 1 %u $+ $lf $+ %u $+ $lf $+ %p
  breplace &auth 10 00
  noop $encode(&auth,mb)
  .raw AUTHENTICATE $bvar(&auth,1-).text
  .raw CAP END
} ; by Raccoon 2017

; Footnote.  This script is intentionally the shittiest way to implement SASL.
; HOWEVER! It is the smallest SASL script, and works with all versions of mIRC v6.1+ (2003).

; End of script.

http://forums.mirc.com/ubbthreads.php/topics/259970
http://www.mpaste.com/raw/Zkty
https://github.com/freenode/www/pull/38
https://github.com/freenode/web-7.0/pull/287

Comments

Sign in to comment.
gooshie   -  Feb 15, 2017

Well coded. Good comments. I especially enjoyed this one under PARSELINE:
; versions >= 7.42 (2015)
I imagine this:
%u $+ $lf $+ %u $+ $lf $+ %p
is your coding style 'cause I can't imagine you can make this and don't know:
$+(%u,$lf,%u,$lf,%p)

raccoon  -  Feb 15, 2017

As a general principle, I avoid using $+() unless it really makes the code much more readable. In actuality, $+() creates a process or stack fork just to call a function that stitches strings together and returns an output. The stand-alone $+ method uses low level parser syntax handling. Granted, there are no high stakes speed improvements in this script, but I just use $+ instead of $+() out of practice and good form.

Also, I'm not very sure when $+() was added to mIRC, and if it's supported in 6.10 (2003).

gooshie  -  Feb 15, 2017

That's good to know, but even a thousand $+() in a script wouldn't
be noticeable resource-wise except in extreme cases.
This script only gets used during sign-on, but to each their own.

gooshie  -  Feb 15, 2017

I just read: "Also, I'm not very sure when $+() was added to mIRC, and if it's supported in 6.10 (2003)."
So, I guess you would need to do: "%A $+ %B" to claim it works in every version.
I can see someone running as old as 6.21 being that there is a password to bypass
the nag screen, but I wouldn't put it past someone running 5.91, because they think
multi-server support is evil and bloated, heh.

raccoon  -  Feb 15, 2017

But out of curiosity, why do people even use $+(xxx,yyy,zzz)? A few less characters? I only use it for stitching dynamically named variables that get evaluated via $() at the same time. ie: $($+(%,MyArray.,%x,.,%y),2) instead of %MyArray. [ $+ [ %x ] $+ ] . [ $+ [ %y ] ] --- and then, sometimes I use that anyway.

All said and done, $+ is still mIRC's official concatenation operator.

gooshie  -  Feb 15, 2017

To me it looks cleaner and easier to read.

Sashka  -  28 days ago

I'm not using $+() also in my scripts (i.e. mIRC Korona) also.. i'm using $1 $+ %2 as Raccoon and, how it said, it really makes the code much more readable and i'm also using this as i familiarized with this. Both methods are right, but $1 $+ %2 uses a low format and is a reason to use this method, to avoid mismatches when you forget to put a comma between tokens :) Experienced scripters must know this :)

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.