From 8851080b50f814ccf675bc633104238a858f8941 Mon Sep 17 00:00:00 2001 From: lap1nou Date: Wed, 31 Aug 2022 20:18:58 +0200 Subject: [PATCH] Added enum4linux-ng choice --- autorecon/default-plugins/enum4linux.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/autorecon/default-plugins/enum4linux.py b/autorecon/default-plugins/enum4linux.py index 9ca0a57..4db5462 100644 --- a/autorecon/default-plugins/enum4linux.py +++ b/autorecon/default-plugins/enum4linux.py @@ -1,4 +1,5 @@ from autorecon.plugins import ServiceScan +from shutil import which class Enum4Linux(ServiceScan): @@ -8,11 +9,24 @@ class Enum4Linux(ServiceScan): self.tags = ['default', 'safe', 'active-directory'] def configure(self): + self.add_choice_option('tool', default='enum4linux', choices=['enum4linux', 'enum4linux-ng'], help='The tool to use for doing Windows and Samba enumeration. Default: %(default)s') self.match_service_name(['^ldap', '^smb', '^microsoft\-ds', '^netbios']) self.match_port('tcp', [139, 389, 445]) self.match_port('udp', 137) self.run_once(True) - + + def check(self): + tool = self.get_option('tool') + if tool == 'enum4linux': + if which('enum4linux') is None: + self.error('The enum4linux program could not be found. Make sure it is installed. (On Kali, run: sudo apt install enum4linux)') + elif tool == 'enum4linux-ng': + if which('enum4linux-ng') is None: + self.error('The enum4linux-ng program could not be found. Make sure it is installed. (On Kali, run: sudo apt install enum4linux-ng)') + async def run(self, service): if service.target.ipversion == 'IPv4': - await service.execute('enum4linux -a -M -l -d {address} 2>&1', outfile='enum4linux.txt') + if self.get_option('tool') == 'enum4linux': + await service.execute('enum4linux -a -M -l -d {address} 2>&1', outfile='enum4linux.txt') + elif self.get_option('tool') == 'enum4linux-ng': + await service.execute('enum4linux-ng -A -L -d {address} 2>&1', outfile='enum4linux-ng.txt') \ No newline at end of file