Try anonymous piping:
open (RESULTS, "passwd.exe thepassword |");
$encrypted = <RESULTS>;
close RESULTS;
Good luck,
Ember
-----Original Message-----
From: PerlWin32 [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 7:15 PM
To: [EMAIL PROTECTED]
Subject: passwd.exe (redirect the input/output)
Hi
I want to encrypt a password and write this to
the serv-u.ini file.
I have a password utility which will do this for me but can not see how I
intergrate
this into my code below?: (I could do this using tmp files but not very
efficient)
Here are the instructions for passwd.exe
PASSWD.EXE
----------
This is a 32-bit Win32 console application which reads one line
from 'stdin', encrypts it, and writes the result to 'stdout'. You
can test it by simply starting it in a DOS box: Each line you type
gets encrypted. To use it in another program or script you should
redirect the input/output. Worst case it is of course possible to
use temporary files for passing the info, like
'passwd < in.txt > out.txt'.
PASSWD.DLL
PASSWD.H
PASSWD.LIB
=======================================
I can write to the serv-u.ini and the password is plain text, see code
below:
(how do I use passwd.exe so the password is then encrypted?)
#!/usr/bin/perl -w
use strict;
my $domain = shift;
my $user = shift;
my $pass = shift;
if ((!$domain) || (!$user) || (!$pass)) {
print "\t[domain] [username] [password] [\"Error\"]\n";
exit(1);
}
my $template;
open(TEMPLATE, "C:\\Program Files\\Serv-U\\serv-u.template");
{ local $/ = undef; $template = <TEMPLATE>; }
close TEMPLATE;
$template =~ s/\[domain\]/$domain/g;
$template =~ s/\[user\]/$user/g;
$template =~ s/\[pass\]/$pass/g;
open(CONF, ">>C:\\Program Files\\Serv-U\\Serv-u.ini");
print CONF $template;
system("echo FTP account added for $user >> servu.log");
=================
Thanks
Tony
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin