def check_api_token_not_installed(): if 'WPSCAN_API_TOKEN' in os.environ: log.error( "WPSCAN_API_TOKEN environnement varible is set, please remove it to allow WPWatcher to handle WPScan API token" ) return False files = ['.wpscan/scan.json', '.wpscan/scan.yml'] env = ['HOME', 'XDG_CONFIG_HOME', 'APPDATA', 'PWD'] for wpscan_config_file in WPWatcherConfig.find_files(env, files): with open(wpscan_config_file, 'r') as wpscancfg: if any([ 'api_token' in line and line.strip()[0] != "#" for line in wpscancfg.readlines() ]): log.error( 'API token is set in the config file %s, please remove it to allow WPWatcher to handle WPScan API token' % (wpscan_config_file)) return False return True
def find_wp_reports_file(self, create=False, daemon=False): files=[DEFAULT_REPORTS] if not daemon else [DEFAULT_REPORTS_DAEMON] env=['HOME', 'PWD', 'XDG_CONFIG_HOME', 'APPDATA'] return(WPWatcherConfig.find_files(env, files, "[]", create=True)[0])
def find_wp_reports_file(self, create=False, daemon=False): files = [DEFAULT_REPORTS] if not daemon else [DEFAULT_REPORTS_DAEMON] env = ["HOME", "PWD", "XDG_CONFIG_HOME", "APPDATA"] return WPWatcherConfig.find_files(env, files, "[]", create=True)[0]