From f5415f9f0350b8affe203f01c8245904f240bbf8 Mon Sep 17 00:00:00 2001 From: Tib3rius <48113936+Tib3rius@users.noreply.github.com> Date: Tue, 31 Aug 2021 23:43:06 -0400 Subject: [PATCH] Added plugin listing functionality Added -l / --list to list plugins. --- autorecon.py | 13 +++++++++++++ plugins/default-port-scan.py | 15 +++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/autorecon.py b/autorecon.py index 029fc91..95a48fe 100644 --- a/autorecon.py +++ b/autorecon.py @@ -265,6 +265,7 @@ class Plugin(object): def __init__(self): self.name = None self.slug = None + self.description = None self.tags = ['default'] self.priority = 1 self.patterns = [] @@ -1333,6 +1334,7 @@ async def main(): parser.add_argument('--tags', action='store', type=str, default='default', help='Tags to determine which plugins should be included. Separate tags by a plus symbol (+) to group tags together. Separate groups with a comma (,) to create multiple groups. For a plugin to be included, it must have all the tags specified in at least one group. Default: %(default)s') parser.add_argument('--exclude-tags', action='store', type=str, default='', help='Tags to determine which plugins should be excluded. Separate tags by a plus symbol (+) to group tags together. Separate groups with a comma (,) to create multiple groups. For a plugin to be excluded, it must have all the tags specified in at least one group. Default: %(default)s') parser.add_argument('--plugins-dir', action='store', type=str, help='The location of the plugins directory. Default: %(default)s') + parser.add_argument('-l', '--list', action='store', nargs='?', const='plugins', help='List all plugins or plugins of a specific type. e.g. --list, --list port, --list service') parser.add_argument('-o', '--output', action='store', dest='outdir', help='The output directory for results. Default: %(default)s') parser.add_argument('--single-target', action='store_true', help='Only scan a single target. A directory named after the target will not be created. Instead, the directory structure will be created within the output directory. Default: %(default)s') parser.add_argument('--only-scans-dir', action='store_true', help='Only create the "scans" directory for results. Other directories (e.g. exploit, loot, report) will not be created. Default: %(default)s') @@ -1540,6 +1542,17 @@ async def main(): autorecon.config[key] = args_dict[key] autorecon.args = args + if args.list: + type = args.list.lower() + if type in ['plugin', 'plugins', 'port', 'ports', 'portscan', 'portscans']: + for p in autorecon.plugin_types['port']: + print('PortScan: ' + p.name + ' (' + p.slug + ')' + (' - ' + p.description if p.description else '')) + if type in ['plugin', 'plugins', 'service', 'services', 'servicescan', 'servicescans']: + for p in autorecon.plugin_types['service']: + print('ServiceScan: ' + p.name + ' (' + p.slug + ')' + (' - ' + p.description if p.description else '')) + + sys.exit(0) + if autorecon.config['ports']: ports_to_scan = {'tcp':[], 'udp':[]} unique = {'tcp':[], 'udp':[]} diff --git a/plugins/default-port-scan.py b/plugins/default-port-scan.py index 8f67089..6bbaa51 100644 --- a/plugins/default-port-scan.py +++ b/plugins/default-port-scan.py @@ -5,9 +5,10 @@ class QuickTCPPortScan(PortScan): def __init__(self): super().__init__() - self.name = "Top TCP Ports" + self.name = 'Top TCP Ports' + self.description = 'Performs an Nmap scan of the top 1000 TCP ports.' self.type = 'tcp' - self.tags = ["default", "default-port-scan"] + self.tags = ['default', 'default-port-scan'] self.priority = 0 async def run(self, target): @@ -26,8 +27,9 @@ class AllTCPPortScan(PortScan): def __init__(self): super().__init__() - self.name = "All TCP Ports" - self.tags = ["default", "default-port-scan", "long"] + self.name = 'All TCP Ports' + self.description = 'Performs an Nmap scan of all TCP ports.' + self.tags = ['default', 'default-port-scan', 'long'] async def run(self, target): if target.ports: # Don't run this plugin if there are custom ports. @@ -41,9 +43,10 @@ class Top100UDPPortScan(PortScan): def __init__(self): super().__init__() - self.name = "Top 100 UDP Ports" + self.name = 'Top 100 UDP Ports' + self.description = 'Performs an Nmap scan of the top 100 UDP ports.' self.type = 'udp' - self.tags = ["default", "default-port-scan", "long"] + self.tags = ['default', 'default-port-scan', 'long'] async def run(self, target): # Only run UDP scan if user is root.