2015-10-12 15:24:09 +08:00
|
|
|
|
<?php
|
2022-05-24 00:13:20 +08:00
|
|
|
|
define('IN_XSS_PLATFORM', true);
|
2016-01-25 12:42:19 +08:00
|
|
|
|
ignore_user_abort(true);
|
|
|
|
|
|
error_reporting(0);
|
|
|
|
|
|
|
2016-12-27 21:49:19 +08:00
|
|
|
|
//sometimes we only need "referer".
|
2016-01-28 02:19:09 +08:00
|
|
|
|
|
2015-10-13 00:07:10 +08:00
|
|
|
|
/*
|
|
|
|
|
|
if(count($_GET)==0&&count($_POST)==0&&count($_COOKIE)==0)
|
2016-01-28 02:19:09 +08:00
|
|
|
|
exit();
|
2015-10-13 00:07:10 +08:00
|
|
|
|
*/
|
2022-05-24 00:13:20 +08:00
|
|
|
|
header('Access-Control-Allow-Origin: *');
|
|
|
|
|
|
require_once('functions.php');
|
|
|
|
|
|
require_once('dio.php');
|
2015-10-13 00:07:10 +08:00
|
|
|
|
|
|
|
|
|
|
$info = array();
|
|
|
|
|
|
|
2016-12-27 21:49:19 +08:00
|
|
|
|
$user_IP = getRealIP();
|
2022-05-24 00:13:20 +08:00
|
|
|
|
$user_port = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : 'unknown';
|
|
|
|
|
|
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'unknown';
|
|
|
|
|
|
$request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'unknown';
|
|
|
|
|
|
$request_URI = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : 'unknown';
|
2016-01-28 02:19:09 +08:00
|
|
|
|
$request_time = isset($_SERVER['REQUEST_TIME']) ? $_SERVER['REQUEST_TIME'] : time();
|
2015-10-13 00:07:10 +08:00
|
|
|
|
|
2016-01-28 02:19:09 +08:00
|
|
|
|
$headers_data = getallheaders();
|
2015-10-13 00:07:10 +08:00
|
|
|
|
|
2015-10-30 22:46:04 +08:00
|
|
|
|
//如果提交的数据有base64编码的就解码
|
2016-01-28 02:19:09 +08:00
|
|
|
|
$get_data = $_GET;
|
|
|
|
|
|
$decoded_get_data = tryBase64Decode($_GET);
|
|
|
|
|
|
$post_data = $_POST;
|
|
|
|
|
|
$decoded_post_data = tryBase64Decode($_POST);
|
|
|
|
|
|
$cookie_data = $_COOKIE;
|
|
|
|
|
|
$decoded_cookie_data = tryBase64Decode($_COOKIE);
|
2015-10-13 00:07:10 +08:00
|
|
|
|
|
2015-10-30 22:46:04 +08:00
|
|
|
|
//防xss过滤,对array要同时处理key与value
|
2016-01-28 02:19:09 +08:00
|
|
|
|
$info['user_IP'] = stripStr($user_IP);
|
|
|
|
|
|
$info['user_port'] = stripStr($user_port);
|
|
|
|
|
|
$info['protocol'] = stripStr($protocol);
|
2015-10-17 11:05:09 +08:00
|
|
|
|
$info['request_method'] = stripStr($request_method);
|
2016-01-28 02:19:09 +08:00
|
|
|
|
$info['request_URI'] = stripStr($request_URI);
|
|
|
|
|
|
$info['request_time'] = stripStr($request_time);
|
|
|
|
|
|
$info['headers_data'] = stripArr($headers_data);
|
2015-10-17 11:05:09 +08:00
|
|
|
|
|
|
|
|
|
|
$info['get_data'] = stripArr($get_data);
|
2016-01-28 02:19:09 +08:00
|
|
|
|
if ($decoded_get_data)
|
|
|
|
|
|
$info['decoded_get_data'] = stripArr($decoded_get_data);
|
2015-10-17 11:05:09 +08:00
|
|
|
|
|
|
|
|
|
|
$info['post_data'] = stripArr($post_data);
|
2016-01-28 02:19:09 +08:00
|
|
|
|
if ($decoded_post_data)
|
|
|
|
|
|
$info['decoded_post_data'] = stripArr($decoded_post_data);
|
2015-10-17 11:05:09 +08:00
|
|
|
|
|
|
|
|
|
|
$info['cookie_data'] = stripArr($cookie_data);
|
2016-01-28 02:19:09 +08:00
|
|
|
|
if ($decoded_cookie_data)
|
|
|
|
|
|
$info['decoded_cookie_data'] = stripArr($decoded_cookie_data);
|
2015-10-13 00:07:10 +08:00
|
|
|
|
|
2015-10-30 22:46:04 +08:00
|
|
|
|
//判断是否keepsession(判断标准:get或者post或者cookie包含keepsession=1)
|
2016-01-28 02:19:09 +08:00
|
|
|
|
$info['keepsession'] = isKeepSession($info) ? true : false;
|
2015-10-13 00:07:10 +08:00
|
|
|
|
|
2016-01-28 02:19:09 +08:00
|
|
|
|
save_xss_record(json_encode($info), $request_time);
|
2016-01-25 12:42:19 +08:00
|
|
|
|
|
|
|
|
|
|
//发送邮件通知
|
2016-01-28 02:19:09 +08:00
|
|
|
|
if (MAIL_ENABLE) {
|
|
|
|
|
|
require_once("mail.php");
|
|
|
|
|
|
@send_mail($info);
|
|
|
|
|
|
}
|