Skip to content
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

add disable stdout option #1871

Merged
merged 1 commit into from
Aug 13, 2024
Merged

add disable stdout option #1871

merged 1 commit into from
Aug 13, 2024

Conversation

dogancanbakir
Copy link
Member

Closes #1692

package main

import (
	"fmt"
	"log"

	"github.com/projectdiscovery/goflags"
	"github.com/projectdiscovery/httpx/runner"
)

func main() {
	results := map[string]struct{}{}

	options := runner.Options{
		Methods:         "GET",
		Timeout:         5,
		Threads:         80,
		Silent:          true,
		RandomAgent:     true,
		Retries:         2,
		DisableStdout:   true,
		InputTargetHost: goflags.StringSlice{"scanme.sh", "projectdiscovery.io", "localhost", "x"},
		OnResult: func(r runner.Result) {
			if r.Err != nil {
				return
			}
			results[r.URL] = struct{}{}
		},
	}

	if err := options.ValidateOptions(); err != nil {
		log.Fatal(err)
	}

	httpxRunner, err := runner.New(&options)
	if err != nil {
		log.Fatal(err)
	}
	defer httpxRunner.Close()

	httpxRunner.RunEnumeration()
	fmt.Println("Results:", results)
}
$ go run .
Results: map[https://projectdiscovery.io:{} https://scanme.sh:{}]

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - I guess the tests is failing due to issues with ASN endpoint issues

@ehsandeep ehsandeep merged commit 8abc972 into dev Aug 13, 2024
8 of 11 checks passed
@ehsandeep ehsandeep deleted the add_disable_stdout_option branch August 13, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing runner.Options doesn't change live domain output, only goes to stdout
3 participants