Bug fixes.

Fixed bug in Curl Robots where file would get created despite no robots.txt existing.
Fixed bug where manual command exceptions would not get caught.
This commit is contained in:
Tib3rius 2021-09-30 13:43:55 -04:00
parent e3d95c650c
commit 0beb2ad7c1
2 changed files with 10 additions and 4 deletions

View File

@ -68,10 +68,11 @@ class CurlRobots(ServiceScan):
async def run(self, service): async def run(self, service):
if service.protocol == 'tcp': if service.protocol == 'tcp':
_, stdout, _ = await service.execute('curl -sSikf {http_scheme}://{addressv6}:{port}/robots.txt', future_outfile='{protocol}_{port}_{http_scheme}_curl-robots.txt') process, stdout, _ = await service.execute('curl -sSikf {http_scheme}://{addressv6}:{port}/robots.txt', future_outfile='{protocol}_{port}_{http_scheme}_curl-robots.txt')
lines = await stdout.readlines() lines = await stdout.readlines()
if lines: if process.returncode == 0 and lines:
filename = fformat('{scandir}/{protocol}_{port}_{http_scheme}_curl-robots.txt') filename = fformat('{scandir}/{protocol}_{port}_{http_scheme}_curl-robots.txt')
with open(filename, mode='wt', encoding='utf8') as robots: with open(filename, mode='wt', encoding='utf8') as robots:
robots.write('\n'.join(lines)) robots.write('\n'.join(lines))

View File

@ -17,7 +17,7 @@ from autorecon.io import slugify, e, fformat, cprint, debug, info, warn, error,
from autorecon.plugins import Pattern, PortScan, ServiceScan, Report, AutoRecon from autorecon.plugins import Pattern, PortScan, ServiceScan, Report, AutoRecon
from autorecon.targets import Target, Service from autorecon.targets import Target, Service
VERSION = "2.0.1" VERSION = "2.0.2"
if not os.path.exists(config['config_dir']): if not os.path.exists(config['config_dir']):
shutil.rmtree(config['config_dir'], ignore_errors=True, onerror=None) shutil.rmtree(config['config_dir'], ignore_errors=True, onerror=None)
@ -627,7 +627,12 @@ async def scan_target(target):
for member_name, _ in inspect.getmembers(plugin, predicate=inspect.ismethod): for member_name, _ in inspect.getmembers(plugin, predicate=inspect.ismethod):
if member_name == 'manual': if member_name == 'manual':
plugin.manual(service, plugin_was_run) try:
plugin.manual(service, plugin_was_run)
except Exception as ex:
exc_type, exc_value, exc_tb = sys.exc_info()
error_text = ''.join(traceback.format_exception(exc_type, exc_value, exc_tb)[-2:])
cprint('Error: Service scan {bblue}' + plugin.name + ' {green}(' + plugin_tag + '){rst} running against {byellow}' + target.address + '{rst} produced an exception:\n\n' + error_text, color=Fore.RED, char='!', printmsg=True)
if service.manual_commands: if service.manual_commands:
plugin_run = False plugin_run = False