-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] nil pointer in GetDialedIP #5799
Comments
Couldn't repro this, made a little update to your code $ go run .
2024/11/08 14:46:09 Nuclei Target: http://scanme.sh
2024/11/08 14:46:09 Nuclei Target: http://honey.scanme.sh
[INF] Templates clustered: 1636 (Reduced 1537 Requests)
[INF] Templates clustered: 1636 (Reduced 1537 Requests)
[CVE-2015-6477] http://honey.scanme.sh/login
... package main
import (
"context"
"log"
"sync"
nuclei "github.com/projectdiscovery/nuclei/v3/lib"
)
func scanWithNuclei(ctx context.Context, target string) {
ne, err := nuclei.NewNucleiEngineCtx(ctx)
if err != nil {
panic(err)
}
ne.LoadTargets([]string{target}, false)
ne.Options().Verbose = true
err = ne.ExecuteWithCallback(nil)
if err != nil {
panic(err)
}
defer ne.Close()
}
func main() {
targets := []string{
"http://scanme.sh",
"http://honey.scanme.sh",
}
var wg sync.WaitGroup
for _, target := range targets {
log.Println("Nuclei Target: ", target)
wg.Add(1)
go func(t string) {
scanWithNuclei(context.Background(), t)
}(target)
}
wg.Wait()
} |
I've replicated the issue and will investigate it further! |
You can try the code below package main
import (
"context"
"log"
"os"
"os/signal"
nuclei "github.com/projectdiscovery/nuclei/v3/lib"
)
func scanWithNuclei(ctx context.Context, targets []string) {
ne, err := nuclei.NewNucleiEngineCtx(ctx,
nuclei.WithTemplateFilters(nuclei.TemplateFilters{Severity: "low"}),
)
if err != nil {
panic(err)
}
ne.LoadTargets(targets, false)
err = ne.ExecuteWithCallback(nil)
if err != nil {
panic(err)
}
defer ne.Close()
}
func Test(ctx context.Context) {
targets := []string{
"hackerone.com",
"tesla.com",
}
for _, target := range targets {
log.Println("Nuclei Target: ", target)
go func() {
scanWithNuclei(ctx, []string{target})
}()
}
}
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt)
Test(ctx)
<-sigChan
log.Println("Shutting down gracefully...")
cancel()
log.Println("Consumer closed.")
} |
I used your code with input and got an error. I think because the input does not contain http or https, I get an error when checking the low template. Try going this direction to see if you discover anything new Inputtargets := []string{
"hackerone.com",
"tesla.com",
} Err
|
Hi, I ran your code and still got nil pointer error. Please check again and wait for the code to run all templates
|
I encountered the same problem. Through brief debugging, I found that if it is called multiple times, it seems that some global variables are closed in advance. My previous solution was to create a global manager and then close it after all target calls are completed, but it may cause memory to increase. I don't know the specific reason. |
Is there an existing issue for this?
Current Behavior
i test code and get error
Expected Behavior
no error
Steps To Reproduce
Relevant log output
No response
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: