Skip to content

Commit

Permalink
Add 1Password support and sort results.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinks committed Feb 25, 2017
1 parent a71cf4c commit e9de8d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ go get github.com/jinks/passbleed
* All processing happens in RAM. On my machine it uses about 400 MB
* __The exported CSV contains sensitive data.__ Put it on an encrypted disk and/or _securely_ delete it when you're done.


## Changelog
v1.1:
* Added 1Password CSV support
* Sorted output
21 changes: 15 additions & 6 deletions passbleed.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/url"
"os"
"sort"
"strings"

"golang.org/x/net/publicsuffix"
Expand All @@ -19,6 +20,10 @@ const (
_
KeePass1Format
KeePassXFormat
_
_
_
OnePasswordFormat
)

// Domain to check
Expand All @@ -32,13 +37,16 @@ func findCSVType(reader *csv.Reader) (int, error) {
} else if err != nil {
return UnknownFormat, err
}
if header[3] == "Web Site" {
if len(header) >= 4 && header[3] == "Web Site" {
return KeePass1Format, nil
}
if header[4] == "URL" {
if len(header) >= 5 && header[4] == "URL" {
return KeePassXFormat, nil
}
return UnknownFormat, fmt.Errorf("unkonwn CSV format, please use KeePass2 or KeePassX CSV export")
if len(header) >= 9 && header[8] == "urls" {
return OnePasswordFormat, nil
}
return UnknownFormat, fmt.Errorf("unkonwn CSV format, please use KeePass2, KeePassX or 1Password CSV export")

}

Expand Down Expand Up @@ -118,9 +126,10 @@ func main() {
}
fmt.Print(cloudBleed.Cardinality(), " domains found.\n\n")

inDanger := keepass.Intersect(*cloudBleed)
fmt.Println(inDanger.Cardinality(), "potentially endangered domains:")
for k := range inDanger {
inDanger := keepass.Intersect(*cloudBleed).ToSlice()
sort.Slice(inDanger, func(i, j int) bool { return inDanger[i] < inDanger[j] })
fmt.Println(len(inDanger), "potentially endangered domains:")
for _, k := range inDanger {
fmt.Println(k)
}

Expand Down

0 comments on commit e9de8d4

Please sign in to comment.