def test_too_old_db(self): is_older = days_since_file_update(phishtank.PHISHTANK_DB, 30) msg = 'The phishtank database is too old, in order to update it'\ ' please follow these steps:\n'\ 'w3af/plugins/crawl/phishtank/update.py\n'\ 'git commit -m "Updating phishtank database." w3af/plugins/crawl/phishtank/index.csv\n'\ 'git push\n' self.assertFalse(is_older, msg)
def test_too_old_db(self): is_older = days_since_file_update(phishtank.PHISHTANK_DB, 30) msg = 'The phishtank database is too old, in order to update it'\ ' please follow these steps:\n'\ 'w3af/plugins/crawl/phishtank/update.py\n'\ 'git commit -m "Updating phishtank database." w3af/plugins/crawl/phishtank/index.csv\n'\ 'git push\n' self.assertFalse(is_older, msg)
def test_updated_scan_db(self): pykto_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'pykto') scan_db_file = pykto_inst._db_file is_older = days_since_file_update(scan_db_file, 30) msg = 'The scan database file is too old. The following commands need'\ ' to be run in order to update it:\n'\ 'cd w3af/plugins/crawl/pykto/\n'\ 'python update_scan_db.py\n'\ 'git commit -m "Updating scan_database.db file." scan_database.db\n'\ 'git push\n'\ 'cd -' self.assertFalse(is_older, msg)
def test_updated_scan_db(self): pykto_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'pykto') scan_db_file = pykto_inst._db_file is_older = days_since_file_update(scan_db_file, 30) msg = 'The scan database file is too old. The following commands need'\ ' to be run in order to update it:\n'\ 'cd w3af/plugins/crawl/pykto/\n'\ 'python update_scan_db.py\n'\ 'git commit -m "Updating scan_database.db file." scan_database.db\n'\ 'git push\n'\ 'cd -' self.assertFalse(is_older, msg)
def test_updated_release_db(self): wpfp_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'wordpress_fingerprint') wp_releases_file = wpfp_inst._release_db is_older = days_since_file_update(wp_releases_file, 30) msg = 'The releases.db database is too old. The following commands need' \ ' to be run in order to update it:\n' \ 'cd w3af/plugins/crawl/wordpress_fingerprint/\n' \ 'python generate_release_db.py\n' \ 'git commit -m "Updating wordpress release.db file." release.db\n' \ 'git push\n' \ 'cd -' self.assertFalse(is_older, msg)
def test_updated_wp_versions_xml(self): wp_fp_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'wordpress_fingerprint') url = 'https://raw.github.com/wpscanteam/wpscan/master/data/wp_versions.xml' wp_versions_file = wp_fp_inst.WP_VERSIONS_XML is_older = days_since_file_update(wp_versions_file, 60) msg = 'The wp_versions.xml file is too old. The following commands need'\ ' to be run in order to update it:\n'\ 'cd w3af/plugins/crawl/wordpress_fingerprint/\n'\ 'wget %s -O wp_versions.xml\n'\ 'git commit -m "Updating wp_versions.xml file." wp_versions.xml\n'\ 'git push\n'\ 'cd -' self.assertFalse(is_older, msg % url)
def test_updated_release_db(self): wpfp_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'wordpress_fingerprint') wp_releases_file = wpfp_inst._release_db is_older = days_since_file_update(wp_releases_file, 30) msg = 'The releases.db database is too old. The following commands need'\ ' to be run in order to update it:\n'\ 'cd w3af/plugins/crawl/wordpress_fingerprint/\n'\ 'python generate_release_db.py\n'\ 'git commit -m "Updating wordpress release.db file." release.db\n'\ 'git push\n'\ 'cd -' self.assertFalse(is_older, msg)
def test_updated_wp_versions_xml(self): wp_fp_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'wordpress_fingerprint') url = 'https://github.com/wpscanteam/wpscan/blob/master/data.zip?raw=true' wp_versions_file = wp_fp_inst.WP_VERSIONS_XML is_older = days_since_file_update(wp_versions_file, 60) msg = 'The wp_versions.xml file is too old. The following commands need' \ ' to be run in order to update it:\n' \ 'wget %s -O data.zip\n' \ 'unzip -p data.zip data/wp_versions.xml > w3af/plugins/crawl/wordpress_fingerprint/wp_versions.xml\n' \ 'rm -rf data.zip\n' \ 'git commit -m "Updating wp_versions.xml file." w3af/plugins/crawl/wordpress_fingerprint/wp_versions.xml\n' \ 'git push\n' \ 'cd -' self.assertFalse(is_older, msg % url)
def test_too_old_xml(self): ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') ghdb_file = ghdb_inst._ghdb_file is_older = days_since_file_update(ghdb_file, 30) msg = ('The GHDB database is too old, please update it by running the' ' following command:' '\n' '<secret wget-command>\n' 'git commit -m "Update GHDB" w3af/plugins/crawl/ghdb/GHDB.xml\n' 'git push\n' '\n' 'Also remember to run this unittest again to verify that the' ' downloaded file can be parsed by the plugin.') self.assertFalse(is_older, msg)
def test_too_old_xml(self): ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') ghdb_file = ghdb_inst._ghdb_file is_older = days_since_file_update(ghdb_file, 30) msg = ('The GHDB database is too old, please update it by running the' ' following command:' '\n' '<secret wget-command>\n' 'git commit -m "Update GHDB" w3af/plugins/crawl/ghdb/GHDB.xml\n' 'git push\n' '\n' 'Also remember to run this unittest again to verify that the' ' downloaded file can be parsed by the plugin.') self.assertFalse(is_older, msg)
def test_too_old_xml(self): ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') ghdb_file = ghdb_inst._ghdb_file is_older = days_since_file_update(ghdb_file, 30) today = datetime.datetime.today() msg = 'The GHDB database is too old, please update it by running the' \ ' following command:'\ '\n' \ 'wget <secret>%02d_%02d_%s.xml -O w3af/plugins/crawl/ghdb/GHDB.xml --user-agent=Chrome\n' \ 'git commit -m "Updating GHDB database." w3af/plugins/crawl/ghdb/GHDB.xml\n' \ 'git push\n' \ '\n'\ 'Also remember to run this unittest again to verify that the' \ ' downloaded file can be parsed by the plugin.' self.assertFalse(is_older, msg % (today.month, today.day, today.year))
def test_too_old_xml(self): ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') ghdb_file = ghdb_inst._ghdb_file is_older = days_since_file_update(ghdb_file, 30) today = datetime.datetime.today() msg = 'The GHDB database is too old, please update it by running the' \ ' following command:'\ '\n' \ 'wget <secret>%02d_%02d_%s.xml -O w3af/plugins/crawl/ghdb/GHDB.xml --user-agent=Chrome\n' \ 'git commit -m "Updating GHDB database." w3af/plugins/crawl/ghdb/GHDB.xml\n' \ 'git push\n' \ '\n'\ 'Also remember to run this unittest again to verify that the' \ ' downloaded file can be parsed by the plugin.' self.assertFalse(is_older, msg % (today.month, today.day, today.year))
def test_too_old_xml(self): # https://github.com/andresriancho/w3af/issues/10103 raise SkipTest('GHDB maintainers do NOT answer my mails and the' ' URL I was using to update the XML now requires' ' basic authentication.') ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') ghdb_file = ghdb_inst._ghdb_file is_older = days_since_file_update(ghdb_file, 30) today = datetime.datetime.today() msg = 'The GHDB database is too old, please update it by running the' \ ' following command:'\ '\n' \ 'wget <secret>%02d_%02d_%s.xml -O w3af/plugins/crawl/ghdb/GHDB.xml --user-agent=Chrome\n' \ 'git commit -m "Updating GHDB database." w3af/plugins/crawl/ghdb/GHDB.xml\n' \ 'git push\n' \ '\n'\ 'Also remember to run this unittest again to verify that the' \ ' downloaded file can be parsed by the plugin.' self.assertFalse(is_older, msg % (today.month, today.day, today.year))
def test_too_old_xml(self): # https://github.com/andresriancho/w3af/issues/10103 raise SkipTest('GHDB maintainers do NOT answer my mails and the' ' URL I was using to update the XML now requires' ' basic authentication.') ghdb_inst = self.w3afcore.plugins.get_plugin_inst('crawl', 'ghdb') ghdb_file = ghdb_inst._ghdb_file is_older = days_since_file_update(ghdb_file, 30) today = datetime.datetime.today() msg = 'The GHDB database is too old, please update it by running the' \ ' following command:'\ '\n' \ 'wget <secret>%02d_%02d_%s.xml -O w3af/plugins/crawl/ghdb/GHDB.xml --user-agent=Chrome\n' \ 'git commit -m "Updating GHDB database." w3af/plugins/crawl/ghdb/GHDB.xml\n' \ 'git push\n' \ '\n'\ 'Also remember to run this unittest again to verify that the' \ ' downloaded file can be parsed by the plugin.' self.assertFalse(is_older, msg % (today.month, today.day, today.year))
def test_days_since_file_update_directory(self): dir_name = os.path.join(ROOT_PATH, 'core', 'data', 'misc', 'tests', 'test_dir') result = days_since_file_update(dir_name, 0) self.assertTrue(result)
def test_days_since_file_update_false(self): filename = os.path.join(ROOT_PATH, 'core', 'data', 'misc', 'file_utils.py') result = days_since_file_update(filename, 309**32) self.assertFalse(result)
def test_days_since_file_update_directory(self): filename = os.path.join(ROOT_PATH, 'core', 'data') result = days_since_file_update(filename, 0) self.assertTrue(result)
def test_days_since_file_update_false(self): filename = os.path.join(ROOT_PATH, 'core', 'data', 'misc', 'file_utils.py') result = days_since_file_update(filename, 309 ** 32) self.assertFalse(result)