forked from firesunCN/BlueLotus_XSSReceiver
/
api.php
80 lines (71 loc) · 1.67 KB
/
api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
define("IN_XSS_PLATFORM",true);
require('auth.php');
require_once("functions.php");
require_once("config.php");
require_once("dio.php");
header('Content-Type: application/json');
if(isset($_GET['cmd']))
{
switch($_GET['cmd'])
{
//所有记录包括详细信息
case 'list':
echo json_encode(dirList());
break;
//只列出时间戳(索引id)
case 'simplelist':
echo json_encode(dirSimpleList());
break;
//根据时间戳(索引id)获得单条信息
case 'get':
if(isset($_GET['id'])&&preg_match('/^[0-9]{10}$/',$_GET['id']))
echo json_encode(loadInfo($_GET['id']));
else
echo json_encode(false);
break;
//根据时间戳(索引id)删除单条信息
case 'del':
if(isset($_GET['id'])&&preg_match('/^[0-9]{10}$/',$_GET['id']))
echo json_encode(delInfo($_GET['id']));
else
echo json_encode(false);
break;
//清空记录
case 'clear':
echo json_encode(clearInfo());
break;
default:
echo json_encode(false);
}
}
else
echo json_encode(false);
function dirSimpleList() {
$files = glob(DATA_PATH . '/*.php');
foreach ($files as &$file){
$file=basename($file,".php");
}
return $files;
}
function dirList() {
$list=array();
$files = glob(DATA_PATH . '/*.php');
arsort($files);
foreach ($files as $file) {
$filename=basename($file,".php");
$info=loadInfo($filename);
$isChange=false;
//如果没有设置location,就查询qqwry.dat判断location
if(!isset($info['location']))
{
$info['location']=convertip($info['user_IP'],IPDATA_PATH);
$isChange=true;
}
if($isChange)
saveInfo(json_encode($info),$filename);
$list[]= $info;
}
return $list;
}
?>