Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
ccrypt with expect

Posted by neo (The Architect), 27 August 2005
Has anyone written an expect script that uses 'ccrypt' to encrypt a file.
I tried expecting the 'Enter encryption key: ' but the password that I send is then displayed on the screen.  

Posted by admin (Graham Ellis), 27 August 2005
Code:
log_user 0
spawn ./ccrypt -e demoenc.txt
expect "Enter encryption key: "
send "abc123\r"
expect "(repeat) "
send "abc123\r"
expect eof


worked for me ....

Posted by neo (The Architect), 27 August 2005
I'm using CYGWIN and the code you gave did not work.  
It just hangs, I removed the log_user 0 and then saw the password being typed out in plaintext.


Posted by admin (Graham Ellis), 27 August 2005
on 08/27/05 at 11:00:24, The Architect wrote:
I'm using CYGWIN and the code you gave did not work. ....


Expect sits on top of the applications and operating system, and as such it needs fine tuning and adjustment sometimes. Have a careful look at how the script runs without the log_user line and that should lead you to learn where it's failing in more detail, and from that it should lead you to a solution.  I'm afraid I don't have Cygwyn to hand, so I can't easily help further with this issue that has turned out to be OS specific.

Posted by neo (The Architect), 29 August 2005
I am using the -K option to specify the password along with the command right now.
I have another (not actually related) doubt though.
Can I pause my script halfway and ask the user for a password and then resume the script?
I tried
Code:
interact{
  -re ".*\r" { send_user "got it\n";}
}

but it just keeps on in the loop.

Posted by admin (Graham Ellis), 29 August 2005
An interact keeps running until it hits a return command in its deffered block.  You don't have one, so your interact won't exit.

Posted by neo (The Architect), 29 August 2005
  In english please?  

Posted by admin (Graham Ellis), 29 August 2005
on 08/29/05 at 11:14:57, The Architect wrote:
  In english please?  


Sorry - I mis-spelled that. Should have been deferred rather than deffered.   It DID look a bit odd that other way, didn't it?

Posted by neo (The Architect), 11 September 2005
Yeah it did.
And yeah I still don't understand it too.  



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho