On Thu, Sep 08, 2005 at 05:58:05AM +0200, [EMAIL PROTECTED] wrote:
> Quoting Marcin Owsiany <[EMAIL PROTECTED]>:
> > In the meantime, could you provide just a simple shell or python snippet
> > to just decrypt the file, and dump its contents to stdout? Just
> Attached to it is a script which will decrypt the file and print the raw XML
> data to stdout. You have to change a few variables in the top of the script
> before running it. Unfortunately it needs you to save the password to disk
> (unless you use a ramdisk), but it should be fairly easy to modify it
> to ask the user for a password.
Works great, thanks . The attached patch will make it promt for a
password. It also fixes the case when it's longer than 32 bytes, and
makes it work from any directory (uses $HOME).
Marcin Owsiany <[EMAIL PROTECTED]> http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216 FE67 DA2D 0ACA FC5E 3F75 D6F6 3A0D 8AA0 60F4 1216
"Every program in development at MIT expands until it can read mail."
--- rvltoxml.bin 2005-09-08 11:33:05.955597448 +0200
+++ rvltoxml 2005-09-08 11:40:46.679556760 +0200
@@ -2,9 +2,11 @@
from Crypto.Cipher import AES
+from getpass import getpass
+from os import environ
-DATAFILE = "datafile"
-PASSWORD = "password"
+DATAFILE = environ['HOME'] + "/Desktop/memory/passwords"
+PASSWORD = getpass("Enter password for "+DATAFILE+": ")
# read data from file
@@ -13,8 +15,11 @@
-# pad the password
-PASSWORD += (chr(0) * (32 - len(PASSWORD)))
+# crop or pad the password
+if len(PASSWORD) > 32:
+ PASSWORD = PASSWORD[0:32]
+ PASSWORD += (chr(0) * (32 - len(PASSWORD)))
# get the IV
c = AES.new(PASSWORD)