diff --git a/coercer/core/Filter.py b/coercer/core/Filter.py index 2abdf0f..87af968 100644 --- a/coercer/core/Filter.py +++ b/coercer/core/Filter.py @@ -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): diff --git a/coercer/core/modes/coerce.py b/coercer/core/modes/coerce.py index e5f4fa8..c1b7a83 100644 --- a/coercer/core/modes/coerce.py +++ b/coercer/core/modes/coerce.py @@ -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"] diff --git a/coercer/core/modes/fuzz.py b/coercer/core/modes/fuzz.py index 60a4d3d..af31f7f 100644 --- a/coercer/core/modes/fuzz.py +++ b/coercer/core/modes/fuzz.py @@ -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"] diff --git a/coercer/core/modes/scan.py b/coercer/core/modes/scan.py index 07758df..70f19b8 100644 --- a/coercer/core/modes/scan.py +++ b/coercer/core/modes/scan.py @@ -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"]