Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to disable dirbusting via --dirbuster.tool=none argument #193

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__pycache__
*.pyc
results/
poetry.*
poetry.*
13 changes: 10 additions & 3 deletions autorecon/default-plugins/dirbuster.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ def __init__(self):
self.slug = 'dirbuster'
self.priority = 0
self.tags = ['default', 'safe', 'long', 'http']
self.tool_choices =['feroxbuster', 'gobuster', 'dirsearch', 'ffuf', 'dirb', 'none',]


def configure(self):
self.add_choice_option('tool', default='feroxbuster', choices=['feroxbuster', 'gobuster', 'dirsearch', 'ffuf', 'dirb'], help='The tool to use for directory busting. Default: %(default)s')
self.add_choice_option('tool', default='feroxbuster', choices=self.tool_choices, help='The tool to use for directory busting. set to "none" to disable dirbusting. Default: %(default)s')
self.add_list_option('wordlist', default=[os.path.join(config['data_dir'], 'wordlists', 'dirbuster.txt')], help='The wordlist(s) to use when directory busting. Separate multiple wordlists with spaces. Default: %(default)s')
self.add_option('threads', default=10, help='The number of threads to use when directory busting. Default: %(default)s')
self.add_option('ext', default='txt,html,php,asp,aspx,jsp', help='The extensions you wish to fuzz (no dot, comma separated). Default: %(default)s')
Expand All @@ -24,8 +26,11 @@ def configure(self):

def check(self):
tool = self.get_option('tool')
if tool == 'feroxbuster' and which('feroxbuster') is None:
self.error('The feroxbuster program could not be found. Make sure it is installed. (On Kali, run: sudo apt install feroxbuster)')
if tool == 'none':
self.info('dirbuster disabled via "--dirbuster.tool none"')
return True
elif tool == 'feroxbuster' and which('feroxbuster') is None:
self.error('The feroxbuster program could not be found. Make sure it is installed. (On Kali, run: sudo apt install feroxbuster)s')
return False
elif tool == 'gobuster' and which('gobuster') is None:
self.error('The gobuster program could not be found. Make sure it is installed. (On Kali, run: sudo apt install gobuster)')
Expand All @@ -41,6 +46,8 @@ def check(self):
return False

async def run(self, service):
if self.get_option('tool') == 'none':
return
dot_extensions = ','.join(['.' + x for x in self.get_option('ext').split(',')])
for wordlist in self.get_option('wordlist'):
name = os.path.splitext(os.path.basename(wordlist))[0]
Expand Down
6 changes: 1 addition & 5 deletions autorecon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ async def run():
parser.add_argument('--version', action='store_true', help='Prints the AutoRecon version and exits.')
parser.error = lambda s: fail(s[0].upper() + s[1:])
args, unknown = parser.parse_known_args()

errors = False

autorecon.argparse = parser
Expand Down Expand Up @@ -1008,6 +1007,7 @@ def unknown_help():
fail('Plugin ' + plugin.name + ' has a slug (' + plugin.slug + ') with the same name as a tag. Please either change the plugin name or override the slug.')
# Add plugin slug to tags.
plugin.tags += [plugin.slug]


if len(autorecon.plugin_types['port']) == 0:
unknown_help()
Expand Down Expand Up @@ -1095,7 +1095,6 @@ def unknown_help():
except toml.decoder.TomlDecodeError:
unknown_help()
fail('Error: Couldn\'t parse ' + g.name + ' file. Check syntax.')

other_options = []
for key, val in config_toml.items():
if key == 'global' and isinstance(val, dict): # Process global plugin options.
Expand Down Expand Up @@ -1138,11 +1137,9 @@ def unknown_help():
for key, val in config.items():
if key not in other_options:
autorecon.argparse.set_defaults(**{key: val})

parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, help='Show this help message and exit.')
parser.error = lambda s: fail(s[0].upper() + s[1:])
args = parser.parse_args()

args_dict = vars(args)
for key in args_dict:
if key in configurable_keys and args_dict[key] is not None:
Expand All @@ -1151,7 +1148,6 @@ def unknown_help():
continue
config[key] = args_dict[key]
autorecon.args = args

if args.list:
type = args.list.lower()
if type in ['plugin', 'plugins', 'port', 'ports', 'portscan', 'portscans']:
Expand Down
8 changes: 4 additions & 4 deletions autorecon/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def get_option(self, name, default=None):
if default:
return default
else:
return None
return list()
else:
return vars(self.autorecon.args)[name]
else:
if default:
return default
return None
return list()

@final
def get_global_option(self, name, default=None):
Expand Down Expand Up @@ -227,7 +227,7 @@ def __init__(self):
self.scanning_targets = []
self.completed_targets = []
self.plugins = {}
self.__slug_regex = re.compile('^[a-z0-9\-]+$')
self.__slug_regex = re.compile(r'^[a-z0-9\-]+$')
self.plugin_types = {'port':[], 'service':[], 'report':[]}
self.port_scan_semaphore = None
self.service_scan_semaphore = None
Expand All @@ -254,7 +254,7 @@ def add_argument(self, plugin, name, **kwargs):

def extract_service(self, line, regex):
if regex is None:
regex = '^(?P<port>\d+)\/(?P<protocol>(tcp|udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$'
regex = r'^(?P<port>\d+)\/(?P<protocol>(tcp|udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$'
match = re.search(regex, line)
if match:
protocol = match.group('protocol').lower()
Expand Down
Loading