projectdiscovery / subfinder

Fast passive subdomain enumeration tool.
https://projectdiscovery.io
MIT License
10.3k stars 1.28k forks source link

panic while running job: runtime error: invalid memory address or nil pointer dereference #78

Closed imnewbe closed 6 years ago

imnewbe commented 6 years ago
2018/06/22 09:58:53 panic while running job: runtime error: invalid memory address or nil pointer dereference
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: interface conversion: interface {} is runtime.errorString, not string
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x12bb293]

goroutine 93 [running]:
github.com/Ice3man543/subfinder/libsubfinder/helper.(*Pool).subworker.func1(0xc4200888c0)
    /Users/hehe/go/src/github.com/Ice3man543/subfinder/libsubfinder/helper/pool.go:61 +0x163
panic(0x1313a00, 0x152d8e0)
    /usr/local/Cellar/go/1.10.1/libexec/src/runtime/panic.go:502 +0x229
github.com/Ice3man543/subfinder/libsubfinder/sources/riddler.Query(0xc4200ee900, 0x2, 0x2, 0x12a8701, 0x101)
    /Users/hehe/go/src/github.com/Ice3man543/subfinder/libsubfinder/sources/riddler/riddler.go:57 +0x273
github.com/Ice3man543/subfinder/libsubfinder/helper.(*Pool).subworker(0xc420092aa0, 0xc4200888c0)
    /Users/hehe/go/src/github.com/Ice3man543/subfinder/libsubfinder/helper/pool.go:64 +0x6e
github.com/Ice3man543/subfinder/libsubfinder/helper.(*Pool).worker(0xc420092aa0, 0x1a)
    /Users/hehe/go/src/github.com/Ice3man543/subfinder/libsubfinder/helper/pool.go:78 +0xb3
created by github.com/Ice3man543/subfinder/libsubfinder/helper.(*Pool).Run

when I run this program, the program stopped by above error. I didn't debug your program. so I'm not sure what the real problem is. by the way, I live in China, I guess this situation may be caused by internet firewall.

Ice3man543 commented 6 years ago

Yeah, that's the most likely explanation of the error. If this occurs you should just use --exclude-sources flag with riddler option to ignore riddler. Anyway, I'll look into it.

imnewbe commented 6 years ago

Bro, When I used --exclude-sources riddler, it's worked correctly. About the internet firewall, it really makes me embarrassed, it causes everything is crashed. But when I used a socks5 proxy, the program crashed again.

Ice3man543 commented 6 years ago

So, it means only riddler is failing?

imnewbe commented 6 years ago

yeap.

Nizamul Rana notifications@github.com 于2018年6月22日周五 上午11:16写道:

So, it means only riddler is failing?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ice3man543/subfinder/issues/78#issuecomment-399308198, or mute the thread https://github.com/notifications/unsubscribe-auth/ADitTfVQKWwLGsuBXkIBwy7VgYKmdkj7ks5t_GF5gaJpZM4UzCI- .

Ice3man543 commented 6 years ago

OK, I'll try to see what's the trouble with it. Did you setup an api key for riddler?

imnewbe commented 6 years ago

No, I didn't. So, this trouble could be resolved by writing a recover() in some function?

Ice3man543 commented 6 years ago

You need to specify the api key for riddler in order for riddler to work properly.

imnewbe commented 6 years ago

Ok... if I didn't set API key for riddler and also don't use --exclude-sources to exclude riddler. it's should have some troubles tolerance policy. Like try-catch in other program languages. Do you think so?

Ice3man543 commented 6 years ago

Yeah, I think it should.

imnewbe commented 6 years ago
req.PostForm = form
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Header.Add("Referer", "https://dnsdumpster.com")
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1")

resp, err = hc.Do(req)
if err != nil {
    return subdomains
}

dnsdumpster.go


riddler.go

// Create a post request to get subdomain data
req, err := http.NewRequest("POST", "https://riddler.io/auth/login", bytes.NewBuffer(data))
req.Header.Add("Content-Type", "application/json")

resp, err := hc.Do(req)
if err != nil{
    return  subdomains
}

I fixed two of above bugs. In some cases it may be made crash.

imnewbe commented 6 years ago

try sdo.com. seems to show out some garbage info.

Ice3man543 commented 6 years ago

Thanks for this. I will try it in a moment and inform you.