Skip to content

Commit

Permalink
set plugin group by target if not specified, fixes owtf#390
Browse files Browse the repository at this point in the history
  • Loading branch information
DarKnight24 committed Apr 22, 2016
1 parent f744ff8 commit e5480bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 4 additions & 1 deletion framework/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def load_work(self, target_url, options):
"""
target = self.target.GetTargetConfigs({'target_url': target_url})
group = options['PluginGroup']
if options['OnlyPlugins'] is None:
group = options['PluginGroup']
# If the plugin group option is the default one (not specified by
# the user).
if group is None:
Expand All @@ -168,6 +168,9 @@ def load_work(self, target_url, options):
"code": options.get("OnlyPlugins"),
"type": options.get("PluginType")}
plugins = self.db_plugin.GetAll(filter_data)
if not plugins:
logging.error("No plugin found matching type %s and group '%s' for %s target"
% (options['PluginType'], group, target[0]['top_url']))
self.worklist_manager.add_work(
target,
plugins,
Expand Down
11 changes: 3 additions & 8 deletions owtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def process_options(user_args):
# Default settings:
profiles = {}
plugin_group = arg.PluginGroup

if arg.CustomProfile: # Custom profiles specified
# Quick pseudo-validation check
for profile in arg.CustomProfile.split(','):
Expand Down Expand Up @@ -141,18 +142,12 @@ def process_options(user_args):
except ValueError:
usage("Invalid port for Inbound Proxy")

plugin_types_for_group = ServiceLocator.get_component("db_plugin").GetTypesForGroup(plugin_group)
plugin_types_for_group = db_plugin.GetTypesForGroup(plugin_group)
if arg.PluginType == 'all':
arg.PluginType = plugin_types_for_group
elif arg.PluginType == 'quiet':
arg.PluginType = ['passive', 'semi_passive']
if plugin_group != 'web':
usage("The quiet plugin type is only for the web plugin group")
elif arg.PluginType not in plugin_types_for_group:
usage(
"Invalid Plugin Type '" + str(arg.PluginType) +
"' for Plugin Group '" + str(plugin_group) +
"'. Valid Types: " + ', '.join(plugin_types_for_group))


scope = arg.Targets or [] # Arguments at the end are the URL target(s)
num_targets = len(scope)
Expand Down

0 comments on commit e5480bf

Please sign in to comment.