Skip to content

Commit

Permalink
updated changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
netevert committed Feb 6, 2019
1 parent ccd19c7 commit 6e6e5b9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 33 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [unreleased]
## [1.2.0] - 2019-01-06

### Added

- Download and store certificate common names from transparency logs in a local database
- Download and store certificate common names from transparency logs in local database
- Ability to select a specific transparency log for download
- Ability to select search source between crt.sh and local database

### Fixed

- Code formatting

## [1.1.1] - 2019-01-20

### Added
Expand Down
65 changes: 34 additions & 31 deletions delator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
r = color.New(color.FgHiRed)
writer = new(tabwriter.Writer)
wg = &sync.WaitGroup{}
newSet = flag.NewFlagSet("newSet", flag.ContinueOnError)
newSet = flag.NewFlagSet("newSet", flag.ContinueOnError)
domain = newSet.String("d", "", "input domain")
source = newSet.String("s", "", "search source")
resolve = newSet.Bool("a", false, "view A record")
Expand Down Expand Up @@ -76,9 +76,9 @@ type record struct {

type logSelection struct {
selectionNumber int
logValue string
logSize uint64
status string
logValue string
logSize uint64
status string
}

// helper function to print errors and exit
Expand Down Expand Up @@ -296,7 +296,7 @@ func storeKnownLogs() {
tmp.status = "unavailable"
}
tmp.logSize = size
s := fmt.Sprintf("%d\t%d\t%s\t%s\t", tmp.selectionNumber, tmp.logSize, tmp. status, tmp.logValue)
s := fmt.Sprintf("%d\t%d\t%s\t%s\t", tmp.selectionNumber, tmp.logSize, tmp.status, tmp.logValue)
fmt.Fprintln(writer, s)
writer.Flush()
collection = append(collection, tmp)
Expand All @@ -305,7 +305,7 @@ func storeKnownLogs() {
}

// helper function to read user supplied answer and start ct log download
func readSelection(data[]logSelection , maxSelection int) {
func readSelection(data []logSelection, maxSelection int) {
selectionRange := makeRange(0, maxSelection)
reader := bufio.NewReader(os.Stdin)
fmt.Printf("Select log (default 'ct.googleapis.com/pilot/') [all | 0-%d]:", maxSelection)
Expand All @@ -314,7 +314,7 @@ func readSelection(data[]logSelection , maxSelection int) {
if text == "" {
// download default log
grabCTLog("https://ct.googleapis.com/pilot/")
} else if text == "all"{
} else if text == "all" {
// download data for all logs
downloadCTLogs()
} else {
Expand All @@ -323,12 +323,12 @@ func readSelection(data[]logSelection , maxSelection int) {
r.Printf("answer is invalid\n")
readSelection(data, maxSelection)
}
if contains (selectionRange, selection){
if contains(selectionRange, selection) {
// select url from data supplied
for i := range(data){
for i := range data {
log := data[i]
if log.selectionNumber == selection {
if log.status != "unavailable"{
if log.status != "unavailable" {
grabCTLog("https://" + log.logValue)
} else {
r.Printf("log is unavailable\n")
Expand All @@ -348,21 +348,21 @@ func readSelection(data[]logSelection , maxSelection int) {

// helper function to check membership of a number in a slice
func contains(s []int, e int) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
for _, a := range s {
if a == e {
return true
}
}
return false
}

// helper function to make a slice of numbers
func makeRange(min, max int) []int {
a := make([]int, max-min+1)
for i := range a {
a[i] = min + i
}
return a
a := make([]int, max-min+1)
for i := range a {
a[i] = min + i
}
return a
}

// returns a list of all known certificate transparency log URLs
Expand Down Expand Up @@ -399,7 +399,7 @@ func grabLogSize(URL string) (uint64, error) {
if err != nil {
return uint64(0), err
}

var sth ct.SignedTreeHead
json.Unmarshal([]byte(body), &sth)
return sth.TreeSize, err
Expand Down Expand Up @@ -441,12 +441,12 @@ func grabCTLog(inputLog string) {
opts := scanner.ScannerOptions{
FetcherOptions: scanner.FetcherOptions{
BatchSize: 1000,
ParallelFetch: 4,
ParallelFetch: 12,
StartIndex: 0,
EndIndex: 0,
},
Matcher: matcher,
NumWorkers: 8,
NumWorkers: 12,
}
scanner := scanner.NewScanner(logClient, opts)

Expand Down Expand Up @@ -493,7 +493,7 @@ func queryDatabase(query string) {
if err != nil {
fmt.Println(err)
}
fmt.Println(subdomain)
y.Printf(subdomain + "\n")
}
err = rows.Err()
if err != nil {
Expand All @@ -511,9 +511,12 @@ func setup() {
newSet.PrintDefaults()
os.Exit(1)
}

newSet.Parse(os.Args[1:])

// workaround to suppress glog errors, as per https://github.com/kubernetes/kubernetes/issues/17162#issuecomment-225596212
flag.CommandLine.Parse([]string{})

if *store {
storeKnownLogs()
os.Exit(1)
Expand Down Expand Up @@ -552,17 +555,17 @@ func main() {
subdomains := fetchData(fmt.Sprintf("https://crt.sh/?q=%s&output=json", sanitizedDomain))
if *resolve {
printResults(extractSubdomains(subdomains))
} else {
printData(subdomains)
}
os.Exit(1)
} else {
printData(subdomains)
}
os.Exit(1)
}
if *source == "db" {
sanitizedDomain := sanitizedInput(*domain)
queryDatabase(sanitizedDomain)
os.Exit(1)
}
if (*source != "net" || *source != "db") {
if *source != "net" || *source != "db" {
r.Printf("\ninvalid source [db|all]\n\n")
fmt.Println(utilDescription)
newSet.PrintDefaults()
Expand Down
Binary file modified docs/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e6e5b9

Please sign in to comment.