[Tutor] beginner pexpect question

Nathan McBride nomb85 at comcast.net
Wed Feb 13 23:15:56 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anyone have any recomendations?  Seems like it is giving it the
passwords since it finishes cleanly,
but maybe not like I think?

Nate

Nathan McBride wrote:
> Hey guys,
>
> I'm practically still a beginner with python.  I am working on a program
> that originally I used popen for but then switched to pexpect because it
> was easier for me to understand.
> I was hoping someone could help me get this working:
>
> I do a:
>
> child = pexpect.spawn ('cryptsetup --verbose --cipher
> "aes-cbc-essiv:sha256" --key-size 256 --verify-passphrase luksFormat ' +
> self.loopdevice)
>         i = child.expect ([pexpect.TIMEOUT, '.*'])
>         if i == 0:
>             print 'ERROR!'
>             print child.before, child.after
>         child.sendline ('YES')
>         print "Sent YES"
>         child.expect ('.*')
>         #child.sendline ('Test')
>         child.send ('Test\n')
>         print "Sent Pass 1"
>         child.expect ('.*')
>         child.send ('Test\n')
>         print "Sent Pass 2"
>         #child.sendline ('Test')
>
> This runs without errors but then to test I do a:
>
> [root at localhost project]# losetup /dev/loop0 /home/user/deleteme
> [root at localhost project]# cryptsetup luksOpen /dev/loop0 encr-container1
> Enter LUKS passphrase:
> /dev/loop0 is not a LUKS partition
> Command failed: No key available with this passphrase.
>
> I can't understand this at all.  If anyone can help I would appreciate
> it a lot.
>
> Thanks very much,
> Nate
>

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHs2wb/n+duykW6K8RAhcgAJ0T9f5WlxYCFtUtjBirdhxs3jfzzACeJNXr
x8TGYUdeRNbjzw51pG8J+Jg=
=qoOB
-----END PGP SIGNATURE-----



More information about the Tutor mailing list