
Untitled
By: a guest on
Jul 14th, 2012 | syntax:
None | size: 1.87 KB | hits: 19 | expires: Never
<?php
/*
Plugin Name: RFI Attack Scanner2
Description: Checks if your url contains more than one http: in the url, then checks if "?" exists, and if so, considers it an RFI attack. For now, all this does is
write the RFI url's to data.txt. I'd like to make it into some sort of XML graph, also including the attackers IP, Time Stamp, and show it on a wordpress admin panel for
stats/graphs, etc.
Version: 0.0.0.1
Author: @xxdigipxx
Author URI: http://www.ticktockcomputers.com
License: GPLv2
*/
function checkPOST_RFI() {
if (!empty($_POST)) {
foreach($_POST as $name => $value)
{
if(preg_match('/(?<url>https?:\/\/[^<>[:space:]]+)/', $_POST[$name], $matches) > 0) {
array_push($urls, $_POST[$name]);
}
}
foreach($urls as $index => $url) {
$text = $url;
if(substr_count($text,'://') > 1) {
$rfi = strstr($text, '?');
file_put_contents(dirname(__FILE__).'/data.txt', "Original URL Schema: ".$text."\r\n RFI String Alone: ".htmlentities($rfi)."\r\n" , FILE_APPEND);
}
}
}
} else {
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$text = curPageURL();
if(substr_count($text,'://') > 1) {
$rfi = strstr($text, '?');
file_put_contents(dirname(__FILE__).'/data.txt', "Original URL Schema: ".$text."\r\n RFI String Alone: ".htmlentities($rfi)."\r\n" , FILE_APPEND);
}
//$file = file_get_contents('./data.txt', true); //Debugging Plugin
//echo $file; //Debugging Plugin
}
add_action('init', 'checkPOST_RFI');
add_action('init', 'curPageURL');
add_action('init', 'file_put_contents');
?>