Skip to content

Commit

Permalink
Fixed option --filter-pipe-name not working, fixes #54
Browse files Browse the repository at this point in the history
  • Loading branch information
p0dalirius committed Oct 4, 2023
1 parent c21dfab commit b0cefa9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
7 changes: 7 additions & 0 deletions coercer/core/Filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ def method_matches_filter(self, instance):
for protocol in self.filter_protocol_name:
if (protocol in instance.protocol["shortname"]) or (protocol in instance.protocol["longname"]):
outcome = True
#
"""
candidate_pipes = [p["namedpipe"] for p in instance.access["ncan_np"]]
for filter_pipe in self.filter_pipe_name:
if filter_pipe in candidate_pipes:
outcome = True
"""
return outcome

def pipe_matches_filter(self, pipe_name):
Expand Down
18 changes: 10 additions & 8 deletions coercer/core/modes/coerce.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@ def action_coerce(target, available_methods, options, credentials, reporter):
if access_type == "ncan_np":
for access_method in access_methods:
namedpipe, uuid, version = access_method["namedpipe"], access_method["uuid"], access_method["version"]
if namedpipe not in tasks[access_type].keys():
tasks[access_type][namedpipe] = {}
if filter.pipe_matches_filter(namedpipe):
if namedpipe not in tasks[access_type].keys():
tasks[access_type][namedpipe] = {}

if uuid not in tasks[access_type][namedpipe].keys():
tasks[access_type][namedpipe][uuid] = {}
if uuid not in tasks[access_type][namedpipe].keys():
tasks[access_type][namedpipe][uuid] = {}

if version not in tasks[access_type][namedpipe][uuid].keys():
tasks[access_type][namedpipe][uuid][version] = []
if version not in tasks[access_type][namedpipe][uuid].keys():
tasks[access_type][namedpipe][uuid][version] = []

if instance not in tasks[access_type][namedpipe][uuid][version]:
tasks[access_type][namedpipe][uuid][version].append(instance)

if instance not in tasks[access_type][namedpipe][uuid][version]:
tasks[access_type][namedpipe][uuid][version].append(instance)
elif access_type == "ncacn_ip_tcp":
for access_method in access_methods:
uuid, version = access_method["uuid"], access_method["version"]
Expand Down
14 changes: 8 additions & 6 deletions coercer/core/modes/fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,16 @@ def action_fuzz(target, available_methods, options, credentials, reporter):
if access_type == "ncan_np":
for access_method in access_methods:
namedpipe, uuid, version = access_method["namedpipe"], access_method["uuid"], access_method["version"]
if uuid not in tasks[access_type].keys():
tasks[access_type][uuid] = {}
if filter.pipe_matches_filter(namedpipe):
if uuid not in tasks[access_type].keys():
tasks[access_type][uuid] = {}

if version not in tasks[access_type][uuid].keys():
tasks[access_type][uuid][version] = []
if version not in tasks[access_type][uuid].keys():
tasks[access_type][uuid][version] = []

if instance not in tasks[access_type][uuid][version]:
tasks[access_type][uuid][version].append(instance)

if instance not in tasks[access_type][uuid][version]:
tasks[access_type][uuid][version].append(instance)
elif access_type == "ncacn_ip_tcp":
for access_method in access_methods:
uuid, version = access_method["uuid"], access_method["version"]
Expand Down
18 changes: 10 additions & 8 deletions coercer/core/modes/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ def action_scan(target, available_methods, options, credentials, reporter):
if access_type == "ncan_np":
for access_method in access_methods:
namedpipe, uuid, version = access_method["namedpipe"], access_method["uuid"], access_method["version"]
if namedpipe not in tasks[access_type].keys():
tasks[access_type][namedpipe] = {}
if filter.pipe_matches_filter(namedpipe):
if namedpipe not in tasks[access_type].keys():
tasks[access_type][namedpipe] = {}

if uuid not in tasks[access_type][namedpipe].keys():
tasks[access_type][namedpipe][uuid] = {}
if uuid not in tasks[access_type][namedpipe].keys():
tasks[access_type][namedpipe][uuid] = {}

if version not in tasks[access_type][namedpipe][uuid].keys():
tasks[access_type][namedpipe][uuid][version] = []
if version not in tasks[access_type][namedpipe][uuid].keys():
tasks[access_type][namedpipe][uuid][version] = []

if instance not in tasks[access_type][namedpipe][uuid][version]:
tasks[access_type][namedpipe][uuid][version].append(instance)

if instance not in tasks[access_type][namedpipe][uuid][version]:
tasks[access_type][namedpipe][uuid][version].append(instance)
elif access_type == "ncacn_ip_tcp":
for access_method in access_methods:
uuid, version = access_method["uuid"], access_method["version"]
Expand Down

0 comments on commit b0cefa9

Please sign in to comment.