Skip to content

Commit

Permalink
fix: 'xpath' is not a valid MatcherType
Browse files Browse the repository at this point in the history
  • Loading branch information
xixixiba committed Mar 12, 2024
1 parent 0436840 commit 4f6a378
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pocsuite3/lib/yaml/nuclei/operators/matchers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def match_xpath(matcher: Matcher, body: str) -> (bool, list):
"""Matches xpath check against a body.
"""
# Convert the body string to etree.HTML object for xpath manipulations
if body is None:
return False
body_tree = html.fromstring(body)
matched_xpaths = []

Expand Down
2 changes: 1 addition & 1 deletion pocsuite3/lib/yaml/nuclei/protocols/http/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def http_match(request: HttpRequest, resp_data: dict, interactsh=None):
matcher_res = match_dsl(matcher, resp_data)

elif matcher.type == MatcherType.XpathMatcher:
matcher_res, = match_xpath(matcher, item)
matcher_res, _ = match_xpath(matcher, item)

if matcher.negative:
matcher_res = not matcher_res
Expand Down
2 changes: 1 addition & 1 deletion pocsuite3/lib/yaml/nuclei/protocols/network/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def network_match(request: NetworkRequest, resp_data: dict, interactsh=None):
matcher_res, _ = match_binary(matcher, item)

elif matcher.type == MatcherType.XpathMatcher:
matcher_res, = match_xpath(matcher, item)
matcher_res, _ = match_xpath(matcher, item)

elif matcher.type == MatcherType.DSLMatcher:
matcher_res = match_dsl(matcher, resp_data)
Expand Down

0 comments on commit 4f6a378

Please sign in to comment.