From 08d8f7b27ce53788be72287b08130e8df201ee2b Mon Sep 17 00:00:00 2001 From: lapinou <10383569+lap1nou@users.noreply.github.com> Date: Fri, 28 Oct 2022 07:44:38 +0200 Subject: [PATCH] Added enum4linux-ng choice (#173) * Added enum4linux-ng choice * Update enum4linux.py Co-authored-by: Tib3rius <48113936+Tib3rius@users.noreply.github.com> --- autorecon/default-plugins/enum4linux.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/autorecon/default-plugins/enum4linux.py b/autorecon/default-plugins/enum4linux.py index 9ca0a57..1f278fa 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,25 @@ class Enum4Linux(ServiceScan): self.tags = ['default', 'safe', 'active-directory'] def configure(self): + self.add_choice_option('tool', default=('enum4linux-ng' if which('enum4linux-ng') else 'enum4linux'), choices=['enum4linux-ng', 'enum4linux'], 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' and 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)') + return False + elif tool == 'enum4linux-ng' and which('enum4linux-ng') is None: + self.error('The enum4linux-ng program could not be found. Make sure it is installed. (https://github.com/cddmp/enum4linux-ng)') + return False + 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.tool is not None: + if self.tool == 'enum4linux': + await service.execute('enum4linux -a -M -l -d {address} 2>&1', outfile='enum4linux.txt') + elif self.tool == 'enum4linux-ng': + await service.execute('enum4linux-ng -A -d -v {address} 2>&1', outfile='enum4linux-ng.txt')