LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

Rep: Reputation: 0
A question about expect.


Hi,there,

I have this expect script so that password can be given via command line
Code:
#!/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 03:57 AM.
 
Old 10-26-2005, 04:42 AM   #2
imjoe
LQ Newbie
 
Registered: May 2005
Posts: 3

Original Poster
Rep: Reputation: 0
I'm an idiot.
mcrypt can do this.
http://www.ugcs.caltech.edu/info/mcrypt/mcrypt_5.html
Quote:
`--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'
`-f'
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'
 
  


Reply



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 05:52 AM
expect question deiussum Programming 0 08-05-2005 03:51 PM
expect question reitzell Programming 1 11-20-2004 09:03 AM
Double and single quote, Question in expect evilchild Programming 4 08-22-2004 05:34 PM
"expect" shell beginner question, please help me out yuzuohong Linux - General 1 06-28-2003 01:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:20 AM.

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