Added hunter.io functions and file writes.
This commit is contained in:
+5
-5
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Add query command to root command
|
||||
// Add api command to root command
|
||||
rootCmd.AddCommand(apiCmd)
|
||||
|
||||
// Add flags specific to api command
|
||||
@@ -25,7 +25,7 @@ func init() {
|
||||
apiCmd.Flags().StringVarP(&outputFormat, "format", "f", "json", "Output format (json, yaml, xml, txt)")
|
||||
apiCmd.Flags().StringVarP(&outputFile, "output", "o", "query", "File to output results to including extension")
|
||||
apiCmd.Flags().StringVarP(&usernameQuery, "username", "U", "", "Username query")
|
||||
apiCmd.Flags().StringVarP(&emailQuery, "email-query", "E", "", "Email query")
|
||||
apiCmd.Flags().StringVarP(&emailQuery, "email-query", "E", "", "HunterEmail query")
|
||||
apiCmd.Flags().StringVarP(&ipQuery, "ip", "I", "", "IP address query")
|
||||
apiCmd.Flags().StringVarP(&domainQuery, "domain", "D", "", "Domain query")
|
||||
apiCmd.Flags().StringVarP(&passwordQuery, "password", "P", "", "Password query")
|
||||
@@ -73,7 +73,7 @@ var (
|
||||
Short: "Query the Dehashed API",
|
||||
Long: `Query the Dehashed API for emails, usernames, passwords, hashes, IP addresses, and names.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
key := getStoredApiKey()
|
||||
key := getDehashedApiKey()
|
||||
|
||||
// Validate credentials
|
||||
if key == "" {
|
||||
@@ -135,6 +135,6 @@ var (
|
||||
)
|
||||
|
||||
// Helper functions to get stored API credentials
|
||||
func getStoredApiKey() string {
|
||||
return badger.GetKey()
|
||||
func getDehashedApiKey() string {
|
||||
return badger.GetDehashedKey()
|
||||
}
|
||||
|
||||
+429
@@ -0,0 +1,429 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"dehasher/internal/badger"
|
||||
"dehasher/internal/debug"
|
||||
"dehasher/internal/export"
|
||||
"dehasher/internal/files"
|
||||
hunter "dehasher/internal/hunter.io"
|
||||
"dehasher/internal/pretty"
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Add hunter command to root command
|
||||
rootCmd.AddCommand(hunterCmd)
|
||||
|
||||
// Add flags specific to hunter command
|
||||
hunterCmd.Flags().StringVarP(&hunterDomain, "domain", "d", "", "Domain to query")
|
||||
hunterCmd.Flags().StringVarP(&hunterEmail, "email", "e", "", "Email to query")
|
||||
hunterCmd.Flags().StringVarP(&hunterFirstName, "first-name", "F", "", "First name to query")
|
||||
hunterCmd.Flags().StringVarP(&hunterLastName, "last-name", "L", "", "Last name to query")
|
||||
hunterCmd.Flags().BoolVarP(&hunterDomainSearch, "domain-search", "D", false, "Search for domain")
|
||||
hunterCmd.Flags().BoolVarP(&hunterEmailFind, "email-find", "E", false, "Find emails for user using domain, first name, and last name")
|
||||
hunterCmd.Flags().BoolVarP(&hunterEmailVerify, "email-verify", "V", false, "Verify email")
|
||||
hunterCmd.Flags().BoolVarP(&hunterCompanyEnrichmentDomain, "company-enrichment", "C", false, "Company enrichment for domain")
|
||||
hunterCmd.Flags().BoolVarP(&hunterPersonEnrichmentEmail, "person-enrichment", "P", false, "Person enrichment for email")
|
||||
hunterCmd.Flags().BoolVarP(&hunterCombinedEnrichmentEmail, "combined-enrichment", "B", false, "Combined Company and Person enrichment for email")
|
||||
hunterCmd.Flags().StringVarP(&hunterOutputFormat, "format", "f", "json", "Output format (json, yaml, xml, txt)")
|
||||
hunterCmd.Flags().StringVarP(&hunterOutputFile, "output", "o", "hunter", "File to output results to including extension")
|
||||
|
||||
// Add mutually exclusive flags to hunter command
|
||||
hunterCmd.MarkFlagsMutuallyExclusive("email-find")
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
// Hunter Commands Flags
|
||||
hunterDomain string
|
||||
hunterEmail string
|
||||
hunterFirstName string
|
||||
hunterLastName string
|
||||
hunterDomainSearch bool
|
||||
hunterEmailFind bool
|
||||
hunterEmailVerify bool
|
||||
hunterCompanyEnrichmentDomain bool
|
||||
hunterPersonEnrichmentEmail bool
|
||||
hunterCombinedEnrichmentEmail bool
|
||||
hunterOutputFormat string
|
||||
hunterOutputFile string
|
||||
|
||||
hunterCmd = &cobra.Command{
|
||||
Use: "hunter",
|
||||
Short: "Hunter.io API interaction",
|
||||
Long: `Interact with the Hunter.io API for email and domain information.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("debug mode enabled")
|
||||
zap.L().Info("hunter_debug",
|
||||
zap.String("message", "debug mode enabled"),
|
||||
)
|
||||
}
|
||||
|
||||
// Flag Checks
|
||||
if !hunterFlagCheck() {
|
||||
return
|
||||
}
|
||||
|
||||
if hunterOutputFile == "" {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("output file not specified, using default")
|
||||
}
|
||||
hunterOutputFile = "hunter_" + time.Now().Format("05_04_05")
|
||||
}
|
||||
|
||||
if hunterOutputFormat == "" {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("output format not specified, using default")
|
||||
}
|
||||
hunterOutputFormat = "json"
|
||||
}
|
||||
|
||||
fType := files.GetFileType(hunterOutputFormat)
|
||||
if fType == files.UNKNOWN {
|
||||
fmt.Println("[!] Error: Invalid output format. Must be 'json', 'xml', 'yaml', or 'txt'.")
|
||||
return
|
||||
}
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("using output format: " + hunterOutputFormat)
|
||||
}
|
||||
|
||||
fmt.Println("[*] Hunter.io API interaction [Beta]")
|
||||
|
||||
h := hunter.NewHunterIO(getHunterApiKey(), debugGlobal)
|
||||
|
||||
if hunterDomainSearch {
|
||||
fmt.Println("[*] Performing domain search search...")
|
||||
result, err := h.DomainSearch(hunterDomain)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to perform domain search")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("hunter_domain_search",
|
||||
zap.String("message", "failed to perform domain search"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error performing domain search: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 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.WriteHunterDomainToFile(result, hunterOutputFile, fType)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to write hunter domain search to file")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("write_hunter_domain_search",
|
||||
zap.String("message", "failed to write hunter domain search to file"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error writing Hunter.io Domain Search Result to file: %v\n", err)
|
||||
}
|
||||
|
||||
// Pretty Print Hunter.io Domain Search Result
|
||||
fmt.Println("Domain Search Result:")
|
||||
pretty.HunterDomainTree(hunterDomain, result)
|
||||
return
|
||||
}
|
||||
|
||||
if hunterEmailFind {
|
||||
fmt.Println("[*] Performing email find search...")
|
||||
result, err := h.EmailFinder(hunterDomain, hunterFirstName, hunterLastName)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to perform email find")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("hunter_email_find",
|
||||
zap.String("message", "failed to perform email find"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error performing email find: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Write Hunter.io Email Finder Result to file
|
||||
fmt.Printf("[*] Writing Hunter.io Email Finder Result to file: %s%s\n", hunterOutputFile, fType.Extension())
|
||||
err = export.WriteHunterEmailToFile(result, hunterOutputFile, fType)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to write hunter email find to file")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("write_hunter_email_find",
|
||||
zap.String("message", "failed to write hunter email find to file"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error writing Hunter.io Email Finder Result to file: %v\n", err)
|
||||
}
|
||||
|
||||
fmt.Println("Email Find Result:")
|
||||
|
||||
var (
|
||||
headers = []string{"Email", "Score", "Domain", "Accept All", "Position", "Twitter", "Linkedin", "Phone Number", "Company", "Sources", "Verification"}
|
||||
rows [][]string
|
||||
)
|
||||
|
||||
rows = append(rows, []string{
|
||||
result.Email,
|
||||
fmt.Sprintf("%d", result.Score),
|
||||
result.Domain,
|
||||
fmt.Sprintf("%t", result.AcceptAll),
|
||||
result.Position,
|
||||
result.Twitter,
|
||||
result.LinkedinURL,
|
||||
result.PhoneNumber,
|
||||
result.Company,
|
||||
fmt.Sprintf("%v", result.Sources),
|
||||
fmt.Sprintf("%v", result.Verification),
|
||||
})
|
||||
|
||||
pretty.Table(headers, rows)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if hunterEmailVerify {
|
||||
fmt.Println("[*] Performing email verification search...")
|
||||
result, err := h.EmailVerification(hunterEmail)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to perform email verification")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("hunter_email_verification",
|
||||
zap.String("message", "failed to perform email verification"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error performing email verification: %v\n", err)
|
||||
return
|
||||
}
|
||||
// Write Hunter.io Email Verification Result to file
|
||||
fmt.Printf("[*] Writing Hunter.io Email Verification Result to file: %s%s\n", hunterOutputFile, fType.Extension())
|
||||
err = export.WriteHunterEmailVerifyToFile(result, hunterOutputFile, fType)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to write hunter email verification to file")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("write_hunter_email_verification",
|
||||
zap.String("message", "failed to write hunter email verification to file"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error writing Hunter.io Email Verification Result to file: %v\n", err)
|
||||
}
|
||||
|
||||
// Pretty Print Hunter.io Email Verification Result
|
||||
var (
|
||||
headers = []string{"Email", "Status", "Result", "Score", "Regexp", "Gibberish", "Disposable", "Webmail", "MX Records", "SMTP Server", "SMTP Check", "Accept All", "Block", "Sources"}
|
||||
rows [][]string
|
||||
)
|
||||
rows = append(rows, []string{
|
||||
result.Email,
|
||||
result.Status,
|
||||
result.Result,
|
||||
fmt.Sprintf("%d", result.Score),
|
||||
fmt.Sprintf("%t", result.Regexp),
|
||||
fmt.Sprintf("%t", result.Gibberish),
|
||||
fmt.Sprintf("%t", result.Disposable),
|
||||
fmt.Sprintf("%t", result.Webmail),
|
||||
fmt.Sprintf("%t", result.MXRecords),
|
||||
fmt.Sprintf("%t", result.SMTPServer),
|
||||
fmt.Sprintf("%t", result.SMTPCheck),
|
||||
fmt.Sprintf("%t", result.AcceptAll),
|
||||
fmt.Sprintf("%t", result.Block),
|
||||
fmt.Sprintf("%v", result.Sources),
|
||||
})
|
||||
|
||||
fmt.Println("Email Verification Result:")
|
||||
pretty.Table(headers, rows)
|
||||
return
|
||||
}
|
||||
|
||||
if hunterCompanyEnrichmentDomain {
|
||||
fmt.Println("[*] Performing company enrichment search...")
|
||||
result, err := h.CompanyEnrichment(hunterDomain)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to perform company enrichment")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("hunter_company_enrichment",
|
||||
zap.String("message", "failed to perform company enrichment"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error performing company enrichment: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Write to file
|
||||
fmt.Printf("[*] Writing Hunter.io Company Enrichment Result to file: %s%s\n", hunterOutputFile, fType.Extension())
|
||||
err = export.WriteHunterCompanyEnrichmentToFile(result, hunterOutputFile, fType)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to write hunter company enrichment to file")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("write_hunter_company_enrichment",
|
||||
zap.String("message", "failed to write hunter company enrichment to file"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error writing Hunter.io Company Enrichment Result to file: %v\n", err)
|
||||
}
|
||||
|
||||
// Pretty Print Hunter.io Company Enrichment Result
|
||||
fmt.Println("Company Enrichment Result:")
|
||||
pretty.HunterCompanyEnrichmentTree(hunterDomain, result)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if hunterPersonEnrichmentEmail {
|
||||
fmt.Println("[*] Performing person enrichment search...")
|
||||
result, err := h.PersonEnrichment(hunterEmail)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to perform person enrichment")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("hunter_person_enrichment",
|
||||
zap.String("message", "failed to perform person enrichment"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error performing person enrichment: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Write to file
|
||||
fmt.Printf("[*] Writing Hunter.io Person Enrichment Result to file: %s%s\n", hunterOutputFile, fType.Extension())
|
||||
err = export.WriteHunterPersonEnrichmentToFile(result, hunterOutputFile, fType)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to write hunter person enrichment to file")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("write_hunter_person_enrichment",
|
||||
zap.String("message", "failed to write hunter person enrichment to file"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error writing Hunter.io Person Enrichment Result to file: %v\n", err)
|
||||
}
|
||||
|
||||
// Pretty Print Hunter.io Person Enrichment Result
|
||||
fmt.Println("Person Enrichment Result:")
|
||||
pretty.HunterPersonEnrichmentTree(hunterEmail, result)
|
||||
return
|
||||
}
|
||||
|
||||
if hunterCombinedEnrichmentEmail {
|
||||
fmt.Println("[*] Performing combined enrichment search...")
|
||||
result, err := h.CombinedEnrichment(hunterEmail)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to perform combined enrichment")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("hunter_combined_enrichment",
|
||||
zap.String("message", "failed to perform combined enrichment"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error performing combined enrichment: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Write to file
|
||||
fmt.Printf("[*] Writing Hunter.io Combined Enrichment Result to file: %s%s\n", hunterOutputFile, fType.Extension())
|
||||
err = export.WriteHunterCombinedEnrichmentToFile(result, hunterOutputFile, fType)
|
||||
if err != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to write hunter combined enrichment to file")
|
||||
debug.PrintError(err)
|
||||
}
|
||||
zap.L().Error("write_hunter_combined_enrichment",
|
||||
zap.String("message", "failed to write hunter combined enrichment to file"),
|
||||
zap.Error(err),
|
||||
)
|
||||
fmt.Printf("Error writing Hunter.io Combined Enrichment Result to file: %v\n", err)
|
||||
}
|
||||
|
||||
fmt.Println("Combined Enrichment Result:")
|
||||
pretty.HunterCombinedEnrichmentTree(hunterEmail, result)
|
||||
return
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func hunterFlagCheck() bool {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("checking flags")
|
||||
}
|
||||
|
||||
var optionSet bool
|
||||
|
||||
if hunterDomainSearch {
|
||||
if hunterDomain == "" {
|
||||
fmt.Println("Domain is required for domain search")
|
||||
return false
|
||||
}
|
||||
optionSet = true
|
||||
}
|
||||
if hunterEmailVerify {
|
||||
if hunterEmail == "" {
|
||||
fmt.Println("Email is required for email verification")
|
||||
return false
|
||||
}
|
||||
optionSet = true
|
||||
}
|
||||
if hunterCompanyEnrichmentDomain {
|
||||
if hunterDomain == "" {
|
||||
fmt.Println("Domain is required for company enrichment")
|
||||
return false
|
||||
}
|
||||
optionSet = true
|
||||
}
|
||||
if hunterPersonEnrichmentEmail {
|
||||
if hunterEmail == "" {
|
||||
fmt.Println("Email is required for person enrichment")
|
||||
return false
|
||||
}
|
||||
optionSet = true
|
||||
}
|
||||
if hunterCombinedEnrichmentEmail {
|
||||
if hunterEmail == "" {
|
||||
fmt.Println("Email is required for combined enrichment")
|
||||
return false
|
||||
}
|
||||
optionSet = true
|
||||
}
|
||||
if hunterEmailFind {
|
||||
if hunterFirstName == "" || hunterLastName == "" {
|
||||
fmt.Println("First name and last name are required for email find")
|
||||
return false
|
||||
}
|
||||
if hunterDomain == "" {
|
||||
fmt.Println("Domain is required for email find")
|
||||
return false
|
||||
}
|
||||
optionSet = true
|
||||
}
|
||||
|
||||
if !optionSet {
|
||||
fmt.Println("[!] No options selected")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Helper functions to get stored API credentials
|
||||
func getHunterApiKey() string {
|
||||
return badger.GetHunterKey()
|
||||
}
|
||||
@@ -44,6 +44,15 @@ var availableTables = map[string][]string{
|
||||
"name_servers", "parse_code", "raw_text", "registrant", "registrar_iana_id", "registrar_name", "registry_data",
|
||||
"status", "stripped_text", "updated_date", "updated_date_normalized",
|
||||
},
|
||||
"hunter_domain": {
|
||||
"id", "created_at", "updated_at", "deleted_at", "domain", "disposable", "webmail", "accept_all", "pattern",
|
||||
"organization", "description", "industry", "twitter", "facebook", "linkedin", "instagram", "youtube",
|
||||
"technologies", "country", "state", "city", "postal_code", "street", "headcount", "company_type", "emails", "linked_domains",
|
||||
},
|
||||
"hunter_email": {
|
||||
"id", "created_at", "updated_at", "deleted_at", "value", "type", "confidence", "sources", "first_name", "last_name",
|
||||
"position", "position_raw", "seniority", "department", "linkedin", "twitter", "phone_number", "verification_date", "verification_status",
|
||||
},
|
||||
}
|
||||
|
||||
// Function to list available tables and their columns
|
||||
|
||||
+34
-8
@@ -66,21 +66,38 @@ func init() {
|
||||
rootCmd.PersistentFlags().BoolVar(&debugGlobal, "debug", false, "Show debug information")
|
||||
|
||||
// Add subcommands
|
||||
rootCmd.AddCommand(setKeyCmd)
|
||||
rootCmd.AddCommand(setDehashedKeyCmd)
|
||||
rootCmd.AddCommand(setHunterKeyCmd)
|
||||
rootCmd.AddCommand(setLocalDb)
|
||||
}
|
||||
|
||||
// Command to set API key
|
||||
var setKeyCmd = &cobra.Command{
|
||||
Use: "set-key [key]",
|
||||
Short: "Set and store API key",
|
||||
var setDehashedKeyCmd = &cobra.Command{
|
||||
Use: "set-dehashed [key]",
|
||||
Short: "Set and store Dehashed.com API key",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
key := args[0]
|
||||
// Store key in badger DB
|
||||
err := storeApiKey(key)
|
||||
err := storeDehashedApiKey(key)
|
||||
if err != nil {
|
||||
fmt.Printf("Error storing API key: %v\n", err)
|
||||
fmt.Printf("Error storing Dehashed API key: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("API key stored successfully")
|
||||
},
|
||||
}
|
||||
|
||||
var setHunterKeyCmd = &cobra.Command{
|
||||
Use: "set-hunter [key]",
|
||||
Short: "Set and store Hunter.io API key",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
key := args[0]
|
||||
// Store key in badger DB
|
||||
err := storeHunterApiKey(key)
|
||||
if err != nil {
|
||||
fmt.Printf("Error storing Hunter API key: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("API key stored successfully")
|
||||
@@ -116,8 +133,17 @@ var setLocalDb = &cobra.Command{
|
||||
}
|
||||
|
||||
// Helper functions to store API credentials
|
||||
func storeApiKey(key string) error {
|
||||
err := badger.StoreKey(key)
|
||||
func storeDehashedApiKey(key string) error {
|
||||
err := badger.StoreDehashedKey(key)
|
||||
if err != nil {
|
||||
fmt.Printf("Error storing API key: %v\n", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func storeHunterApiKey(key string) error {
|
||||
err := badger.StoreHunterKey(key)
|
||||
if err != nil {
|
||||
fmt.Printf("Error storing API key: %v\n", err)
|
||||
return err
|
||||
|
||||
+5
-3
@@ -55,7 +55,7 @@ var (
|
||||
Short: "Dehashed WHOIS lookups and reverse WHOIS searches",
|
||||
Long: `Perform WHOIS lookups, history searches, reverse WHOIS searches, IP lookups, MX lookups, NS lookups, and subdomain scans.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
key := getStoredApiKey()
|
||||
key := getDehashedApiKey()
|
||||
|
||||
// Validate credentials
|
||||
if key == "" {
|
||||
@@ -172,6 +172,7 @@ var (
|
||||
}
|
||||
|
||||
if whoisHistory {
|
||||
filename := whoisOutputFile + "_history"
|
||||
fmt.Println("[*] Performing WHOIS history search...")
|
||||
// Perform history search
|
||||
historyRecords, err := w.WhoisHistory(whoisDomain)
|
||||
@@ -194,7 +195,7 @@ var (
|
||||
if len(historyRecords) > 0 {
|
||||
fmt.Println("[*] Records Found: %d\n", len(historyRecords))
|
||||
fmt.Println("[*] WHOIS History being written to file: %s%s\n", whoisOutputFile, fType.Extension())
|
||||
writeErr := export.WriteWhoIsHistoryToFile(historyRecords, whoisOutputFile, fType)
|
||||
writeErr := export.WriteWhoIsHistoryToFile(historyRecords, filename, fType)
|
||||
if writeErr != nil {
|
||||
if debugGlobal {
|
||||
debug.PrintInfo("failed to write whois history to file")
|
||||
@@ -233,6 +234,7 @@ var (
|
||||
|
||||
// Perform subdomain scan
|
||||
if whoisSubdomainScan {
|
||||
filename := whoisOutputFile + "_subdomains"
|
||||
fmt.Println("[*] Performing WHOIS subdomain scan...")
|
||||
subdomains, err := w.WhoisSubdomainScan(whoisDomain)
|
||||
|
||||
@@ -268,7 +270,7 @@ var (
|
||||
// Write the subdomains to file if any
|
||||
if len(subdomains) > 0 {
|
||||
fmt.Printf("[*] Writing subdomains to file: %s%s\n", whoisOutputFile, fType.Extension())
|
||||
err = export.WriteSubdomainsToFile(subdomains, whoisOutputFile, fType)
|
||||
err = export.WriteSubdomainsToFile(subdomains, filename, fType)
|
||||
if err != nil {
|
||||
zap.L().Error("write_whois_subdomain",
|
||||
zap.String("message", "failed to write whois subdomain to file"),
|
||||
|
||||
Reference in New Issue
Block a user