Skip to content

Commit

Permalink
LastPass support and embedded quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinks committed Feb 27, 2017
1 parent 240feee commit bccf76b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ go get github.com/jinks/passbleed
* __The exported CSV contains sensitive data.__ Put it on an encrypted disk and/or _securely_ delete it when you're done.

## Changelog
v1.2:
* Support emebedded quotes
* Added LastPass CSV support (untested)

v1.1:
* Added 1Password CSV support
* Sorted output
19 changes: 11 additions & 8 deletions passbleed.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (

// Different CSV formats
const (
UnknownFormat = iota
UnknownFormat = -1 + iota
LastPassFormat
_
_
KeePass1Format
Expand All @@ -37,17 +38,18 @@ func findCSVType(reader *csv.Reader) (int, error) {
} else if err != nil {
return UnknownFormat, err
}
if len(header) >= 4 && header[3] == "Web Site" {
switch {
case len(header) >= 1 && header[0] == "url":
return LastPassFormat, nil
case len(header) >= 4 && header[3] == "Web Site":
return KeePass1Format, nil
}
if len(header) >= 5 && header[4] == "URL" {
case len(header) >= 5 && header[4] == "URL":
return KeePassXFormat, nil
}
if len(header) >= 9 && header[8] == "urls" {
case len(header) >= 9 && header[8] == "urls":
return OnePasswordFormat, nil
default:
return UnknownFormat, fmt.Errorf("unkonwn CSV format, please use a supported export format (see README)")
}
return UnknownFormat, fmt.Errorf("unkonwn CSV format, please use KeePass2, KeePassX or 1Password CSV export")

}

func buildKeepass(filename string) (*DomainSet, error) {
Expand All @@ -58,6 +60,7 @@ func buildKeepass(filename string) (*DomainSet, error) {
defer file.Close()

reader := csv.NewReader(file)
reader.LazyQuotes = true
col, err := findCSVType(reader)
if err != nil {
return nil, err
Expand Down

0 comments on commit bccf76b

Please sign in to comment.