Created
July 22, 2010 17:30
-
-
Save presidentbeef/486293 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#Have a site that is compromised somehow. | |
#Someone is able to upload malicious .htaccess files that | |
#redirect based on User Agent being Windows and a whole list | |
#of possible referers, including Google.com. | |
# | |
#This script periodically checks the site and then emails if it gets | |
#anything other than a 200 | |
require 'net/smtp' | |
site = "example.com" | |
sender_email = "[email protected]" | |
receiver_email = "[email protected]" | |
smtp_server = "localhost" | |
wait_time = 3600 | |
loop do | |
#Net::HTTP what? | |
headers = `curl -s -I -A Windows -e google.com #{site}` | |
if headers !~ /^HTTP\/1.1 200 OK\r\n/ | |
message = <<-MAIL | |
From: <#{sender_email}> | |
To: <#{receiver_email}> | |
Subject: Website Problem | |
Headers: | |
#{headers} | |
Net::SMTP.start(smtp_server) do |smtp| | |
smtp.send_message message, sender_email, receiver_email | |
end | |
end | |
sleep wait_time | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment