Beispiel #1
0
    def result(self, result, functionality):
        """
        For the final result of the scan.
        @param result: as returned by BasePluginInternal.url_scan
        @param functionality: functionality as returned by
            BasePluginInternal._general_init
        """
        for enumerate in result:

            # The host is a special header, we must not attempt to display it.
            if enumerate == "host" or enumerate == "cms_name":
                continue

            result_ind = result[enumerate]
            finds = result_ind['finds']
            is_empty = result_ind['is_empty']

            template_str = functionality[enumerate]['template']
            template_params = {
                    'noun': enumerate,
                    'Noun': enumerate.capitalize(),
                    'items': finds,
                    'empty': is_empty,
                }

            self.echo(template(template_str, template_params))
Beispiel #2
0
    def result(self, result, functionality):
        """
        For the final result of the scan.
        @param result: as returned by BasePluginInternal.url_scan
        @param functionality: functionality as returned by
            BasePluginInternal._general_init
        """
        for enumerate in result:

            # The host is a special header, we must not attempt to display it.
            if enumerate == "host" or enumerate == "cms_name":
                continue

            result_ind = result[enumerate]
            finds = result_ind['finds']
            is_empty = result_ind['is_empty']

            template_str = functionality[enumerate]['template']
            template_params = {
                'noun': enumerate,
                'Noun': enumerate.capitalize(),
                'items': finds,
                'empty': is_empty,
            }

            self.echo(template(template_str, template_params))
    class Meta:
        label = 'base'
        description = """
    |
 ___| ___  ___  ___  ___  ___  ___  ___  ___  ___
|   )|   )|   )|   )|   )|___)|___ |    |   )|   )
|__/ |    |__/ |__/ |__/ |__   __/ |__  |__/||  /
                    |
=================================================
"""

        epilog = template("help_epilog.mustache")
    class Meta:
        label = 'scan'
        description = 'cms scanning functionality.'
        stacked_on = 'base'
        stacked_type = 'nested'

        epilog = "\n"

        argument_formatter = common.SmartFormatter
        epilog = template("help_epilog.mustache")

        arguments = [
            (['-u', '--url'], dict(action='store', help='')),
            (['-U', '--url-file'],
             dict(action='store',
                  help='''A file which
                    contains a list of URLs.''')),
            (['--enumerate', '-e'],
             dict(action='store',
                  help='R|' + common.template('help_enumerate.mustache'),
                  choices=common.enum_list(common.Enumerate),
                  default='a')),
            (['--method'],
             dict(action='store',
                  help='R|' + common.template('help_method.mustache'),
                  choices=common.enum_list(common.ScanningMethod))),
            (['--verb'],
             dict(action='store',
                  help="""The HTTP verb to use;
                    the default option is head, except for version enumeration
                    requests, which are always get because we need to get the hash
                    from the file's contents""",
                  default='head',
                  choices=common.enum_list(common.Verb))),
            (['--number', '-n'],
             dict(action='store',
                  help='''Number of
                    words to attempt from the plugin/theme dictionary. Default
                    is 1000. Use -n 'all' to use all available.''',
                  default=BasePluginInternal.NUMBER_DEFAULT)),
            (['--plugins-base-url'],
             dict(action='store',
                  help="""Location
                    where the plugins are stored by the CMS. Default is the CMS'
                    default location. First %%s in string will be replaced with
                    the url, and the second one will be replaced with the module
                    name. E.g. '%%ssites/all/modules/%%s/'""")),
            (['--themes-base-url'],
             dict(action='store',
                  help='''Same as
                    above, but for themes.''')),
            (['--timeout'],
             dict(action='store',
                  help="""How long to wait
                    for an HTTP response before timing out (in seconds).""",
                  default=45,
                  type=int)),
            (['--timeout-host'],
             dict(action='store',
                  help="""Maximum time
                    to spend per host (in seconds).""",
                  default=1800,
                  type=int)),
            (['--no-follow-redirects'],
             dict(action='store_false',
                  help="""Prevent
                    the following of redirects.""",
                  dest="follow_redirects",
                  default=True)),
            (['--host'],
             dict(action='store',
                  help="""Override host header
                    with this value.""",
                  default=None)),
            (['--massscan-override'],
             dict(action='store_true',
                  help="""Overrides defaults with defaults convenient for
                    mass-scanning of hosts.""",
                  default=False)),
            (['--threads', '-t'],
             dict(action='store',
                  help='''Number of
                    threads. Default 4.''',
                  default=4,
                  type=int)),
            (['--threads-identify'],
             dict(action='store',
                  help='''Number of
                    threads used for CMS identification.''',
                  default=None,
                  type=int)),
            (['--threads-scan'],
             dict(action='store',
                  help='''Threads used
                    for mass scanning.''',
                  default=None,
                  type=int)),
            (['--threads-enumerate'],
             dict(action='store',
                  help='''Threads
                    used for plugin enumeration.''',
                  default=None,
                  type=int)),
            (['--output', '-o'],
             dict(action='store',
                  help='Output format',
                  choices=common.enum_list(common.ValidOutputs),
                  default='standard')),
            (['--debug-requests'],
             dict(action='store_true',
                  help="""Prints every
                    HTTP request made and the response returned from the server
                    for debugging purposes. Disables threading and loading
                    bars.""",
                  default=False)),
            (['--error-log'],
             dict(action='store',
                  help='''A file to store the
                    errors on.''',
                  default=None)),
            (['--resume'],
             dict(action='store_true',
                  help='''Resume the url_file
                    scan as of the last known scanned url. Must be used in
                    conjunction with --error-log.''',
                  default=None)),
        ]
 def default(self):
     print(template("intro.mustache", {'version': version_get(),
         'color': True}))