summaryrefslogtreecommitdiffstats
path: root/internal/formatter
diff options
context:
space:
mode:
authors <[email protected]>2025-11-25 09:38:31 -0500
committers <[email protected]>2025-11-25 09:38:31 -0500
commit8472267b60b204cea5fbdeaf8fe06443822d1bfb (patch)
treeeba71104733067072ded109bf96904cd825c2f7f /internal/formatter
parentbc31d9cc8f93a5efef958872f48f3f4370ed5e29 (diff)
downloaddborg-8472267b60b204cea5fbdeaf8fe06443822d1bfb.tar.gz
dborg-8472267b60b204cea5fbdeaf8fe06443822d1bfb.zip
feat: add crypto analysis, email verification, and telegram lookup commands
Diffstat (limited to 'internal/formatter')
-rw-r--r--internal/formatter/crypto.go39
-rw-r--r--internal/formatter/email.go103
-rw-r--r--internal/formatter/telegram.go34
3 files changed, 176 insertions, 0 deletions
diff --git a/internal/formatter/crypto.go b/internal/formatter/crypto.go
new file mode 100644
index 0000000..70ef29b
--- /dev/null
+++ b/internal/formatter/crypto.go
@@ -0,0 +1,39 @@
+package formatter
+
+import (
+ "fmt"
+ "git.db.org.ai/dborg/internal/models"
+ "git.db.org.ai/dborg/internal/utils"
+ "strings"
+)
+
+func FormatCryptoResults(response *models.CryptoResponse, asJSON bool) error {
+ if asJSON {
+ return utils.PrintJSON(response)
+ }
+
+ PrintSection(fmt.Sprintf("📊 Crypto Analysis Results"))
+
+ if response.Query != "" {
+ fmt.Printf("%s: %s\n\n", Cyan("Query"), response.Query)
+ }
+
+ if response.Response != "" {
+ fmt.Println(response.Response)
+ fmt.Println()
+ }
+
+ PrintDivider()
+ fmt.Printf("%s: ", Cyan("Credits Remaining"))
+ if response.Credits.Unlimited {
+ fmt.Printf("%s\n", Green("Unlimited"))
+ } else {
+ fmt.Printf("%s\n", FormatCredits(int64(response.Credits.Remaining)))
+ }
+
+ if response.Message != "" && !strings.Contains(strings.ToLower(response.Message), "success") {
+ fmt.Printf("\n%s: %s\n", Yellow("Message"), response.Message)
+ }
+
+ return nil
+}
diff --git a/internal/formatter/email.go b/internal/formatter/email.go
new file mode 100644
index 0000000..80f590c
--- /dev/null
+++ b/internal/formatter/email.go
@@ -0,0 +1,103 @@
+package formatter
+
+import (
+ "fmt"
+ "git.db.org.ai/dborg/internal/models"
+ "git.db.org.ai/dborg/internal/utils"
+)
+
+func FormatEmailResults(response *models.EmailVerifyResponse, asJSON bool) error {
+ if asJSON {
+ return utils.PrintJSON(response)
+ }
+
+ PrintSection(fmt.Sprintf("📧 Email Verification: %s", Bold(response.Email)))
+
+ statusColor := ColorGreen
+ switch response.Status {
+ case "valid":
+ statusColor = ColorGreen
+ case "invalid":
+ statusColor = ColorRed
+ case "risky", "accept_all":
+ statusColor = ColorYellow
+ default:
+ statusColor = ColorGray
+ }
+
+ fmt.Printf("%s: %s", Cyan("Status"), Colorize(response.Status, statusColor))
+ if response.Score > 0 {
+ scoreColor := ColorGreen
+ if response.Score < 50 {
+ scoreColor = ColorRed
+ } else if response.Score < 75 {
+ scoreColor = ColorYellow
+ }
+ fmt.Printf(" (Score: %s)", Colorize(fmt.Sprintf("%d/100", response.Score), scoreColor))
+ }
+ fmt.Println()
+
+ fmt.Println()
+ fmt.Printf("%s\n", Bold("Validation Checks"))
+
+ checks := []struct {
+ name string
+ passed bool
+ }{
+ {"Format Valid", response.Regexp},
+ {"MX Records Found", response.MXRecords},
+ {"SMTP Server Reachable", response.SMTPServer},
+ {"Mailbox Verified", response.SMTPCheck},
+ }
+
+ for _, check := range checks {
+ status := StatusError
+ if check.passed {
+ status = StatusSuccess
+ }
+ fmt.Printf(" %s %s\n", status.String(), check.name)
+ }
+
+ if response.MXServer != "" {
+ fmt.Printf("\n%s: %s\n", Cyan("MX Server"), response.MXServer)
+ }
+
+ fmt.Println()
+ fmt.Printf("%s\n", Bold("Risk Indicators"))
+
+ risks := []struct {
+ name string
+ present bool
+ }{
+ {"Disposable Email", response.Disposable},
+ {"Webmail Service", response.Webmail},
+ {"Blocked Domain", response.Block},
+ {"Gibberish Detected", response.Gibberish},
+ }
+
+ hasRisks := false
+ for _, risk := range risks {
+ if risk.present {
+ hasRisks = true
+ fmt.Printf(" %s %s\n", StatusWarning.String(), risk.name)
+ }
+ }
+
+ if !hasRisks {
+ fmt.Printf(" %s %s\n", StatusSuccess.String(), "No risk indicators found")
+ }
+
+ if response.ResponseTimeMs > 0 {
+ fmt.Printf("\n%s: %dms\n", Dim("Response Time"), response.ResponseTimeMs)
+ }
+
+ if response.ErrorMessage != "" {
+ fmt.Printf("\n%s: %s\n", Red("Error"), response.ErrorMessage)
+ }
+
+ if response.VerifiedAt != "" {
+ fmt.Printf("%s: %s\n", Dim("Verified At"), response.VerifiedAt)
+ }
+
+ return nil
+}
diff --git a/internal/formatter/telegram.go b/internal/formatter/telegram.go
new file mode 100644
index 0000000..7491c66
--- /dev/null
+++ b/internal/formatter/telegram.go
@@ -0,0 +1,34 @@
+package formatter
+
+import (
+ "fmt"
+ "git.db.org.ai/dborg/internal/models"
+ "git.db.org.ai/dborg/internal/utils"
+)
+
+func FormatTelegramResults(response *models.TelegramPhoneResponse, asJSON bool) error {
+ if asJSON {
+ return utils.PrintJSON(response)
+ }
+
+ PrintSection(fmt.Sprintf("📱 Telegram Phone Lookup"))
+
+ fmt.Printf("%s: %s\n", Cyan("Identifier"), response.Identifier)
+
+ if response.PhoneNumber != "" {
+ fmt.Printf("%s: %s\n", Cyan("Phone Number"), Green(response.PhoneNumber))
+ } else {
+ fmt.Printf("%s: %s\n", Cyan("Phone Number"), Red("Not found"))
+ }
+
+ fmt.Println()
+ PrintDivider()
+ fmt.Printf("%s: ", Cyan("Credits Remaining"))
+ if response.Credits.Unlimited {
+ fmt.Printf("%s\n", Green("Unlimited"))
+ } else {
+ fmt.Printf("%s\n", FormatCredits(int64(response.Credits.Remaining)))
+ }
+
+ return nil
+}