From 862cf3659cd63f0a029c390c8b816ba32a0fe8f2 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Sat, 23 Aug 2025 09:52:14 +0200 Subject: [PATCH] Now read from Commit.Committer, Committer & Author Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- github-recon/username/commits.go | 49 +++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/github-recon/username/commits.go b/github-recon/username/commits.go index f085dd0..7385b26 100644 --- a/github-recon/username/commits.go +++ b/github-recon/username/commits.go @@ -39,24 +39,41 @@ func Commits(s github_recon_settings.Settings) (response CommitsResult) { break } for _, item := range result.Commits { - name := item.Commit.GetAuthor().GetName() - email := item.Commit.GetAuthor().GetEmail() - if utils.SkipResult(name, email) { - continue + emails := []string{ + item.Commit.GetAuthor().GetEmail(), + item.Commit.GetCommitter().GetEmail(), + item.GetAuthor().GetEmail(), + item.GetCommitter().GetEmail(), } - if _, seen := results[name+" - "+email]; !seen { - author := CommitResult{ - Name: name, - Email: email, - Occurrences: 1, - FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository(). - GetName(), + + names := []string{ + item.Commit.GetAuthor().GetName(), + item.Commit.GetCommitter().GetName(), + item.GetAuthor().GetName(), + item.GetCommitter().GetName(), + } + + for i := range names { + if utils.SkipResult(names[i], emails[i]) { + continue + } + if names[i] == "" || emails[i] == "" { + continue + } + if _, seen := results[names[i]+" - "+emails[i]]; !seen { + author := CommitResult{ + Name: names[i], + Email: emails[i], + Occurrences: 1, + FirstFoundIn: item.GetRepository().Owner.GetLogin() + "/" + item.GetRepository(). + GetName(), + } + results[names[i]+" - "+emails[i]] = author + } else if i == 0 { + result := results[names[i]+" - "+emails[i]] + result.Occurrences++ + results[names[i]+" - "+emails[i]] = result } - results[name+" - "+email] = author - } else { - result := results[name+" - "+email] - result.Occurrences++ - results[name+" - "+email] = result } } }