Skip to content

Commit

Permalink
enqueue param in links plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
xmendez committed Oct 24, 2020
1 parent 679124c commit 7dbc014
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/wfuzz/plugin_api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import sys
import os
from distutils import util

# python 2 and 3: iterator
from builtins import object
Expand Down Expand Up @@ -79,6 +80,9 @@ def queue_url(self, url):
)
)

def _bool(self, value):
return bool(util.strtobool(value))


class BasePrinter:
def __init__(self, output):
Expand Down
17 changes: 13 additions & 4 deletions src/wfuzz/plugins/scripts/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


KBASE_PARAM_PATH = "links.add_path"
KBASE_PARAM_ENQUEUE = "links.enqueue"
KBASE_PARAM_DOMAIN_REGEX = "links.domain"
KBASE_PARAM_REGEX = "links.regex"
KBASE_NEW_DOMAIN = "links.new_domains"
Expand All @@ -30,10 +31,16 @@ class links(BasePlugin, DiscoveryPluginMixin):

parameters = (
(
"add_path",
"enqueue",
"True",
False,
"If True, enqueue found links.",
),
(
"add_path",
"False",
False,
"Re-enqueue found paths. ie. /path/link.html link includes also path/",
"if True, re-enqueue found paths. ie. /path/link.html link enqueues also /path/",
),
(
"domain",
Expand Down Expand Up @@ -70,7 +77,8 @@ def __init__(self):
("Location", re.compile(r"(.*)")),
]

self.add_path = self.kbase[KBASE_PARAM_PATH]
self.add_path = self._bool(self.kbase[KBASE_PARAM_PATH][0])
self.enqueue_links = self._bool(self.kbase[KBASE_PARAM_ENQUEUE][0])

self.domain_regex = None
if self.kbase[KBASE_PARAM_DOMAIN_REGEX][0]:
Expand Down Expand Up @@ -136,7 +144,8 @@ def enqueue_link(self, fuzzresult, link_url, parsed_link):
if not self.regex_param or (
self.regex_param and self.regex_param.search(new_link) is not None
):
self.queue_url(new_link)
if self.enqueue_links:
self.queue_url(new_link)
self.add_verbose_result("link", "New link found", new_link)

def from_domain(self, fuzzresult, parsed_link):
Expand Down

0 comments on commit 7dbc014

Please sign in to comment.