def check_core_alteration(self, dir_path, core_url):
alterations = []
ignored = [".git", "cache", "plugins", "themes", "images", "license.txt", "readme.html",
"version.php"]
temp_directory = uCMS.TempDir.create()
log.print_cms("info", "[+] Checking core alteration", "", 0)
try:
response = requests.get(core_url)
response.raise_for_status()
if response.status_code == 200:
zip_file = zipfile.ZipFile(io.BytesIO(response.content), 'r')
zip_file.extractall(temp_directory)
zip_file.close()
except requests.exceptions.HTTPError as e:
msg = "[-] The original WordPress archive has not been found. Search manually ! "
log.print_cms("alert", msg, "", 0)
return msg, e
clean_core_path = os.path.join(temp_directory, "wordpress")
dcmp = dircmp(clean_core_path, dir_path, ignored)
uCMS.diff_files(dcmp, alterations, dir_path)
if alterations is not None:
msg = "[+] For further analysis, archive downloaded here : " + clean_core_path
log.print_cms("info", msg, "", 1)
return alterations, None
评论列表
文章目录