Exemple #1
0
    def default(self):
        plugins = pu.plugins_base_get()
        opts = self._options(self.app.pargs)
        instances = self._instances_get(opts, plugins)

        if 'url_file' in opts:
            i = 0
            with open(opts['url_file']) as url_file:
                to_scan = {}
                for url in url_file:
                    url = url.strip()
                    found = False
                    for cms_name in instances:
                        inst_dict = instances[cms_name]
                        inst = inst_dict['inst']
                        vf = inst_dict['vf']
                        if inst.cms_identify(opts, vf, url) == True:
                            if cms_name not in to_scan:
                                to_scan[cms_name] = []

                            url = f.repair_url(url, self.out)
                            to_scan[cms_name].append(url)
                            found = True
                            break

                    if not found:
                        inst.out.warn("'%s' not identified as being a CMS we support." % url)

                    if i % 1000 == 0 and i != 0:
                       self._process_identify(opts, instances, to_scan)
                       to_scan = {}

                    i += 1

                if to_scan:
                    self._process_identify(opts, instances, to_scan)

        else:
           for cms_name in instances:
               inst_dict = instances[cms_name]
               inst = inst_dict['inst']
               vf = inst_dict['vf']

               url = f.repair_url(opts['url'], self.out)

               if inst.cms_identify(opts, vf, url) == True:
                   inst.out.echo(template("enumerate_cms.mustache",
                       {"cms_name": cms_name}))
                   inst.process_url(opts, **inst_dict['kwargs'])
Exemple #2
0
    def default(self):
        plugins = pu.plugins_base_get()

        skip_version = self.app.pargs.skip_version
        skip_modules = self.app.pargs.skip_modules
        update_only = self.app.pargs.update

        for Plugin in plugins:
            try:
                plugin = Plugin()
                plugin_name = plugin.Meta.label

                if update_only != None and update_only != plugin_name:
                    continue

                if not skip_version:
                    self.update_version(plugin, plugin_name)
                if not skip_modules:
                    self.update_plugins(plugin, plugin_name)

            except AttributeError:
                self.msg('Skipping %s because update_version_check() or update_version() is not defined.' % plugin_name)