mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2003
Posts: 23
Q
Qwaka Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: May 2003
Posts: 23
Hers is the situation. I run mirc on a remote bot (at home when I'm at work) I have this little .exe that will convert a string to an MD5 encrypted password that i use for changing my FTP password. The exe runs like this: pass.exe in.txt out.txt
In.txt has the plain text pasword, and out.txt is the resulting encrypted password. My script in mIRC looks like this:
Code:
  if ($1 == !FTPpass)  
{ 
    if (!$2) { msg $nick Try specifying a pass | halt }
    write -l1 in.txt $2  
    run pass.exe in.txt out.txt
    msg $nick $2 after MD5 encrypting  = $read(out.txt)
    writeini C:\winnt\system32\ftp\ftp.ini  USER=Home|1 Password $read(out.txt) 
}


However what it is actually doing is reading the out.txt before pass.exe has finished and written the new password. So it displays what used to be in old.txt not what pass.exe just wrote into it. I tried setting timers for the /msg and /writeini commands but even if I set it for say 30 seconds and to run 10 times each of thsoe ten times it still displays what used to be in old.txt not what is in there now.

Can I make mIRC reopen and evaluate that out.txt file each time the timer is activated ? I figure a while loop may be what I need, but I coudlnt figure out how to implement it.

Or is there a way I can pacuse mIRC for a moment, let pass.exe complete, then contiue and read out.txt and so on ?

Thanks for any assistance.

Joined: Dec 2002
Posts: 395
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2002
Posts: 395
How about using $md5() for that?

Joined: May 2003
Posts: 23
Q
Qwaka Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: May 2003
Posts: 23
Well the FTP I am using has a specific hash, so its not the perfect standard of MD5, I have ot use their salt ? hash ? somethign to create the proerp passwords, using just an MD5 pass generator doesnt create the appropriate passwords.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
The cause of the problem you have with the /timer (always returning the same line) is probably the fact that you're using something like this:
Code:
....
.timer 10 30 msg $nick $2 after MD5 encrypting  = $read(out.txt)
...

This won't evaluate $read() in each repetition; $read() is evaluated during the script execution and the line read is passed to /timer and used every 30 seconds. You need a way to avoid $read()'s evaluation in the script, so the /timer actually receives the "$read(out.txt)" and evaluates it every 30 seconds. Here's how you do it:
Code:
msg $nick $2 after MD5 encrypting  = $[color:red]![/color]read(out.txt)
$!identifier in a script is evaluated to "$identifier", which is exactly what you want.

There's an alternative way, without timers, that can work in your original script. The only thing we need is to have mirc wait for pass.exe to terminate before $reading the line. mirc's built-in /run cannot do that, but Online's /xrun snippet can.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: May 2003
Posts: 23
Q
Qwaka Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: May 2003
Posts: 23
laugh Thank You, your suggestion worked like a charm.

I am reading the xrun snippet you directed me to, its looks like it might not work on my system where I have removed the function of wscript.exe. Is this an accurate belief ?

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
If you uninstalled WSH (Windows Scripting Host) from your system, it won't work. But if you only have wscript.exe blocked (like some popular antivirus software do to prevent malicious scripts from running), it should work with no problems. You can only be sure if you try it; it won't do any harm, the worst thing that can happen is the snippet to not work.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard