Update index.html

This commit is contained in:
公明 2025-04-23 11:05:02 +08:00 committed by GitHub
parent 9b583bfe0d
commit 3c2fa662bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,9 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PrivHunterAI</title> <title>PrivHunterAI</title>
<!-- 引入 Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"> <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- 引入 Font Awesome 图标库 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style> <style>
body { body {
@ -185,14 +183,77 @@
.data-table tr:hover { .data-table tr:hover {
background-color: rgba(0,0,0,0.02); background-color: rgba(0,0,0,0.02);
} }
.vulnerable-row {
background-color: rgba(231, 76, 60, 0.1); .foldable-row {
cursor: pointer;
} }
.unknown-row {
background-color: rgba(243, 156, 18, 0.1); .foldable-row .result-summary {
display: flex;
align-items: center;
} }
.safe-row {
background-color: rgba(46, 204, 113, 0.1); .foldable-row .result-url {
text-align: left;
font-weight: bold;
word-wrap: break-word;
max-width: 600px;
margin-right: 15px;
flex-grow: 1;
}
.foldable-row .result-status {
padding: 4px 10px;
border-radius: 15px;
font-size: 0.8rem;
font-weight: bold;
}
.status-vulnerable {
background-color: #ffebee;
color: #e53935;
}
.status-safe {
background-color: #e8f5e9;
color: #388e3c;
}
.status-unknown {
background-color: #fff8e1;
color: #ffa000;
}
.foldable-row .result-confidence {
margin-left: 10px;
font-size: 0.9rem;
color: #666;
}
.details-row {
display: none;
padding-left: 20px;
}
.details-row table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
.details-row table td {
padding: 8px 0;
vertical-align: top;
}
.details-row table td:first-child {
font-weight: bold;
width: 120px;
}
.details-row.active {
display: table-row;
} }
/* 分页样式 */ /* 分页样式 */
@ -291,14 +352,7 @@
<table class="data-table"> <table class="data-table">
<thead> <thead>
<tr> <tr>
<th>Method</th> <!-- <th colspan="2">扫描结果</th> -->
<th>URL</th>
<th>Reqbody</th>
<th>RespBodyA</th>
<th>RespBodyB</th>
<th>Result</th>
<th>Reason</th>
<th>Confidence</th>
</tr> </tr>
</thead> </thead>
<tbody id="data-body"> <tbody id="data-body">
@ -331,8 +385,8 @@
async function fetchData() { async function fetchData() {
try { try {
// 从你的接口获取数据 // 从你的接口获取数据
const response = await fetch('/data'); const response = await fetch('/data');
if (!response.ok) throw new Error('Network response was not ok'); if (!response.ok) throw new Error('Network response was not ok');
originalData = await response.json(); originalData = await response.json();
currentData = [...originalData]; currentData = [...originalData];
@ -384,7 +438,7 @@
if (paginatedData.length === 0) { if (paginatedData.length === 0) {
const emptyRow = document.createElement('tr'); const emptyRow = document.createElement('tr');
emptyRow.innerHTML = ` emptyRow.innerHTML = `
<td colspan="8" class="empty-state"> <td colspan="2" class="empty-state">
<i class="fas fa-search"></i> <i class="fas fa-search"></i>
<p>没有找到符合条件的数据</p> <p>没有找到符合条件的数据</p>
</td> </td>
@ -395,28 +449,87 @@
// 渲染当前页面的数据 // 渲染当前页面的数据
paginatedData.forEach(item => { paginatedData.forEach(item => {
const row = document.createElement('tr'); // 创建折叠行
const foldableRow = document.createElement('tr');
foldableRow.className = 'foldable-row';
foldableRow.onclick = function() {
const detailsRow = this.nextElementSibling;
if (detailsRow.classList.contains('active')) {
detailsRow.classList.remove('active');
this.style.fontWeight = 'normal';
} else {
detailsRow.classList.add('active');
this.style.fontWeight = 'bold';
}
};
// 根据结果类型设置行样式 // 根据结果类型设置行样式
if (item.result === 'true') { if (item.result === 'true') {
row.className = 'vulnerable-row'; foldableRow.style.borderLeft = '4px solid #e74c3c';
} else if (item.result === 'unknown') { } else if (item.result === 'unknown') {
row.className = 'unknown-row'; foldableRow.style.borderLeft = '4px solid #f39c12';
} else if (item.result === 'false') { } else if (item.result === 'false') {
row.className = 'safe-row'; foldableRow.style.borderLeft = '4px solid #2ecc71';
} }
row.innerHTML = ` foldableRow.innerHTML = `
<td>${item.method || ''}</td> <td>
<td>${item.url || ''}</td> <div class="result-summary">
<td>${item.reqbody || ''}</td> <span class="result-url">${item.url.split('?')[0]}</span>
<td>${item.respBodyA || ''}</td> <span class="result-status status-${item.result === 'true' ? 'vulnerable' : item.result === 'unknown' ? 'unknown' : 'safe'}">
<td>${item.respBodyB || ''}</td> ${item.result === 'true' ? '漏洞' : item.result === 'unknown' ? '未知' : '安全'}
<td>${item.result === 'unknown' ? '未知' : item.result=== 'false' ? '安全' : '漏洞'}</td> </span>
<td>${item.reason || ''}</td> <span class="result-confidence">${item.confidence}</span>
<td>${item.confidence || ''}</td> </div>
</td>
<td>
<i class="fas fa-chevron-down"></i>
</td>
`; `;
tableBody.appendChild(row); tableBody.appendChild(foldableRow);
// 创建详情行
const detailsRow = document.createElement('tr');
detailsRow.className = 'details-row';
detailsRow.innerHTML = `
<td colspan="2">
<table>
<tr>
<td>Method:</td>
<td>${item.method || ''}</td>
</tr>
<tr>
<td>URL:</td>
<td>${item.url || ''}</td>
</tr>
<tr>
<td>Reqbody:</td>
<td>${item.reqbody || ''}</td>
</tr>
<tr>
<td>RespBodyA:</td>
<td>${item.respBodyA || ''}</td>
</tr>
<tr>
<td>RespBodyB:</td>
<td>${item.respBodyB || ''}</td>
</tr>
<tr>
<td>Result:</td>
<td>${item.result === 'unknown' ? '未知' : item.result === 'false' ? '安全' : '漏洞'}</td>
</tr>
<tr>
<td>Reason:</td>
<td>${item.reason || ''}</td>
</tr>
<tr>
<td>Confidence:</td>
<td>${item.confidence || ''}</td>
</tr>
</table>
</td>
`;
tableBody.appendChild(detailsRow);
}); });
} }