HTML File for AbuseIDBP quick lookup
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AbuseIPDB Quick Lookup</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.container {
background: white;
border-radius: 16px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
padding: 40px;
max-width: 600px;
width: 100%;
}
h1 {
color: #2d3748;
margin-bottom: 10px;
font-size: 28px;
}
.subtitle {
color: #718096;
margin-bottom: 30px;
font-size: 14px;
}
.input-group {
margin-bottom: 20px;
}
label {
display: block;
color: #4a5568;
font-weight: 600;
margin-bottom: 8px;
font-size: 14px;
}
input {
width: 100%;
padding: 12px 16px;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 15px;
transition: all 0.3s;
}
input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
button {
width: 100%;
padding: 14px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
button:active {
transform: translateY(0);
}
button:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.results {
margin-top: 30px;
padding: 20px;
background: #f7fafc;
border-radius: 8px;
border-left: 4px solid #667eea;
}
.result-item {
margin-bottom: 12px;
display: flex;
justify-content: space-between;
align-items: center;
}
.result-label {
color: #4a5568;
font-weight: 600;
font-size: 14px;
}
.result-value {
color: #2d3748;
font-size: 14px;
text-align: right;
}
.abuse-score {
font-size: 32px;
font-weight: 700;
text-align: center;
margin: 20px 0;
}
.score-low { color: #48bb78; }
.score-medium { color: #ed8936; }
.score-high { color: #f56565; }
.error {
background: #fed7d7;
border-left-color: #f56565;
color: #c53030;
}
.hidden {
display: none;
}
.api-note {
font-size: 12px;
color: #718096;
margin-top: 8px;
font-style: italic;
}
</style>
</head>
<body>
<div class="container">
<h1>🔍 AbuseIPDB Lookup</h1>
<p class="subtitle">Quick IP reputation checker</p>
<div class="input-group">
<label for="apiKey">API Key</label>
<input type="password" id="apiKey" placeholder="Enter your AbuseIPDB API key">
<p class="api-note">Your API key is stored locally in your browser</p>
</div>
<div class="input-group">
<label for="ipAddress">IP Address</label>
<input type="text" id="ipAddress" placeholder="8.8.8.8">
</div>
<button id="lookupBtn" onclick="lookupIP()">Look Up IP</button>
<div id="results" class="results hidden"></div>
</div>
<script>
const apiKeyInput = document.getElementById('apiKey');
const ipInput = document.getElementById('ipAddress');
const lookupBtn = document.getElementById('lookupBtn');
const resultsDiv = document.getElementById('results');
const savedKey = localStorage.getItem('abuseipdb_api_key');
if (savedKey) {
apiKeyInput.value = savedKey;
}
apiKeyInput.addEventListener('input', (e) => {
localStorage.setItem('abuseipdb_api_key', e.target.value);
});
ipInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
lookupIP();
}
});
async function lookupIP() {
const apiKey = apiKeyInput.value.trim();
const ip = ipInput.value.trim();
if (!apiKey) {
showError('Please enter your API key');
return;
}
if (!ip) {
showError('Please enter an IP address');
return;
}
// Basic IP validation
const ipPattern = /^(\d{1,3}\.){3}\d{1,3}$/;
if (!ipPattern.test(ip)) {
showError('Please enter a valid IP address');
return;
}
lookupBtn.disabled = true;
lookupBtn.textContent = 'Looking up...';
resultsDiv.classList.add('hidden');
try {
// Using a CORS proxy to bypass browser restrictions
const proxyUrl = 'https://corsproxy.io/?';
const apiUrl = `https://api.abuseipdb.com/api/v2/check?ipAddress=${encodeURIComponent(ip)}&maxAgeInDays=90&verbose`;
const response = await fetch(proxyUrl + encodeURIComponent(apiUrl), {
method: 'GET',
headers: {
'Key': apiKey,
'Accept': 'application/json'
}
});
if (!response.ok) {
if (response.status === 401) {
throw new Error('Invalid API key. Please check your key.');
} else if (response.status === 429) {
throw new Error('Rate limit exceeded. Please try again later.');
} else {
throw new Error(`API Error: ${response.status}`);
}
}
const data = await response.json();
if (data.data) {
displayResults(data.data);
} else {
throw new Error('Unexpected response format');
}
} catch (error) {
if (error.message.includes('fetch')) {
showError('Network error. Please check your connection.');
} else {
showError(error.message);
}
} finally {
lookupBtn.disabled = false;
lookupBtn.textContent = 'Look Up IP';
}
}
function displayResults(data) {
const score = data.abuseConfidenceScore;
let scoreClass = 'score-low';
if (score >= 75) scoreClass = 'score-high';
else if (score >= 25) scoreClass = 'score-medium';
resultsDiv.innerHTML = `
<div class="abuse-score ${scoreClass}">${score}%</div>
<div style="text-align: center; color: #718096; margin-bottom: 20px; font-weight: 600;">Abuse Confidence Score</div>
<div class="result-item">
<span class="result-label">IP Address:</span>
<span class="result-value">${data.ipAddress}</span>
</div>
<div class="result-item">
<span class="result-label">Country:</span>
<span class="result-value">${data.countryCode || 'Unknown'}</span>
</div>
<div class="result-item">
<span class="result-label">ISP:</span>
<span class="result-value">${data.isp || 'Unknown'}</span>
</div>
<div class="result-item">
<span class="result-label">Usage Type:</span>
<span class="result-value">${data.usageType || 'Unknown'}</span>
</div>
<div class="result-item">
<span class="result-label">Domain:</span>
<span class="result-value">${data.domain || 'None'}</span>
</div>
<div class="result-item">
<span class="result-label">Total Reports:</span>
<span class="result-value">${data.totalReports}</span>
</div>
<div class="result-item">
<span class="result-label">Last Reported:</span>
<span class="result-value">${data.lastReportedAt || 'Never'}</span>
</div>
<div class="result-item">
<span class="result-label">Whitelisted:</span>
<span class="result-value">${data.isWhitelisted ? '✅ Yes' : '❌ No'}</span>
</div>
`;
resultsDiv.classList.remove('hidden', 'error');
}
function showError(message) {
resultsDiv.innerHTML = `<strong>⚠️ ${message}</strong>`;
resultsDiv.classList.remove('hidden');
resultsDiv.classList.add('error');
}
</script>
</body>
</html>