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

Remove passive crawling #899

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

- Fast And fully configurable web crawling
- **Standard** and **Headless** mode
- **Active** and **Passive** mode
- **JavaScript** parsing / crawling
- Customizable **automatic form filling**
- **Scope control** - Preconfigured field / Regex
Expand Down Expand Up @@ -157,10 +156,6 @@ HEADLESS:
-cwu, -chrome-ws-url string use chrome browser instance launched elsewhere with the debugger listening at this URL
-xhr, -xhr-extraction extract xhr request url,method in jsonl output

PASSIVE:
-ps, -passive enable passive sources to discover target endpoints
-pss, -passive-source string[] passive source to use for url discovery (waybackarchive,commoncrawl,alienvault)

SCOPE:
-cs, -crawl-scope string[] in scope url regex to be followed by crawler
-cos, -crawl-out-scope string[] out of scope url regex to be excluded by crawler
Expand Down
4 changes: 0 additions & 4 deletions cmd/katana/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ pipelines offering both headless and non-headless crawling.`)
flagSet.StringVarP(&options.ChromeWSUrl, "chrome-ws-url", "cwu", "", "use chrome browser instance launched elsewhere with the debugger listening at this URL"),
flagSet.BoolVarP(&options.XhrExtraction, "xhr-extraction", "xhr", false, "extract xhr request url,method in jsonl output"),
)
flagSet.CreateGroup("passive", "Passive",
flagSet.BoolVarP(&options.Passive, "passive", "ps", false, "enable passive sources to discover target endpoints"),
flagSet.StringSliceVarP(&options.PassiveSource, "passive-source", "pss", nil, "passive source to use for url discovery (waybackarchive,commoncrawl,alienvault)", goflags.NormalizedStringSliceOptions),
)

flagSet.CreateGroup("scope", "Scope",
flagSet.StringSliceVarP(&options.Scope, "crawl-scope", "cs", nil, "in scope url regex to be followed by crawler", goflags.FileCommaSeparatedStringSliceOptions),
Expand Down
4 changes: 0 additions & 4 deletions internal/runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ func validateOptions(options *types.Options) error {
gologger.Info().Msgf("Automatic form fill (-aff) has been disabled for headless navigation.")
}

if options.Headless && options.Passive {
return errorutil.New("headless mode (-headless) and passive mode (-passive) cannot be used together")
}

if (options.HeadlessOptionalArguments != nil || options.HeadlessNoSandbox || options.SystemChromePath != "") && !options.Headless {
return errorutil.New("headless mode (-hl) is required if -ho, -nos or -scp are set")
}
Expand Down
3 changes: 0 additions & 3 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/projectdiscovery/katana/pkg/engine"
"github.com/projectdiscovery/katana/pkg/engine/hybrid"
"github.com/projectdiscovery/katana/pkg/engine/parser"
"github.com/projectdiscovery/katana/pkg/engine/passive"
"github.com/projectdiscovery/katana/pkg/engine/standard"
"github.com/projectdiscovery/katana/pkg/types"
"github.com/projectdiscovery/mapcidr"
Expand Down Expand Up @@ -98,8 +97,6 @@ func New(options *types.Options) (*Runner, error) {
switch {
case options.Headless:
crawler, err = hybrid.New(crawlerOptions)
case options.Passive:
crawler, err = passive.New(crawlerOptions)
default:
crawler, err = standard.New(crawlerOptions)
}
Expand Down
15 changes: 7 additions & 8 deletions pkg/engine/common/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *Shared) Enqueue(queue *queue.Queue, navigationRequests ...*navigation.R
// if the user requested anyway out of scope items
// they are sent to output without visiting
if s.Options.Options.DisplayOutScope {
s.Output(nr, nil, nil, ErrOutOfScope)
s.Output(nr, nil, ErrOutOfScope)
}
continue
}
Expand All @@ -95,18 +95,17 @@ func (s *Shared) ValidateScope(URL string, root string) bool {
return err == nil && scopeValidated
}

func (s *Shared) Output(navigationRequest *navigation.Request, navigationResponse *navigation.Response, passiveReference *navigation.PassiveReference, err error) {
func (s *Shared) Output(navigationRequest *navigation.Request, navigationResponse *navigation.Response, err error) {
var errData string
if err != nil {
errData = err.Error()
}
// Write the found result to output
result := &output.Result{
Timestamp: time.Now(),
Request: navigationRequest,
Response: navigationResponse,
PassiveReference: passiveReference,
Error: errData,
Timestamp: time.Now(),
Request: navigationRequest,
Response: navigationResponse,
Error: errData,
}

outputErr := s.Options.OutputWriter.Write(result)
Expand Down Expand Up @@ -230,7 +229,7 @@ func (s *Shared) Do(crawlSession *CrawlSession, doRequest DoRequestFunc) error {
resp, err := doRequest(crawlSession, req)

if inScope {
s.Output(req, resp, nil, err)
s.Output(req, resp, err)
}

if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions pkg/engine/passive/doc.go

This file was deleted.

124 changes: 0 additions & 124 deletions pkg/engine/passive/httpclient/httpclient.go

This file was deleted.

145 changes: 0 additions & 145 deletions pkg/engine/passive/passive.go

This file was deleted.

16 changes: 0 additions & 16 deletions pkg/engine/passive/regexp/regexp.go

This file was deleted.

Loading
Loading