2005/9/12, Mauro Stettler <[EMAIL PROTECTED]>:
> 2005/9/12, John W. Krahn <[EMAIL PROTECTED]>:
> > Mauro Stettler wrote:
> > > hi together
> >
> > Hello,
> >
> > > im writing a perlscript which should be able to create a cryptoloop
> > > onto a device. the console command to do this is losetup /dev/loo0
> > > /dev/sdb1 -e twofish-256, then i am asked for a password... the
> > > problem is, this password is requested by the function getpass(), i
> > > don't know how i can enter it from a perl script.
> > >
> > > it seems to only listen to the keyboard, how can i enter the password
> > > from a script?
> >
> > That is a security feature that requires the program input/output be 
> > connected
> > to a TTY (terminal).  To do what you want from perl you have to connect the
> > program to a pseudo TTY.
> >
> > perldoc Expect
> >
> >
> > John
> > --
> > use Perl;
> > program
> > fulfillment
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > <http://learn.perl.org/> <http://learn.perl.org/first-response>
> >
> >
> >
> 
> hi
> 
> i tried this:
> 
> open(BASH, "| /bin/bash");
> print BASH "losetup /dev/loop0 /dev/sdb1 -e twofish-256";
> print BASH "<pass>";
> close (BASH);
> 
> but it didn't work...
> 
> how can i connect to a pseudo terminal?
> 

hi again

now i found the module IO::Pty from cpan. with that i should be able
to create a pseudo tty, but i don't really know how to handle it.

this didn't work:


use IO::Pty;

$pty = new IO::Pty;

print $pty "/sbin/losetup /dev/loop0 /dev/sda1 -e twofish-256\n";
print $pty "pass\n";


how do i have to use this?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to