From 98769561c33e67e84c5d22ea35fed1fb4a9f32fa Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Wed, 17 Sep 2025 20:47:12 +0200 Subject: [PATCH] Add author.email in levenshtein distance for authors Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- github-recon/username/deep.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/github-recon/username/deep.go b/github-recon/username/deep.go index d9751da..0f54c17 100644 --- a/github-recon/username/deep.go +++ b/github-recon/username/deep.go @@ -202,7 +202,7 @@ func DeepScan(s github_recon_settings.Settings) (response DeepScanResult) { Name: authorName, Email: authorEmail, FoundIn: []string{repoIdentifier}, - Levenshtein: utils.LevenshteinDistance(s.Target, authorName), + Levenshtein: levenshteinDistanceAuthor(s.Target, authorName, authorEmail), }) mapAuthorToIndex[trimmedLine] = len(authorOccurrences) - 1 } @@ -380,3 +380,10 @@ func findEmailsAndOccurrencesInDir(rootPath string, username string) (Emails, er return results, nil } + +func levenshteinDistanceAuthor(target, name, email string) int { + if strings.Contains(email, "@") { + email = strings.SplitN(email, "@", 2)[0] + } + return slices.Min([]int{utils.LevenshteinDistance(target, name), utils.LevenshteinDistance(target, email)}) +}