tillson / git-hound

Reconnaissance tool for GitHub code search. Scans for exposed API keys across all of GitHub, not just known repos and orgs.
MIT License
1.19k stars 184 forks source link

panic: runtime error: index out of range [1] with length 0 #55

Closed t94j0 closed 1 year ago

t94j0 commented 1 year ago

Describe the bug When running git-hound with a large number of results, an error is returned.

To Reproduce Steps to reproduce the behavior:

  1. Run echo "COMPANY" | ./git-hound --many-results --threads 100

Expected behavior Gives me api keys

Screenshots

2022-11-28T18:35:13Z mharley@HOST:~ $ echo "COMPANY" | ./git-hound  --many-results --threads 100
[*] Logged into GitHub as t94j0
[*] Searching 100+ pages of results for 'COMPANY'...
panic: runtime error: index out of range [1] with length 0

goroutine 1 [running]:
github.com/tillson/git-hound/internal/app.SearchGitHub({0xc000023f50, 0x6}, {0x64, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, 0x0, ...}}, ...)
    /Users/tillson/git-hound/internal/app/search.go:210 +0x1138
github.com/tillson/git-hound/internal/app.Search({0xc000023f50, 0x6}, 0x0?)
    /Users/tillson/git-hound/internal/app/search.go:66 +0x1c5
github.com/tillson/git-hound/cmd.glob..func1(0xf0fa40?, {0xc00010b530, 0x0, 0x3?})
    /Users/tillson/git-hound/cmd/root.go:96 +0x6ee
github.com/spf13/cobra.(*Command).execute(0xf0fa40, {0xc00001e090, 0x3, 0x3})
    /Users/tillson/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xf0fa40)
    /Users/tillson/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/tillson/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
github.com/tillson/git-hound/cmd.Execute()
    /Users/tillson/git-hound/cmd/root.go:124 +0x25
main.main()
    /Users/tillson/git-hound/main.go:10 +0x17

Desktop (please complete the following information):

Smartphone (please complete the following information):

t94j0 commented 1 year ago

Btw, this is GitHound 1.6.1

tillson commented 1 year ago

Hey @t94j0, big fan of your work on ansible-gophish-notifier! Does your GitHub account show the new code search UI or the old one?

t94j0 commented 1 year ago

Lol, thanks Mr. Tillson.

I'm not 100% sure, but I think it's the old code search UI. image

Canon88 commented 1 year ago

Same versions, same problem.

jarek-bir commented 1 year ago

Hello there .I have exactly the same problem with new version.The old one worked without any issue .What shall i do .Thanks and Merry Xmas

tillson commented 1 year ago

Looking into this, it looks like it happens after the github scan finishes but before gist scanning.

tillson commented 1 year ago

Fixed in c8daed673154dad9eaa4219d1b0508479768a69d