edit strings for github.Client

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2025-08-23 14:42:52 +02:00
parent 7b8cb1654f
commit 8e2715e0ef
2 changed files with 7 additions and 8 deletions
+6 -7
View File
@@ -27,7 +27,6 @@ func RandomString(n int) string {
} }
func Spoofing(s github_recon_settings.Settings) (response SpoofingResult) { func Spoofing(s github_recon_settings.Settings) (response SpoofingResult) {
// 1) Create repo (auto-init pour avoir une branche par défaut)
name := "gh-recon-spoofing-" + RandomString(8) name := "gh-recon-spoofing-" + RandomString(8)
private := true private := true
autoInit := true autoInit := true
@@ -48,10 +47,11 @@ func Spoofing(s github_recon_settings.Settings) (response SpoofingResult) {
} }
refName := "heads/" + branch refName := "heads/" + branch
// 2) Commit vide avec auteur spoofé (tree identique au parent) authorName := "GITHUB-RECON-SPOOFING"
authorEmail := s.Target
author := &github.CommitAuthor{ author := &github.CommitAuthor{
Name: github.String("Spoofed Name"), Name: &authorName,
Email: github.String(s.Target), Email: &authorEmail,
} }
ref, resp, err := s.Client.Git.GetRef(s.Ctx, repo.Owner.GetLogin(), name, refName) ref, resp, err := s.Client.Git.GetRef(s.Ctx, repo.Owner.GetLogin(), name, refName)
@@ -70,9 +70,10 @@ func Spoofing(s github_recon_settings.Settings) (response SpoofingResult) {
} }
utils.WaitForRateLimit(s, resp) utils.WaitForRateLimit(s, resp)
commitMessage := "Spoofed empty commit"
commit := &github.Commit{ commit := &github.Commit{
Author: author, Author: author,
Message: github.String("Spoofed empty commit"), Message: &commitMessage,
Tree: &github.Tree{SHA: parentCommit.Tree.SHA}, Tree: &github.Tree{SHA: parentCommit.Tree.SHA},
Parents: []*github.Commit{parentCommit}, Parents: []*github.Commit{parentCommit},
} }
@@ -94,7 +95,6 @@ func Spoofing(s github_recon_settings.Settings) (response SpoofingResult) {
} }
utils.WaitForRateLimit(s, resp) utils.WaitForRateLimit(s, resp)
// 3) Get user
commits, _, err := s.Client.Repositories.ListCommits(s.Ctx, repo.Owner.GetLogin(), name, nil) commits, _, err := s.Client.Repositories.ListCommits(s.Ctx, repo.Owner.GetLogin(), name, nil)
if err != nil { if err != nil {
s.Logger.Error("Error while listing commits", "err", err) s.Logger.Error("Error while listing commits", "err", err)
@@ -111,7 +111,6 @@ func Spoofing(s github_recon_settings.Settings) (response SpoofingResult) {
response.AvatarURL = last.GetAuthor().GetAvatarURL() response.AvatarURL = last.GetAuthor().GetAvatarURL()
} }
// 4) Cleanup
_, err = s.Client.Repositories.Delete(s.Ctx, repo.Owner.GetLogin(), name) _, err = s.Client.Repositories.Delete(s.Ctx, repo.Owner.GetLogin(), name)
if err != nil { if err != nil {
s.Logger.Error("Error while deleting repo", "err", err) s.Logger.Error("Error while deleting repo", "err", err)
+1 -1
View File
@@ -110,7 +110,7 @@ func LevenshteinDistance(s1, s2 string) int {
} }
func SkipResult(name, email string) bool { func SkipResult(name, email string) bool {
if name == "github-actions[bot]" || name == "dependabot[bot]" || name == "github-actions" || name == "GitHub Actions" { if name == "github-actions[bot]" || name == "GITHUB-RECON-SPOOFING" || name == "dependabot[bot]" || name == "github-actions" || name == "GitHub Actions" {
return true return true
} }
if email == "github-actions[bot]@users.noreply.github.com" || email == "[email protected]" || if email == "github-actions[bot]@users.noreply.github.com" || email == "[email protected]" ||