Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-26-2005, 04:56 AM   #1
LQ Newbie
Registered: May 2005
Posts: 3

Rep: Reputation: 0
A question about expect.


I have this expect script so that password can be given via command line
#!/usr/bin/expect -f
set passphrase [lindex $argv 1]
spawn mcrypt [lindex $argv 0]  
expect "passphrase:"         
send "$passphrase\r"
expect "passphrase:"
send "$passphrase\r"
expect "encrypted."
(Yes,it's insecure but I have to do the encryption job automatically with cron job.)

It works fine with small files. But when I tried to encrypt a large file which is 3GB . The script terminated before finishing the encryption. Everytime when the size of generated .nc file grew up to 66M also , the script quit.

What's the problem? Is there any resource limit of expect we should take care of ?

Thanks in advance.

Last edited by imjoe; 10-26-2005 at 04:57 AM.
Old 10-26-2005, 05:42 AM   #2
LQ Newbie
Registered: May 2005
Posts: 3

Original Poster
Rep: Reputation: 0
I'm an idiot.
mcrypt can do this.
`--key KEY1 KEY2 ...'
`-k KEY1 KEY2 ...'
Enter the keyword(s) via the command line. The KEY(s) is/are then used as keyword instead of prompting for them. Keep in mind that someone may see the command you are executing and so your keyword(s).
`--config FILE'
`-c FILE'
Use the specified configuration file. The default is .mcryptrc in your home directory. The format of the configuration file is the same as the parameters. An example file is: algorithm twofish-256 mode cbc key a_secret_one 4bits
`--keyfile FILE'
Enter the keyword(s) via a file. One keyword is read per line. The first keyword read is used for the first file, the second for the second file etc. If the keywords are less than the files then the last keyword is used for the remaining. A limitation is that you cannot use the NULL (\\0) and the Newline (\\n) character in the key. A solution to this problem is to specify the keyword in hex mode, using the --hex parameter.
`--mode MODE'


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Possibly the dumbest question I would ever expect to ask pyrael Linux - General 9 11-22-2005 06:52 AM
expect question deiussum Programming 0 08-05-2005 04:51 PM
expect question reitzell Programming 1 11-20-2004 10:03 AM
Double and single quote, Question in expect evilchild Programming 4 08-22-2004 06:34 PM
"expect" shell beginner question, please help me out yuzuohong Linux - General 1 06-28-2003 02:17 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration