Library

Chaos can be utilized as a library for subdomain enumeration by instantiating the Options struct and populating it with the same options that would be specified via CLI.

Authentication

You must have a valid Chaos API key to use Chaos as a library.

You can authenticate using the Chaos API key, check the Authentication section for more details.

Example

package main

import (
	"os"
	"github.com/projectdiscovery/chaos-client/internal/runner"
	"github.com/projectdiscovery/chaos-client/pkg/chaos"
)

func main() {
	var results []chaos.Result
	opts := &runner.Options{
		Domain: "projectdiscovery.io",
		APIKey: os.Getenv("PDCP_API_KEY"),
		OnResult: func(result interface{}) {
			if val, ok := result.(chaos.Result); !ok {
				results = append(results, val)
			}
		},
	}

	runner.RunEnumeration(opts)
}

To run the program, you need to set the PDCP_API_KEY environment variable to your Chaos API key.