mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2007
Posts: 10
Z
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2007
Posts: 10
Hi,
I'm trying to write a script based off an UnrealIRCd that uses MD5 for encryption for the unrealircd.conf file,

Code:
alias unrealircdpass {
set %adminline2pass mkpasswd md5 %adminline1pass
set %adminline1pass %adminline2pass
}


Basically
Another pop up will set %adminline1pass as the Opers desired Oper password then trigger the alias unrealircdpass

I wish to set %adminline2pass with the result of the md5

the command is mkpasswd md5 <password>

My problem is when it sets it it sets it as the command line not the result, and I can't see what I could do to easily resolve that.

Thank you for any help, if there is a result for it.

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I don't really follow, sorry dude.

Do you mean like:

Code:
alias unrealircdpass {
  set %adminline2pass $md5(%adminline1pass)
}

Joined: Aug 2007
Posts: 10
Z
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2007
Posts: 10
yes and its close,
but the result for say bonkers for the script is
Code:
alias unrealircdpass {
  set %adminline2pass $md5(%adminline1pass)
}
dfcc53d9a218e37d66e87d3581deebdb



but when I do it the old way

Code:
mkpasswd md5 bonkers

$c4+GSXO7$3Kd04uiNMg7+1ZDdKUagzQ==


Sorry it did give some funky code, but its not the same md5 that i use in unreal
anything else?

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
As far as I know, md5-hashes are made of letters and digits only (like the $md5(bonkers) in your example), they do not contain chars like "$" "+" or "=".
I suppose the IRCD is creating a pass using md5 in some way, but this pass is not the "md5 hash" of the password sent....
If you really need to store that pass (storing an opper pass inside a script is no good idea imho), you need to parse the server reply. If you don't need to store it, just use something like:
Code:
alias makepass {
  noop $input(Please enter password to make,eog,Make Password)
  $iif(($!),mkpasswd md5 $v1,echo -a please retry)
}

Joined: Aug 2007
Posts: 10
Z
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2007
Posts: 10
using unreal it does
Code:
*** Authentication phrase (method=md5, para=bonkers) is: $SG/ptAlX$r5jCXn/0AsM1LWImZU336g==


thats how it works there
i just want to be able to set the $SG/ptAlX$r5jCXn/0AsM1LWImZU336g== into a var

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Don't know where it "does" this line, if it is a notice or snotice, you might use something like:
Code:
on *:snotice:*: {
  if (Authentication phrase isin $1-) { var %pass = $gettok($1-,-1,32) }
}
(assuming it's a server notice)

or
Code:
on *opperserv:notice:*:*: {
  var %reg = /.+Authentication phrase \(method=.+, para=.+\) is: .+/s
  if ($regex($1-,%reg)) { var %pass = $gettok($1-,-1,32) }
}
(assuming its a "regular" notice sent to you by opperserv)

Joined: Aug 2007
Posts: 10
Z
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2007
Posts: 10
Code:
alias unrealircdpass {

  /mkpasswd md5 %adminline1pass

}


on *:text:*Authentication phrase*:*:{var %adminline2pass $gettok($1-,-1,32) }


when it does the mkpasswd
this is what happens in status
Code:
[23:36] -irc.sith-net.com- *** Authentication phrase (method=md5, para=bonkers) is: $RaUTzXVy$rayzhUML25eM5lLZzWa2xQ==


all i want is for %adminline2pass to equal $RaUTzXVy$rayzhUML25eM5lLZzWa2xQ==


those codes arent getting a var to give me that same response,

Thanks for the help so far your attempts are very apreciated

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Originally Posted By: ZijnLiefde

this is what happens in status
Code:
[23:36] -irc.sith-net.com- *** Authentication phrase (method=md5, para=bonkers) is: $RaUTzXVy$rayzhUML25eM5lLZzWa2xQ==

I have no opper rights to determine whether this reply was sent to you as notice or server notice. It looks like a snotice, but you have to ascertain this yourself smile
It's definitely no normal message and can't be catched with an on text event.


To figure this out, add this (temporarily) to your remotes:
Code:
on ^*:notice:*:*: { echo 8 -s Received NOTICE: $nick : $1- }
on ^*:snotice:*: { echo 8 -s Received SNOTICE: $nick : $1- }
...and trigger the command-reply situation again. Which echo does occur?

EDIT: ah, and I overlooked some facts concerning this part of your code
Code:
on *:text:*Authentication phrase*:*:{var %adminline2pass $gettok($1-,-1,32) }

1) there is a missing space after the first opening bracket: "{var (...)" should be "{ var (...)"
2) I used "var %somevariable = somevalue" as an example for a script that goes on working with that local variable. if you want to store the data in mIRC's variables section (remote.ini), use "set %somevariable somevalue" instead to set a global variable
3) to see a feedback whether or not variables were set in a certain situation, use "set -s %somevariable somevalue" (or "var -s %somevariable = somevalue"). This produces an instant echo feedback (status window).

Last edited by Horstl; 13/08/07 05:13 AM.
Joined: Aug 2007
Posts: 10
Z
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2007
Posts: 10
its getting close it is just responding with just bonkers, not the md5 version

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Originally Posted By: ZijnLiefde
its getting close it is just responding with just bonkers, not the md5 version
I didn't catch that.

As you said this shows up in your status window:
Quote:
[23:36] -irc.sith-net.com- *** Authentication phrase (method=md5, para=bonkers) is: $RaUTzXVy$rayzhUML25eM5lLZzWa2xQ==
I presume it is a server notice (and the "nick" sending this notice being the server "irc.sith-net.com").

Try this code:
Code:
on $^*:snotice:/Authentication phrase \(method=.+, para=.+\) is/: { 
  set %pass $gettok($1-,-1,32)
  echo -s Password stored as: %pass
}

Joined: Jan 2008
Posts: 1
P
Mostly harmless
Offline
Mostly harmless
P
Joined: Jan 2008
Posts: 1
Not sure if you ever figured this out so here you go.
Code:
 
alias unrealircdpass { mkpasswd md5 $1- }
and
on ^*:snotice:*:{if (Authentication phrase isin $2-3) { set %adminline1 $7 }

Hope this works for you.


Link Copied to Clipboard