-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReputationTool.js
More file actions
73 lines (57 loc) · 2.12 KB
/
ReputationTool.js
File metadata and controls
73 lines (57 loc) · 2.12 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
// @name IP Reputation Checker
// @namespace http://yourwebsite.com
// @version 0.1
// @description Check the reputation of an IP address using AbuseIPDB API.
// @author Your Name
// @match *://*/*
// @grant GM_xmlhttpRequest
(function() {
'use strict';
// AbuseIPDB API endpoint
const API_ENDPOINT = 'https://api.abuseipdb.com/api/v2/check';
// Your AbuseIPDB API key
const API_KEY = 'YOUR_API_KEY';
// check IP reputation
function checkIPReputation(ipAddress) {
const url = `${API_ENDPOINT}?ipAddress=${ipAddress}`;
GM_xmlhttpRequest({
method: 'GET',
url: url,
headers: {
'Key': API_KEY,
'Accept': 'application/json'
},
onload: function(response) {
const data = JSON.parse(response.responseText);
if (data && data.data) {
const reputation = data.data.abuseConfidenceScore;
console.log(`Reputation for ${ipAddress}: ${reputation}`);
// Perform actions based on reputation (e.g., block access)
} else {
console.error('Error fetching IP reputation data');
}
},
onerror: function(error) {
console.error('Error fetching IP reputation data:', error);
}
});
}
// Example usage: Check reputation of a specific IP address
const ipAddressToCheck = '123.456.789.123';
checkIPReputation(ipAddressToCheck);
})();
// Add toolbar button
const toolbarButton = document.createElement('button');
toolbarButton.innerHTML = 'IP Reputation';
toolbarButton.style.position = 'fixed';
toolbarButton.style.top = '20px';
toolbarButton.style.right = '20px';
toolbarButton.style.zIndex = '9999';
toolbarButton.addEventListener('click', function() {
const ipAddress = prompt('Enter IP address:');
if (ipAddress) {
checkIPReputation(ipAddress);
}
});
document.body.appendChild(toolbarButton);
})();