Added plugin listing functionality

Added -l / --list to list plugins.
This commit is contained in:
Tib3rius 2021-08-31 23:43:06 -04:00
parent 342ecfe632
commit f5415f9f03
2 changed files with 22 additions and 6 deletions

View File

@ -265,6 +265,7 @@ class Plugin(object):
def __init__(self): def __init__(self):
self.name = None self.name = None
self.slug = None self.slug = None
self.description = None
self.tags = ['default'] self.tags = ['default']
self.priority = 1 self.priority = 1
self.patterns = [] 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('--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('--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('--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('-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('--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') 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.config[key] = args_dict[key]
autorecon.args = args 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']: if autorecon.config['ports']:
ports_to_scan = {'tcp':[], 'udp':[]} ports_to_scan = {'tcp':[], 'udp':[]}
unique = {'tcp':[], 'udp':[]} unique = {'tcp':[], 'udp':[]}

View File

@ -5,9 +5,10 @@ class QuickTCPPortScan(PortScan):
def __init__(self): def __init__(self):
super().__init__() 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.type = 'tcp'
self.tags = ["default", "default-port-scan"] self.tags = ['default', 'default-port-scan']
self.priority = 0 self.priority = 0
async def run(self, target): async def run(self, target):
@ -26,8 +27,9 @@ class AllTCPPortScan(PortScan):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.name = "All TCP Ports" self.name = 'All TCP Ports'
self.tags = ["default", "default-port-scan", "long"] self.description = 'Performs an Nmap scan of all TCP ports.'
self.tags = ['default', 'default-port-scan', 'long']
async def run(self, target): async def run(self, target):
if target.ports: # Don't run this plugin if there are custom ports. if target.ports: # Don't run this plugin if there are custom ports.
@ -41,9 +43,10 @@ class Top100UDPPortScan(PortScan):
def __init__(self): def __init__(self):
super().__init__() 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.type = 'udp'
self.tags = ["default", "default-port-scan", "long"] self.tags = ['default', 'default-port-scan', 'long']
async def run(self, target): async def run(self, target):
# Only run UDP scan if user is root. # Only run UDP scan if user is root.