Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2025-05-20 15:28:32 +02:00
parent 7f74f5d28f
commit 5a9483411a
14 changed files with 845 additions and 216 deletions
+16 -15
View File
@@ -5,20 +5,19 @@ import (
"fmt"
)
func (r Recon) Socials(username string) {
type SocialResult struct {
Provider string `json:"provider"`
URL string `json:"url"`
}
func (r Recon) Socials(username string) (response []SocialResult) {
resp, err := FetchGitHubAPI(r.client, "", "/users/"+username+"/social_accounts")
if err != nil {
r.logger.Error("Failed to fetch socials", "err", err)
return
}
type SocialAccount struct {
Provider string `json:"provider"`
URL string `json:"url"`
}
type SocialAccounts []SocialAccount
var socialAccounts SocialAccounts
var socialAccounts []SocialResult
err = json.Unmarshal(resp, &socialAccounts)
if err != nil {
r.logger.Error("Failed to unmarshal socials", "err", err)
@@ -26,15 +25,17 @@ func (r Recon) Socials(username string) {
}
if len(socialAccounts) == 0 {
PrintTitle("🐥 Socials")
PrintTitle("No Socials found\n")
r.PrintTitle("🐥 Socials")
r.PrintInfo("INFO", "No commits found")
} else {
PrintTitle("🐥 Socials")
r.PrintTitle("🐥 Socials")
for i, account := range socialAccounts {
PrintInfo("Social n°", fmt.Sprintf("%d", i))
PrintInfo("Provider", account.Provider)
PrintInfo("URL", account.URL)
fmt.Println()
r.PrintInfo("Social n°", fmt.Sprintf("%d", i))
r.PrintInfo("Provider", account.Provider)
r.PrintInfo("URL", account.URL)
}
}
r.PrintNewline()
return socialAccounts
}