-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboth.html
More file actions
117 lines (103 loc) · 4.34 KB
/
Copy pathboth.html
File metadata and controls
117 lines (103 loc) · 4.34 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IP Reputation Checker - Both Services</title>
<style>
body {
font-family: Arial, sans-serif;
background: #121212;
color: #00ff00;
text-align: center;
padding: 20px;
}
input, button {
padding: 10px;
margin: 10px;
font-size: 16px;
border-radius: 5px;
border: none;
outline: none;
}
button {
background: #1f1f1f;
color: #00ff00;
cursor: pointer;
}
button:hover {
background: #333;
}
.result {
margin-top: 20px;
text-align: left;
display: inline-block;
}
</style>
</head>
<body>
<h1>IP Reputation Checker - Both Services</h1>
<input type="text" id="ipInput" placeholder="Enter IP Address">
<button onclick="checkBoth()">Check Both Services</button>
<div class="result" id="result"></div>
<script>
function addLabeledValue(container, label, value) {
const p = document.createElement("p");
const strong = document.createElement("b");
strong.textContent = `${label}: `;
p.appendChild(strong);
p.appendChild(document.createTextNode(value ?? "N/A"));
container.appendChild(p);
}
const MAX_IP_LENGTH = 45;
async function checkBoth() {
const ip = document.getElementById("ipInput").value.trim();
const resultDiv = document.getElementById("result");
if (!ip) {
resultDiv.textContent = "Please enter a valid IP address.";
return;
}
if (ip.length > MAX_IP_LENGTH) {
resultDiv.textContent = "IP address is too long.";
return;
}
resultDiv.textContent = "Checking AbuseIPDB and VirusTotal...";
try {
const abuseResponse = await fetch(`/api/abuseipdb?ip=${encodeURIComponent(ip)}`);
const abuseData = await abuseResponse.json();
const virusResponse = await fetch(`/api/virustotal?ip=${encodeURIComponent(ip)}`);
const virusData = await virusResponse.json();
resultDiv.textContent = "";
const title = document.createElement("h3");
title.textContent = `Results for IP: ${ip}`;
resultDiv.appendChild(title);
const abuseHeader = document.createElement("h4");
abuseHeader.textContent = "AbuseIPDB";
resultDiv.appendChild(abuseHeader);
addLabeledValue(resultDiv, "Abuse Confidence Score", String(abuseData.data?.abuseConfidenceScore ?? "N/A"));
addLabeledValue(resultDiv, "Categories", abuseData.data?.category?.join(", ") ?? "N/A");
addLabeledValue(resultDiv, "Country", abuseData.data?.countryCode ?? "N/A");
addLabeledValue(resultDiv, "ISP", abuseData.data?.isp ?? "N/A");
addLabeledValue(resultDiv, "Domain", abuseData.data?.domain ?? "N/A");
const virusHeader = document.createElement("h4");
virusHeader.textContent = "VirusTotal";
resultDiv.appendChild(virusHeader);
addLabeledValue(resultDiv, "Reputation", String(virusData.data?.attributes?.reputation ?? "N/A"));
addLabeledValue(resultDiv, "Network", virusData.data?.attributes?.network ?? "N/A");
addLabeledValue(
resultDiv,
"Last Analysis Stats",
virusData.data?.attributes?.last_analysis_stats
? JSON.stringify(virusData.data.attributes.last_analysis_stats)
: "N/A"
);
addLabeledValue(resultDiv, "Tags", virusData.data?.attributes?.tags?.join(", ") ?? "N/A");
addLabeledValue(resultDiv, "Whois", virusData.data?.attributes?.whois ?? "N/A");
} catch (error) {
console.error(error);
resultDiv.textContent = "Error fetching data from both services.";
}
}
</script>
</body>
</html>