-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
366 lines (358 loc) · 16 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<!DOCTYPE html>
<html class="h-100" lang="zh-CN">
<head>
<title>ISCC选手分析器</title>
<meta charset="utf-8">
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0" rel="stylesheet">
</head>
<body class="h-100 m-0">
<div class="container-fluid h-100 p-0 d-flex flex-column">
<div class="row m-0">
<nav class="navbar navbar-expand-sm navbar-light bg-light">
<a id="logo" class="navbar-brand" href="#">ISCC选手分析器</a>
<span class="navbar-text">
数据自动采集于:<span id="time"></span>
</span>
<div class="collapse navbar-collapse d-flex">
<div class="col-2 form-floating">
<input class="form-control" id="name" placeholder="用户名">
<label for="name">用户名</label>
</div>
<div class="col-2 form-floating">
<input class="form-control" id="minSimilarity" placeholder="最小相似度" type="number" min="0" max="100" value="15">
<label for="minSimilarity">最小相似度</label>
</div>
<div class="col-2 form-floating">
<input class="form-control" id="minScore" placeholder="最小成绩" type="number" min="0" value="2000">
<label for="minScore">最小成绩</label>
</div>
<div class="col-2 form-floating">
<input class="form-control" id="startTime" placeholder="起始时间" type="number" min="1651363200" max="1653494400" value="1619827200">
<label for="startTime">起始时间</label>
</div>
<div class="col-2">
<button class="col-2 form-control btn btn-outline-primary ms-1" id="analysis" type="button">寻找相似度</button>
</div>
<div class="col-2">
<button class="col-2 form-control btn btn-outline-primary ms-1" id="search" type="button">画出关系网</button>
</div>
</div>
</nav>
</div>
<div class="row m-0 flex-grow-1 d-flex flex-column">
<div class="p-0 flex-grow-1" id="cvs"></div>
</div>
</div>
<div class="modal fade" id="analysisResult" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">相似度匹配结果</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table table-hover text-center">
<thead>
<tr>
<th scope="col">id</th>
<th scope="col">用户名</th>
<th scope="col">分数</th>
<th scope="col">相似度</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="about" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">关于</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="container">
<div class="row">
<div class="card">
<div class="card-body">
<h5 class="card-title">ISCC选手分析器</h5>
<h6 class="card-subtitle mb-2 text-muted"><a target="_blank" href="https://www.github.com/WANkkoRee/ISCCAnalysis">WANkkoRee/ISCCAnalysis</a></h6>
<p class="card-text">一个通过python脚本采集选手提交flag情况并根据特定算法生成相似度以供web分析的项目。</p>
</div>
</div>
</div>
<div class="row">
<ol>
<li>本项目未对任何服务器进行渗透、入侵。</li>
<li>本项目算法核心为正态分布的概率密度函数。</li>
<li>本项目计算分数并不包括理论题。</li>
<li>本项目所有结果仅供参考。</li>
<li>如有侵权请<a href="mailto:[email protected]">wkr#wkr.moe</a>。</li>
</ol>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script crossorigin="anonymous" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script crossorigin="anonymous" integrity="sha384-lpyLfhYuitXl2zRZ5Bn2fqnhNAKOAaM/0Kr9laMspuaMiZfGmfwRNFh8HlMy49eQ"
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js" type="text/javascript"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/map/js/china.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=<Your Key Here>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
function normalpdf(x, μ = 0, υ = 1) {
if (υ === 0) {
return x === μ ? Infinity : 0;
}
return Math.exp(-.5 * Math.pow(x - μ, 2) / υ) / Math.sqrt(Math.PI * 2 * υ);
}
</script>
<script type="text/javascript">
var dom = document.getElementById("cvs");
var myChart = echarts.init(dom, null, {renderer: 'svg'});
var option;
var user;
var user;
var challenge;
var arena;
var finish = 0;
myChart.showLoading();
$.getJSON('./user.json', function (dddd) {
user = dddd;
finish++;
if(finish===4) myChart.hideLoading();
});
$.getJSON('./challenge.json', function (dddd) {
challenge = dddd;
finish++;
if(finish===4) myChart.hideLoading();
});
$.getJSON('./arena.json', function (dddd) {
arena = dddd;
finish++;
if(finish===4) myChart.hideLoading();
});
$.getJSON('./status.json', function (dddd) {
$('#time').text(new Date(dddd.updateTime*1000));
finish++;
if(finish===4) myChart.hideLoading();
});
function analysis(targetid) {
if (Object.keys(user[targetid]['friends']).length === 0) {
var tmpRelationship = {};
Object.keys(challenge).forEach(function (challenge_category) {
Object.keys(challenge[challenge_category]).every(function (challenge_id) {
var user_solve_date = 0;
challenge[challenge_category][challenge_id].solves.some(function (challenge_solve, index, arry) {
if (challenge_solve.id == targetid) {
if (parseInt($("#startTime").val()) <= (new Date(challenge_solve.date)).getTime() / 1000) {
user_solve_date = (new Date(challenge_solve.date)).getTime() / 1000;
return true; // some{break}
}
}
});
if (user_solve_date === 0) {
return true; // every{continue}
}
challenge[challenge_category][challenge_id].solves.forEach(function (challenge_solve) {
var challenge_solve_date = (new Date(challenge_solve.date)).getTime() / 1000;
var user_p = normalpdf(challenge_solve_date - user_solve_date, 0, 10000) * 10000;
if (!tmpRelationship[challenge_solve['id'].toString()]) {
tmpRelationship[challenge_solve['id'].toString()] = 0;
}
tmpRelationship[challenge_solve['id'].toString()] += user_p;
});
});
});
Object.keys(arena).forEach(function (arena_category) {
Object.keys(arena[arena_category]).every(function (arena_id) {
var user_solve_date = 0;
arena[arena_category][arena_id].solves.some(function (arena_solve, index, arry) {
if (arena_solve.id == targetid) {
if (parseInt($("#startTime").val()) <= (new Date(arena_solve.date)).getTime() / 1000) {
user_solve_date = (new Date(arena_solve.date)).getTime() / 1000;
return true; // some{break}
}
}
});
if (user_solve_date === 0) {
return true; // every{continue}
}
arena[arena_category][arena_id].solves.forEach(function (arena_solve) {
var arena_solve_date = (new Date(arena_solve.date)).getTime() / 1000;
var user_p = normalpdf(arena_solve_date - user_solve_date, 0, 10000) * 10000;
if (!tmpRelationship[arena_solve['id'].toString()]) {
tmpRelationship[arena_solve['id'].toString()] = 0;
}
tmpRelationship[arena_solve['id'].toString()] += user_p;
});
});
});
if (Object.keys(tmpRelationship).length === 0) {
return false;
}
tmpRelationship = Object.entries(tmpRelationship).sort(([, a], [, b]) => b - a);
var tmpSelfDegree = 100 / tmpRelationship.shift()[1];
tmpRelationship.some(function (friend, index, arry) {
if (friend[1] * tmpSelfDegree > 1) {
user[targetid]['friends'][friend[0]] = friend[1] * tmpSelfDegree;
} else {
return true; // some{break}
}
if (user[targetid]['friends'].length === 100) {
return true; // some{break}
}
});
}
return true;
}
$("#logo").click(function(){
$('#about').modal('show');
});
$("#analysis").click(function(){
$("#startTime").attr("disabled",true);
var target = $("#name").val();
Object.keys(user).some(function (id, index, arry) {
if (user[id].name === target) {
analysis(id);
$("#analysisResult tbody").html('');
$("#analysisResult tbody").append(
'<tr>' +
`<th>${id}</th>` +
`<td><a href="https://iscc.isclab.org.cn/team/${id}">${user[id].name}</a></td>` +
`<td>${user[id].score}</td>` +
`<td>${Math.round(100 * 100) / 100} %</td>` +
'</tr>'
);
Object.entries(user[id].friends).sort(([, a], [, b]) => b - a).forEach(function (friend) {
$("#analysisResult tbody").append(
'<tr>' +
`<th>${friend[0]}</th>` +
`<td><a target="_blank" href="https://iscc.isclab.org.cn/team/${friend[0]}">${user[friend[0]].name}</a></td>` +
`<td>${user[friend[0]].score}</td>` +
`<td>${Math.round(friend[1] * 100) / 100} %</td>` +
'</tr>'
);
});
$('#analysisResult').modal('show');
return true; // some{break}
}
});
});
$("#search").click(function () {
$("#startTime").attr("disabled",true);
myChart.showLoading();
var target = $("#name").val();
var graph = {
nodes: [],
links: [],
categories: [
{"name": "大学生赛区"},
{"name": "河南赛区"},
{"name": "广西赛区"},
{"name": "中小学生赛区"},
{"name": "研究生赛区"}
]
};
var relations = [];
function search(id) {
if (relations.includes(id)) {
return;
}
relations.push(id);
console.log(user[id].name);
graph.nodes.push({
"id": id,
"name": user[id].name,
"symbolSize": user[id].score / 500,
"value": user[id].score,
"category": (user[id].name.toUpperCase().startsWith("HN-")) ? 1 : (user[id].name.toUpperCase().startsWith("GX-")) ? 2 : (user[id].name.toUpperCase().startsWith("NYCC-")) ? 3 : (user[id].name.toUpperCase().startsWith("GRD-")) ? 4 : 0
});
analysis(id);
Object.keys(user[id].friends).forEach(function (friend) {
if (user[id].friends[friend] > Number($("#minSimilarity").val()) && user[friend].score >= Number($("#minScore").val()) && analysis(friend) && !!user[friend].friends[id]) {
graph.links.push({
"source": id,
"target": friend
});
search(friend);
}
});
}
Object.keys(user).some(function (id, index, arry) {
if (user[id].name === target) {
search(id);
return true; // some{break}
}
});
option = {
tooltip: {},
legend: [{
data: graph.categories.map(function (a) {
return a.name;
})
}],
series: [
{
name: 'ISCCAnalsis',
type: 'graph',
layout: 'force',
data: graph.nodes,
links: graph.links,
categories: graph.categories,
roam: true,
label: {
show: true,
position: 'right',
formatter: '{b}'
},
labelLayout: {
hideOverlap: true
},
scaleLimit: {
min: 0.1,
max: 20
},
lineStyle: {
color: 'source',
curveness: 0.3
}
}
]
};
myChart.hideLoading();
myChart.setOption(option);
});
</script>
</body>
</html>