MCPcopy Create free account
hub / github.com/AutoRecon/AutoRecon / Enum4Linux

Class Enum4Linux

autorecon/default-plugins/enum4linux.py:4–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2from shutil import which
3
4class Enum4Linux(ServiceScan):
5
6 def __init__(self):
7 super().__init__()
8 self.name = "Enum4Linux"
9 self.tags = ['default', 'safe', 'active-directory']
10
11 def configure(self):
12 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')
13 self.match_service_name(['^ldap', '^smb', '^microsoft\-ds', '^netbios'])
14 self.match_port('tcp', [139, 389, 445])
15 self.match_port('udp', 137)
16 self.run_once(True)
17
18 def check(self):
19 tool = self.get_option('tool')
20 if tool == 'enum4linux' and which('enum4linux') is None:
21 self.error('The enum4linux program could not be found. Make sure it is installed. (On Kali, run: sudo apt install enum4linux)')
22 return False
23 elif tool == 'enum4linux-ng' and which('enum4linux-ng') is None:
24 self.error('The enum4linux-ng program could not be found. Make sure it is installed. (https://github.com/cddmp/enum4linux-ng)')
25 return False
26
27 async def run(self, service):
28 if service.target.ipversion == 'IPv4':
29 tool = self.get_option('tool')
30 if tool is not None:
31 if tool == 'enum4linux':
32 await service.execute('enum4linux -a -M -l -d {address} 2>&1', outfile='enum4linux.txt')
33 elif tool == 'enum4linux-ng':
34 await service.execute('enum4linux-ng -A -d -v {address} 2>&1', outfile='enum4linux-ng.txt')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected