def guess_plugin(self, plugin_name): """Check for the existence of the named plugin""" path_nodes, version_nodes, all_versions = \ wadt.loadTables(wac.getDbPath(self.app_name, plugin_name), False) self.error_page_fingerprint = wafu.identify_error_page(self.url) for file in wafu.pick_indicator_files(version_nodes, all_versions): try: #TODO: factor out construction of path to plugin files... #not all plugin dirs can be found simple appending url = self.url + plugin_name + file #self.logger.logExtraInfo(" Trying " + url + "...") data = wafu.urlread_spoof_ua(url) #Check for custom 404 if wafu.compare_to_error_page(self.error_page_fingerprint, data): return False #self.logger.logExtraInfo("found!") return True break except urllib2.URLError, e: #self.logger.logExtraInfo("URLError: %s" % e) pass except HTTPException, e2: #self.logger.logExtraInfo("HTTPError: %s" % e2) pass
def guess_app(self, app_name): """Probe a small number of paths to verify the existence (but not the version) of a particular app """ if not self.error_page_fingerprint and not self.already_checked_for_error_page: print "WARN: Fetching error page because it was not available" self.error_page_fingerprint = wafu.identify_error_page(self.url) self.already_checked_for_error_page = True path_nodes, version_nodes, all_versions = wadt.loadTables(wac.getDbPath(app_name), printStats=False) for file in wac.APP_CONFIG[app_name]["indicatorFiles"]: possible_vers = self.fingerprint_file(file, path_nodes, version_nodes, all_versions) if possible_vers: return True return False
def _load_db(self): self.path_nodes, self.version_nodes, self.all_versions = \ wadt.loadTables(wac.getDbPath(self.app_name), printStats=False) self.logger.logLoadDB(wac.getDbPath(self.app_name), self.all_versions, self.path_nodes, self.version_nodes)
def _load_db(self): #version_nodes is temporarily unused self.path_nodes, self.version_nodes, self.all_versions = \ wadt.loadTables(wac.getDbPath(self.app_name, self.plugin_name), printStats=False)