forked from Aur0ra-m/APIKiller
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
255 lines (225 loc) · 9.6 KB
/
index.html
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>APIKiller</title>
<style>
.ap-ob-break {
overflow-wrap: break-word;
}
#app {
position: relative;
width: 100vw;
padding-top: 50px;
}
#app > :first-child {
position: fixed;
border-radius: 0;
left: 0;
top:0;
right: 0;
background-color: #a0cfff;
z-index: 999999;
}
td {
overflow-wrap: break-word;
}
th {
color: #909399 !important;
}
th, td {
border: 1px solid #ebeef5 !important;
}
</style>
</head>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js" ></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- checkState开关样式 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css" rel="stylesheet">
<body>
<div id="app">
<div class="panel panel-primary">
<div class="panel-heading" style="border-radius: 0;">
<h1 class="panel-title">APIKiller Panel</h1>
</div>
</div>
<table class="table table-bordered table-hover table-striped" id="data-table" >
<thead>
<tr>
<th v-for="config in fromlistConfigs">
{{ config.name }}
</th>
</tr>
</thead>
<tbody>
<tr v-for="(paramItem, index) in items" :key="paramItem.Id">
<td v-for="config in fromlistConfigs" :key="config.name">
<template v-if="config.type === 'text'">
{{ paramItem[config.name] }}
</template>
<template v-if="config.type === 'checkbox'">
<input class="form-check-input" type="checkbox" v-model="paramItem[config.name]" @click="()=>false">
</template>
<template v-if="config.type === 'switch'">
<input class="checkbox" type="checkbox" v-model="paramItem[config.name]" >
</template>
<template v-if="config.type === 'collapse'">
<div class="panel-group" id="accordion" >
<div class="panel panel-info" style="width: 200px;">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion"
:href="`#paramItem${ config.name }${ paramItem.Id }${ index }`">
{{ config.name }}
</a>
</h4>
</div>
<div :id="`paramItem${ config.name }${ paramItem.Id }${ index }`" class="panel-collapse collapse" >
<div class="panel-body ap-ob-break">
{{ paramItem[config.name] }}
</div>
</div>
</div>
</div>
</template>
</td>
</tr>
</tbody>
</table>
</div>
<script>
var host = "http://127.0.0.1" //主站域名
var vm = new Vue({
el:'#app',
data:{
items: [
{}
],
fromlistConfigs: [
{
type: 'text',
name: 'Id'
},
{
type: 'text',
name: 'Domain'
},
{
type: 'text',
name: 'Url'
},
{
type: 'text',
name: 'Method'
},
{
type: 'checkbox',
name: 'Https'
},
{
type: 'collapse',
name: 'SourceRequest'
},
{
type: 'collapse',
name: 'SourceResponse'
},
{
type: 'text',
name: 'VulnType'
},
{
type: 'collapse',
name: 'VulnRequest'
},
{
type: 'collapse',
name: 'VulnResponse'
},
{
type: 'switch',
name: 'CheckState'
}
]
},
created() { //当vm实例的data和methods 初始化完毕后,vm实例会自动执行这个方法
this.getAllList();
},
methods:{
getFormattedTime(timestamp){
return new Date(parseInt(timestamp) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
},
getAllList() { //获取列表的全部信息
console.log("GetAllList function")
var Url = host+"/list" //本地返回数据, 动态
fetch(Url,{
method: 'get'
})
.then(res => {
return res.json()
})
.then(data => {
this.items = data;
}).catch(() => {
this.items = new Array(1).fill(0).map(() => ({
Id: '12312421e',
Domain: '123124sdasd1we',
Url: '12312421432we',
Method: 'GET',
Https: true,
SourceRequest: '123',
SourceResponse: 'd1we123124214321asdasd1we123124214321asdasd1we123124214321asdasd1we123124214321asdasd1we',
VulnType: 'we12',
VulnRequest: '123124214asd1we123124214321asdasd1we123124214321asdasd1we123124214321asdasd1we123124214321asdasd1we',
VulnResponse: '123124214321asaaaaafjaso321asdasd1we123124214321asdasd1we123124214321asdasd1we',
ReportTime: Date.now(),
CheckState: false
}))
})
}
}
})
</script>
<!-- JS -->
<script type="text/javascript">
// 优化开关
$(function(){
/* 初始化控件 */
$(".checkbox").bootstrapSwitch({
onText : "checked", // 设置ON文本
offText : "unchecked", // 设置OFF文本
onColor : "success",// 设置ON文本颜色 (info/success/warning/danger/primary)
offColor : "danger", // 设置OFF文本颜色 (info/success/warning/danger/primary)
size : "normal", // 设置控件大小,从小到大 (mini/small/normal/large)
// 当开关状态改变时触发
onSwitchChange : function(event, state) {
if (state == true) {
var Id = event.target.id // cbxxxxx
Id = Id.substring(2) //截取cb
updateCheckState(Id, state)
} else {
// updateCheckState(paramItem.Id, 0)
}
}
});
});
function updateCheckState(Id, state) { //默认只能将未打标更新为打标
console.log("update CheckState function")
console.log(Id, state)
let Url = host + '/checked'
fetch(Url, {
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
data: "Id="+Id
}).then((res) => {
console.log(res);
})
}
</script>
</body>
</html>