mirror of
https://github.com/anotherhadi/github-recon.git
synced 2026-10-05 19:08:24 +02:00
Refactor to make the library reusable
Signed-off-by: Hadi <[email protected]>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package recon
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
github_recon_settings "github.com/anotherhadi/github-recon/settings"
|
||||
"github.com/anotherhadi/github-recon/utils"
|
||||
)
|
||||
|
||||
type EmailResult struct {
|
||||
DateTime string
|
||||
Target string
|
||||
TargetType github_recon_settings.TargetType
|
||||
|
||||
Commits CommitsResult
|
||||
Spoofing SpoofingResult
|
||||
}
|
||||
|
||||
func Email(settings github_recon_settings.Settings) EmailResult {
|
||||
result := EmailResult{
|
||||
Target: settings.Target,
|
||||
TargetType: settings.TargetType,
|
||||
DateTime: time.Now().String(),
|
||||
}
|
||||
|
||||
utils.PrintTitle(settings.Silent, "👤 Commits author")
|
||||
result.Commits = Commits(settings)
|
||||
utils.PrintStruct(settings, result.Commits, 0)
|
||||
|
||||
if settings.SpoofEmail {
|
||||
if settings.Token == "null" {
|
||||
settings.Logger.Warn("Skipping email spoofing test, please provide a Github token")
|
||||
} else {
|
||||
utils.PrintTitle(settings.Silent, "🎭 Spoofing test")
|
||||
result.Spoofing = Spoofing(settings)
|
||||
if result.Spoofing.AvatarURL != "" {
|
||||
utils.PrintAvatar(settings, result.Spoofing.AvatarURL)
|
||||
}
|
||||
utils.PrintStruct(settings, result.Spoofing, 0)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package recon
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
github_recon_settings "github.com/anotherhadi/github-recon/settings"
|
||||
"github.com/anotherhadi/github-recon/utils"
|
||||
)
|
||||
|
||||
type UsernameResult struct {
|
||||
DateTime string // Now
|
||||
Target string
|
||||
TargetType github_recon_settings.TargetType
|
||||
|
||||
User UserResult
|
||||
Socials SocialsResult
|
||||
Orgs OrgsResult
|
||||
|
||||
SshKeys SshKeysResult
|
||||
SshSigningKeys SshSigningKeysResult
|
||||
GpgKeys GpgKeysResult
|
||||
|
||||
CloseFriends CloseFriendsResult
|
||||
|
||||
Commits CommitsResult
|
||||
|
||||
DeepScan DeepScanResult
|
||||
}
|
||||
|
||||
func Username(settings github_recon_settings.Settings) UsernameResult {
|
||||
|
||||
result := UsernameResult{
|
||||
Target: settings.Target,
|
||||
TargetType: settings.TargetType,
|
||||
DateTime: time.Now().String(),
|
||||
}
|
||||
|
||||
utils.PrintTitle(settings.Silent, "👤 User informations")
|
||||
result.User = User(settings)
|
||||
utils.PrintAvatar(settings, result.User.AvatarURL)
|
||||
utils.PrintStruct(settings, result.User, 0)
|
||||
|
||||
utils.PrintTitle(settings.Silent, "🐥 Socials")
|
||||
result.Socials = Socials(settings)
|
||||
utils.PrintStruct(settings, result.Socials, 0)
|
||||
|
||||
utils.PrintTitle(settings.Silent, "🏢 Organizations")
|
||||
result.Orgs = Orgs(settings)
|
||||
utils.PrintStruct(settings, result.Orgs, 0)
|
||||
|
||||
utils.PrintTitle(settings.Silent, "🔑 SSH Keys")
|
||||
result.SshKeys = SshKeys(settings)
|
||||
utils.PrintStruct(settings, result.SshKeys, 0)
|
||||
|
||||
utils.PrintTitle(settings.Silent, "🖋️ SSH Signing Keys")
|
||||
result.SshSigningKeys = SshSigningKeys(settings)
|
||||
utils.PrintStruct(settings, result.SshSigningKeys, 0)
|
||||
|
||||
utils.PrintTitle(settings.Silent, "🔐 GPG Keys")
|
||||
result.GpgKeys = GpgKeys(settings)
|
||||
utils.PrintStruct(settings, result.GpgKeys, 0)
|
||||
|
||||
utils.PrintTitle(settings.Silent, "🤝 Close Friends")
|
||||
result.CloseFriends = CloseFriends(settings)
|
||||
utils.PrintStruct(settings, result.CloseFriends, 0)
|
||||
|
||||
utils.PrintTitle(settings.Silent, "📝 Commits")
|
||||
result.Commits = Commits(settings)
|
||||
utils.PrintStruct(settings, result.Commits, 0)
|
||||
|
||||
if settings.DeepScan {
|
||||
utils.PrintTitle(settings.Silent, "🔍 Deep Scan")
|
||||
result.DeepScan = DeepScan(settings)
|
||||
utils.PrintStruct(settings, result.DeepScan, 0)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user