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 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 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_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 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 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 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 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_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 plugins/crawl/ghdb/GHDB.xml\n' \ 'git commit -m "Updating GHDB database." 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_false(self): filename = os.path.join('core', 'data', 'misc', 'file_utils.py') result = days_since_file_update(filename, 309 ** 32) self.assertFalse(result)
def test_days_since_file_update_true(self): filename = os.path.join('core', 'data', 'misc', 'file_utils.py') result = days_since_file_update(filename, 0) self.assertTrue(result)