pwman-tools

Check-in [1ead16f19c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Store secure notes in the "launch" field as it's 256 vs 64 char

And secure notes are likely to be longer. Since whole file is encrypted
anyway, doesn't matter which field you use to store things in. Saves
patching PWman to make the password field accept more chars.

Add note to README regarding this known limitation.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 1ead16f19c3a9911b2140f890ce9f19bce49ee7b396e1ae50d83e8e643e98e45
User & Date: atomicules@lavabit.com 2013-02-03 21:42:51
Context
2013-07-16
11:44
Create LICENSE check-in: bbd0069fdd user: atomicules@lavabit.com tags: master, trunk
2013-02-03
21:42
Store secure notes in the "launch" field as it's 256 vs 64 char

And secure notes are likely to be longer. Since whole file is encrypted
anyway, doesn't matter which field you use to store things in. Saves
patching PWman to make the password field accept more chars.

Add note to README regarding this known limitation. check-in: 1ead16f19c user: atomicules@lavabit.com tags: master, trunk

21:35
Use Ascii armoured output

Note that this doesn't hugely matter. PWman has no trouble reading the
file under normal encryption and will convert it to Ascii when saving it
anyway, but using Ascii up front is more what you'd expect. check-in: d3432a1e16 user: atomicules@lavabit.com tags: master, trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.markdown.

1
2
3
4
5
6
7
8
9
10
11
12
13




#Lastpass2pwman

CLisp script for SBCL to convert [Lastpass](https://lastpass.com) CSV export to [PWman](http://pwman.sourceforge.net) format.

Mainly done as a little learning exercise in Lisp for me, but also because I use Lastpass and also want to use a command line based password manager. Unfortunately there doesn't seem to be a command line client for Lastpass so I'm going to use PWman and every so often do a one way update of passwords.

## How to use

Developed and tested in SBCL. Use as follows

	sbcl --script /path/to/this/script <gpg id used with pwman> </path/to/lastpass/export>

The path to the Lastpass export is optional. If not supplied assumes file is called "lastpass.csv" and is in current directory. The script works by first exporting a plain text file called "pwman.txt" to current directory, however, this is then immediately encrypted via GPG and replaces the `.pwman.db` file. Both plain text files (the Lastpass export and `pwman.txt`) are then deleted - unless an error occurs with the encryption, in which case the script notifies the user and leaves the files.

















>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#Lastpass2pwman

CLisp script for SBCL to convert [Lastpass](https://lastpass.com) CSV export to [PWman](http://pwman.sourceforge.net) format.

Mainly done as a little learning exercise in Lisp for me, but also because I use Lastpass and also want to use a command line based password manager. Unfortunately there doesn't seem to be a command line client for Lastpass so I'm going to use PWman and every so often do a one way update of passwords.

## How to use

Developed and tested in SBCL. Use as follows

	sbcl --script /path/to/this/script <gpg id used with pwman> </path/to/lastpass/export>

The path to the Lastpass export is optional. If not supplied assumes file is called "lastpass.csv" and is in current directory. The script works by first exporting a plain text file called "pwman.txt" to current directory, however, this is then immediately encrypted via GPG and replaces the `.pwman.db` file. Both plain text files (the Lastpass export and `pwman.txt`) are then deleted - unless an error occurs with the encryption, in which case the script notifies the user and leaves the files.

## Known issues

PWman has a maximum password length of 64 characters therefore secure notes are stored in the launch field of PWman. Since the whole file is encrypted it doesn't really matter which field is used. The launch field allows up to 256 characters. If your secure notes are longer than this, then PWman will truncate them when saving. Also, note that although PWman will store 256 characters correctly it won't necessarily display them all correctly (the field was intended for displaying a single line of text), but the data will be in the file.

Changes to lastpass2pwman.lisp.

33
34
35
36
37
38
39
40
41
42
43
44
45
46



47
48
49
50
51
52
53
			(multiple-value-bind (returned? groupname groupentries) (group)
			(if returned?
				(progn
					(format stream "<PwList name=\"~a\">" groupname)
					;Then loop through each entry in group
					(loop for entry in groupentries
						do (format stream
							"<PwItem><name>~a</name><host>~a</host><user>~a</user><passwd>~a</passwd><launch></launch></PwItem>"
							(xmls:toxml (fifth entry))
							(xmls:toxml (first entry))
							(xmls:toxml (second entry))
							(if (null (third entry)) ;Secure Notes have no password
								(xmls:toxml (fourth entry)) ;Use extra field if Secure Note
								(xmls:toxml (third entry)))))



					(format stream "</PwList>"))
				(return)))))
	(format stream "</PwList></PWMan_PasswordList>"))
;Move original file to backup
(rename-file (concatenate 'string (sb-unix::posix-getenv "HOME") "/.pwman.db") (concatenate 'string (sb-unix::posix-getenv "HOME") "/.pwman.db.bak"))
;gpg encrpyt the file
(let ((proc (sb-ext:run-program "gpg" (list "-a" "-r" gpgid "-o" (concatenate 'string (sb-unix::posix-getenv "HOME") "/.pwman.db") "-e" "pwman.txt") :search :environment)))







|




|
|
>
>
>







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
			(multiple-value-bind (returned? groupname groupentries) (group)
			(if returned?
				(progn
					(format stream "<PwList name=\"~a\">" groupname)
					;Then loop through each entry in group
					(loop for entry in groupentries
						do (format stream
							"<PwItem><name>~a</name><host>~a</host><user>~a</user><passwd>~a</passwd><launch>~a</launch></PwItem>"
							(xmls:toxml (fifth entry))
							(xmls:toxml (first entry))
							(xmls:toxml (second entry))
							(if (null (third entry)) ;Secure Notes have no password
								"" ;put nothing in pwman password field if Secure Note
								(xmls:toxml (third entry))) 
							(if (null (third entry)) 
								(xmls:toxml (fourth entry)) ;Use launch field for Secure Notes as it is longer
								"")))
					(format stream "</PwList>"))
				(return)))))
	(format stream "</PwList></PWMan_PasswordList>"))
;Move original file to backup
(rename-file (concatenate 'string (sb-unix::posix-getenv "HOME") "/.pwman.db") (concatenate 'string (sb-unix::posix-getenv "HOME") "/.pwman.db.bak"))
;gpg encrpyt the file
(let ((proc (sb-ext:run-program "gpg" (list "-a" "-r" gpgid "-o" (concatenate 'string (sb-unix::posix-getenv "HOME") "/.pwman.db") "-e" "pwman.txt") :search :environment)))