104 lines
2.6 KiB
HTML
Executable File
104 lines
2.6 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="author" content="zifan">
|
|
<meta name="keywords" content="物联网">
|
|
<title>ARP列表</title>
|
|
|
|
<style>
|
|
html,
|
|
body {
|
|
height: 100%;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
padding: 50px;
|
|
}
|
|
|
|
#arpTable {
|
|
background-color: rgba(41, 117, 117, 0.667);
|
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.5);
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="tablecenter">
|
|
<table id="arpTable" width="700" align="center" border="1" cellspacing="0">
|
|
<thead>
|
|
<th>ID</th>
|
|
<th>ip地址</th>
|
|
<th>mac地址</th>
|
|
</thead>
|
|
<tbody id="arpTableBody" align="center">
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div style="display: none;">
|
|
<table id="balckTable" width="250" align="center" border="1" cellspacing="0">
|
|
<thead>
|
|
<th>ip地址</th>
|
|
</thead>
|
|
<tbody id="blackTableBody" align="center">
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<script>
|
|
|
|
var blackData;
|
|
function loadBlackData() {
|
|
fetch("/cgi-bin/fw.cgi").then(resp => resp.json()).then(data => {
|
|
blackData = data;
|
|
|
|
loadData();
|
|
})
|
|
|
|
}
|
|
|
|
function loadData() {
|
|
|
|
|
|
fetch("/cgi-bin/arp.cgi").then(resp => resp.json()).then(data => {
|
|
arpTableBody.innerText = "";
|
|
data.forEach(rowData => {
|
|
let tr = document.createElement("tr");
|
|
let td1 = document.createElement("td");
|
|
let td2 = document.createElement("td");
|
|
let td3 = document.createElement("td");
|
|
|
|
td1.innerText = rowData.id;
|
|
td2.innerText = rowData.ip;
|
|
td3.innerText = rowData.mac;
|
|
|
|
tr.append(td1, td2, td3);
|
|
|
|
|
|
for (let i = 0; i < blackData.length; i++) {
|
|
if (blackData[i].ip == rowData.ip) {
|
|
tr.style = "color:red;";
|
|
break;
|
|
}
|
|
}
|
|
arpTableBody.append(tr);
|
|
});
|
|
})
|
|
}
|
|
|
|
|
|
|
|
window.onload = function () {
|
|
loadBlackData();
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |