Compare commits
5 Commits
28637a9396
...
0d1c09d2ae
Author | SHA1 | Date |
---|---|---|
|
0d1c09d2ae | |
|
a9b9f13790 | |
|
3861819699 | |
|
a58d757a91 | |
|
5d1e0180a1 |
|
@ -15,7 +15,7 @@ class DirBuster(ServiceScan):
|
|||
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_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=4, help='The number of threads to use when directory busting. 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')
|
||||
self.add_true_option('recursive', help='Enables recursive searching (where available). Warning: This may cause significant increases to scan times. Default: %(default)s')
|
||||
self.add_option('extras', default='', help='Any extra options you wish to pass to the tool when it runs. e.g. --dirbuster.extras=\'-s 200,301 --discover-backup\'')
|
||||
|
@ -41,12 +41,11 @@ class DirBuster(ServiceScan):
|
|||
return False
|
||||
|
||||
async def run(self, service):
|
||||
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]
|
||||
if self.get_option('tool') == 'feroxbuster':
|
||||
await service.execute('feroxbuster -u {http_scheme}://{addressv6}:{port}/ -t ' + str(self.get_option('threads')) + ' -w ' + wordlist + ' -x "' + self.get_option('ext') + '" -v -k ' + ('' if self.get_option('recursive') else '-n ') + '-q -e -r -o "{scandir}/{protocol}_{port}_{http_scheme}_feroxbuster_' + name + '.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else ''))
|
||||
await service.execute('feroxbuster -u {http_scheme}://{addressv6}:{port}/ -t ' + str(self.get_option('threads')) + ' -w ' + wordlist + ' -x "' + self.get_option('ext') + '" -v -k ' + ('' if self.get_option('recursive') else '-n --dont-extract-links') + ' -q -r --auto-bail --status-codes 200,204,301,302,307,308,401,403,405 -o "{scandir}/{protocol}_{port}_{http_scheme}_feroxbuster_' + name + '.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else ''))
|
||||
|
||||
elif self.get_option('tool') == 'gobuster':
|
||||
await service.execute('gobuster dir -u {http_scheme}://{addressv6}:{port}/ -t ' + str(self.get_option('threads')) + ' -w ' + wordlist + ' -e -k -x "' + self.get_option('ext') + '" -z -r -o "{scandir}/{protocol}_{port}_{http_scheme}_gobuster_' + name + '.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else ''))
|
||||
|
|
|
@ -19,6 +19,26 @@ from autorecon.targets import Target, Service
|
|||
|
||||
VERSION = "2.0.36"
|
||||
|
||||
def latest_mtime(path):
|
||||
"""Recursively get the latest modification time in a directory."""
|
||||
if not os.path.exists(path):
|
||||
return 0
|
||||
if os.path.isfile(path):
|
||||
return os.path.getmtime(path)
|
||||
latest = os.path.getmtime(path)
|
||||
for root, _, files in os.walk(path):
|
||||
for f in files:
|
||||
fpath = os.path.join(root, f)
|
||||
latest = max(latest, os.path.getmtime(fpath))
|
||||
return latest
|
||||
|
||||
def needs_update(src, dst):
|
||||
"""Return True if dst doesn't exist or src contains newer files than dst."""
|
||||
if not os.path.exists(dst):
|
||||
return True
|
||||
return latest_mtime(src) > latest_mtime(dst)
|
||||
|
||||
# ----------------------- CONFIG DIR -----------------------
|
||||
if not os.path.exists(config['config_dir']):
|
||||
shutil.rmtree(config['config_dir'], ignore_errors=True, onerror=None)
|
||||
os.makedirs(config['config_dir'], exist_ok=True)
|
||||
|
@ -33,23 +53,35 @@ else:
|
|||
if not os.path.exists(os.path.join(config['config_dir'], 'VERSION-' + VERSION)):
|
||||
warn('It looks like the config in ' + config['config_dir'] + ' is outdated. Please remove the ' + config['config_dir'] + ' directory and re-run AutoRecon to rebuild it.')
|
||||
|
||||
# ----------------------- DATA DIR -----------------------
|
||||
plugins_src = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default-plugins')
|
||||
plugins_dst = os.path.join(config['data_dir'], 'plugins')
|
||||
|
||||
wordlists_src = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'wordlists')
|
||||
wordlists_dst = os.path.join(config['data_dir'], 'wordlists')
|
||||
|
||||
version_dir = os.path.join(config['data_dir'], f'VERSION-{VERSION}')
|
||||
|
||||
if not os.path.exists(config['data_dir']):
|
||||
shutil.rmtree(config['data_dir'], ignore_errors=True, onerror=None)
|
||||
os.makedirs(config['data_dir'], exist_ok=True)
|
||||
open(os.path.join(config['data_dir'], 'VERSION-' + VERSION), 'a').close()
|
||||
shutil.copytree(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default-plugins'), os.path.join(config['data_dir'], 'plugins'))
|
||||
shutil.copytree(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'wordlists'), os.path.join(config['data_dir'], 'wordlists'))
|
||||
shutil.copytree(plugins_src, plugins_dst)
|
||||
shutil.copytree(wordlists_src, wordlists_dst)
|
||||
else:
|
||||
develop =False
|
||||
if not os.path.exists(os.path.join(config['data_dir'], 'plugins')) or develop:
|
||||
shutil.copytree(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default-plugins'), os.path.join(config['data_dir'], 'plugins'), dirs_exist_ok=True)
|
||||
if not os.path.exists(os.path.join(config['data_dir'], 'wordlists')):
|
||||
shutil.copytree(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'wordlists'), os.path.join(config['data_dir'], 'wordlists'))
|
||||
if not os.path.exists(os.path.join(config['data_dir'], 'VERSION-' + VERSION)):
|
||||
develop = False
|
||||
# Copy plugins if develop mode or changes detected
|
||||
if develop or needs_update(plugins_src, plugins_dst):
|
||||
shutil.copytree(plugins_src, plugins_dst, dirs_exist_ok=True)
|
||||
# Copy wordlists if changes detected
|
||||
if needs_update(wordlists_src, wordlists_dst):
|
||||
shutil.copytree(wordlists_src, wordlists_dst, dirs_exist_ok=True)
|
||||
# Warn if version is outdated
|
||||
if not os.path.exists(version_dir):
|
||||
warn('It looks like the plugins in ' + config['data_dir'] + ' are outdated. Please remove the ' + config['data_dir'] + ' directory and re-run AutoRecon to rebuild them.')
|
||||
|
||||
|
||||
|
||||
# Saves current terminal settings so we can restore them.
|
||||
terminal_settings = None
|
||||
|
||||
|
|
Loading…
Reference in New Issue