mIRC

Home    About    Download    Register    News    Help

Topic Options
#228222 - 12/12/10 03:32 PM SASL authentication script for Freenode
Dralspire Offline
Nutrimatic drinks dispenser

Registered: 06/09/08
Posts: 5
First of all, credits: This is not my work, I only adapted it for my purposes. The original work comes from http://pastebin.com/VbG6wSrN. Having said that ... At some point I started getting the SASL authentication required message from Freenode. Freenode's solution is somewhat odd, you are supposed to get a script and a DLL, but those are not working for me.

I came across the pastebin script which seemed like an easier approach. If you look at the script, you will see %user and %password. As far as I can tell, those variables actually never get defined. Because of that, the script failed. What I added are two sections defining those variables in order to get the script to complete the connection.

Code:
on ^*:LOGON:*:{
  if ($network == Freenode) { 
    var %user = ENTER YOUR USERNAME HERE
    var %password = ENTER YOUR PASSWORD HERE
  }
  .raw CAP LS
  echo -s Checking capabilities...
  .raw USER %user 0 * : $+ $fullname
  .raw NICK $mnick
  enable #sasl
  halt
}

#sasl off

raw 001:*:disable #sasl

raw CAP:* LS *:{
  echo -s Capabilities: $3-
  var %tok

  if ($findtok($3-,sasl,32) != $null) {
    set %tok $addtok(%tok,sasl,32)
  }

  if ($findtok($3-,multi-prefix,32) != $null) {
    set %tok $addtok(%tok,multi-prefix,32)
  }

  if ($findtok($3-,packet-size,32) != $null) {
    set %tok %addtok(%tok,packet-size=1024,32)
  }

  if (%tok != $null) {
    echo -s Enabling: %tok
    .raw CAP REQ : $+ %tok
  }

  if ($findtok($3-,sasl,32) == $null) {
    .raw CAP END
  }
  halt
}

raw CAP:* ACK sasl*:{
  .raw AUTHENTICATE PLAIN
}

raw AUTHENTICATE:+:{
  if ($network == Freenode) { 
    var %user = ENTER YOUR USERNAME HERE
    var %password = ENTER YOUR PASSWORD HERE
  }
  sasl-plain %user %password
  halt
}

raw 903:*:.raw CAP END
raw 904:*:.raw CAP END
raw 905:*:.raw CAP END
raw 906:*:.raw CAP END
raw 907:*:.raw CAP END

#sasl end

alias sasl-plain {
  bset -t &auth 1 $1
  bset -t &auth $calc( $bvar(&auth,0) + 2 ) $1
  bset -t &auth $calc( $bvar(&auth,0) + 2 ) $2
  var %len = $encode(&auth,mb)
  .raw AUTHENTICATE $bvar(&auth,1,%len).text
}


The code that I added in two spots in the script should support multiple servers:

Code:
  if ($network == Freenode) { 
    var %user = ENTER YOUR USERNAME HERE
    var %password = ENTER YOUR PASSWORD HERE
  }


If another network started using SASL authentication, I would simply add two more blocks below the existing "if ($network ==" blocks, e.g.

Code:
  if ($network == Freenode) { 
    var %user = ENTER YOUR USERNAME HERE
    var %password = ENTER YOUR PASSWORD HERE
  }
if ($network == NEW NETWORK) { 
    var %user = ENTER YOUR OTHER USERNAME HERE
    var %password = ENTER YOUR OTHER PASSWORD HERE
  }


I am sure the script could be simplified, streamlined etc. So anyway, here it is, a working SASL authentication script for Freenode with mIRC 7.15. All you need to do is enter your username and your password in two locations. And yes, very inefficient of me. ;\)

Top
#235712 - 06/01/12 05:28 PM Re: SASL authentication script for Freenode [Re: Dralspire]
elRey Offline
Mostly harmless

Registered: 06/01/12
Posts: 1
when using this script, I get the following:

Capabilities: account-notify extended-join identify-msg multi-prefix sasl
Enabling: sasl multi-prefix
USER Not enough parameters
-
* /bset: insufficient parameters (line 67, script1.mrc)
-
irc.freenode.net AUTHENTICATE +

ideas? And I have not registered an account so how can I login if I do not have an account?

Top