Refactor user and credential handling: rename Creds to User, update database migrations, and add targets subcommand for exporting users and subdomains
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"crowsnest/internal/files"
|
||||
hunter "crowsnest/internal/hunter.io"
|
||||
"crowsnest/internal/pretty"
|
||||
"crowsnest/internal/sqlite"
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
@@ -111,6 +112,24 @@ var (
|
||||
return
|
||||
}
|
||||
|
||||
// Store the users discovered
|
||||
var creds []sqlite.User
|
||||
for _, email := range result.Emails {
|
||||
creds = append(creds, sqlite.User{Email: email.Value})
|
||||
}
|
||||
err = sqlite.StoreUsers(creds)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to store hunter domain search")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("store_hunter_domain_search",
|
||||
zap.String("message", "failed to store hunter domain search"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error storing Hunter.io Domain Search Result: %v\n", err)
|
||||
}
|
||||
|
||||
// Write Hunter.io Domain Search Result to file
|
||||
fmt.Printf("[*] Writing Hunter.io Domain Search Result to file: %s%s\n", hunterOutputFile, fType.Extension())
|
||||
err = export.WriteIStringToFile(result, hunterOutputFile, fType)
|
||||
|
||||
Reference in New Issue
Block a user