Created
June 28, 2012 15:33
-
-
Save eristoddle/3012036 to your computer and use it in GitHub Desktop.
Find .htaccess hacks in your website with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
#Replace with name of directory to scan, i.e, your WP directory | |
dir = "/var/www/" | |
#Replace with string to find, in my case, this domain, which my site was redirecting to | |
to_find = "vlag-nerto.ru" | |
for root, dirs, files in os.walk(dir): | |
for file in files: | |
fullpath = os.path.join(root, file) | |
#if os.path.splitext(fullpath)[1] == '.php': | |
if file == '.htaccess': | |
f = open(fullpath) | |
for line in f: | |
if line.find(to_find) > -1: | |
print "Bad: " + fullpath | |
else: | |
pass | |
#print "Good: " + fullpath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment