for l in links: if not l or l.startswith("#"): continue if l.startswith("http"): if "||" in l: l, flag = l.split("||") flags[l] = str(flag.strip()) urls.append(l) elif len(l.rsplit(" ", 1)) == 2: name, hash = l.rsplit(" ", 1) HosterPluginTester.files[name] = str(hash) hoster, c = c.pluginManager.parseUrls(urls) plugins = accumulate(hoster) for plugin, urls in plugins.iteritems(): # closure functions to retain local scope def meta_class(plugin): class _testerClass(HosterPluginTester): pass _testerClass.__name__ = plugin return _testerClass _testerClass = meta_class(plugin) for i, url in enumerate(urls): def meta(__plugin, url, flag, sig): def _test(self):
f = open(join(dirname(__file__), "crypterlinks.txt")) links = [x.strip() for x in f.readlines()] urls = [] flags = {} for l in links: if not l or l.startswith("#"): continue if l.startswith("http"): if "||" in l: l, flag = l.split("||") flags[l] = flag urls.append(l) h, crypter = c.pluginManager.parseUrls(urls) plugins = accumulate(crypter) for plugin, urls in plugins.iteritems(): def meta_class(plugin): class _testerClass(CrypterPluginTester): pass _testerClass.__name__ = plugin return _testerClass _testerClass = meta_class(plugin) for i, url in enumerate(urls): def meta(plugin, url, flag, sig): def _test(self): self.test_plugin(plugin, url, flag)
def run(self): """run method""" plugins = accumulate(self.data) crypter = {} # filter out crypter plugins for name in self.m.core.pluginManager.getPlugins("crypter"): if name in plugins: crypter[name] = plugins[name] del plugins[name] #directly write to database if self.pid > -1: for pluginname, urls in plugins.iteritems(): plugin = self.m.core.pluginManager.getPluginModule(pluginname) klass = self.m.core.pluginManager.getPluginClass(pluginname) if has_method(klass, "getInfo"): self.fetchForPlugin(pluginname, klass, urls, self.updateDB) self.m.core.files.save() elif has_method(plugin, "getInfo"): self.log.debug( "Deprecated .getInfo() method on module level, use classmethod instead" ) self.fetchForPlugin(pluginname, plugin, urls, self.updateDB) self.m.core.files.save() else: #post the results for name, urls in crypter: #attach container content try: data = self.decrypt(name, urls) except: print_exc() self.m.log.error("Could not decrypt container.") data = [] accumulate(data, plugins) self.m.infoResults[self.rid] = {} for pluginname, urls in plugins.iteritems(): plugin = self.m.core.pluginManager.getPlugin(pluginname, True) klass = getattr(plugin, pluginname) if has_method(klass, "getInfo"): self.fetchForPlugin(pluginname, plugin, urls, self.updateResult, True) #force to process cache if self.cache: self.updateResult(pluginname, [], True) elif has_method(plugin, "getInfo"): self.log.debug( "Deprecated .getInfo() method on module level, use staticmethod instead" ) self.fetchForPlugin(pluginname, plugin, urls, self.updateResult, True) #force to process cache if self.cache: self.updateResult(pluginname, [], True) else: #generate default result result = [(url, 0, 3, url) for url in urls] self.updateResult(pluginname, result, True) self.m.infoResults[self.rid]["ALL_INFO_FETCHED"] = {} self.m.timestamp = time() + 5 * 60
def run(self): """run method""" plugins = accumulate(self.data) crypter = {} # filter out crypter plugins for name in self.m.core.pluginManager.getPlugins("crypter"): if name in plugins: crypter[name] = plugins[name] del plugins[name] #directly write to database if self.pid > -1: for pluginname, urls in plugins.iteritems(): plugin = self.m.core.pluginManager.getPluginModule(pluginname) klass = self.m.core.pluginManager.getPluginClass(pluginname) if has_method(klass, "getInfo"): self.fetchForPlugin(pluginname, klass, urls, self.updateDB) self.m.core.files.save() elif has_method(plugin, "getInfo"): self.log.debug("Deprecated .getInfo() method on module level, use classmethod instead") self.fetchForPlugin(pluginname, plugin, urls, self.updateDB) self.m.core.files.save() else: #post the results for name, urls in crypter: #attach container content try: data = self.decrypt(name, urls) except: print_exc() self.m.log.error("Could not decrypt container.") data = [] accumulate(data, plugins) self.m.infoResults[self.rid] = {} for pluginname, urls in plugins.iteritems(): plugin = self.m.core.pluginManager.getPlugin(pluginname, True) klass = getattr(plugin, pluginname) if has_method(klass, "getInfo"): self.fetchForPlugin(pluginname, plugin, urls, self.updateResult, True) #force to process cache if self.cache: self.updateResult(pluginname, [], True) elif has_method(plugin, "getInfo"): self.log.debug("Deprecated .getInfo() method on module level, use staticmethod instead") self.fetchForPlugin(pluginname, plugin, urls, self.updateResult, True) #force to process cache if self.cache: self.updateResult(pluginname, [], True) else: #generate default result result = [(url, 0, 3, url) for url in urls] self.updateResult(pluginname, result, True) self.m.infoResults[self.rid]["ALL_INFO_FETCHED"] = {} self.m.timestamp = time() + 5 * 60
for l in links: if not l or l.startswith("#"): continue if l.startswith("http"): if "||" in l: l, flag = l.split("||") flags[l] = str(flag.strip()) urls.append(l) elif len(l.rsplit(" ", 1)) == 2: name, hash = l.rsplit(" ", 1) HosterPluginTester.files[name] = str(hash) hoster, c = c.pluginManager.parseUrls(urls) plugins = accumulate(hoster) for plugin, urls in plugins.iteritems(): # closure functions to retain local scope def meta_class(plugin): class _testerClass(HosterPluginTester): pass _testerClass.__name__ = plugin return _testerClass _testerClass = meta_class(plugin) for i, url in enumerate(urls): def meta(__plugin, url, flag, sig): def _test(self): self.test_plugin(__plugin, url, flag)