-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
76 lines (68 loc) · 3.06 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' 'self' https://api.github.com/meta">
<link rel="stylesheet" href="resources/css/meta-ip-search.css">
<script type="text/javascript" src="resources/js/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="resources/js/meta-ip-search.js"></script>
<title>GitHub Meta IP Search</title>
</head>
<body>
<div class="search-container">
<h1>GitHub Meta IP Search</h1>
<input type="text" id="search-input" placeholder="Enter IP to search for">
<button id="search-button" onclick="getResults()">Search</button>
</div>
<div class="status-container" id="status-container">
<!-- Status messages will be displayed here -->
</div>
<div class="results-container" id="results-container">
<table class="results-table" id="results-table">
<thead>
<tr>
<th>CIDR</th>
<th>Service</th>
</tr>
</thead>
<tbody>
<!-- Search results will be displayed here -->
</tbody>
</table>
</div>
<div class="about-container" id="about-container">
<p>This utility operates entirely in the browser, and no data of any kind is submitted to any service or stored anywhere.<br/>
It loads the IP ranges from the latest version of <a href="https://api.github.com/meta" target="_blank">GitHub API's meta endpoint</a> as referenced in documentation <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses" target="_blank">about GitHub's IP addresses</a>, and then calculates whether or not the searched IP falls in any of those ranges.</p>
</div>
<script>
function getResults() {
const searchTerm = document.getElementById('search-input').value;
const statusContainer = document.getElementById('status-container');
const resultsTableBody = document.getElementById('results-table').getElementsByTagName('tbody')[0];
resultsTableBody.innerHTML = '';
$("#status-container").text('Searching...');
results = searchIP(searchTerm);
$("#status-container").text(`Found ${results.length} results`);
results.forEach(result => {
const row = document.createElement('tr');
const cidrCell = document.createElement('td');
const serviceCell = document.createElement('td');
cidrCell.innerText = result.cidr;
serviceCell.innerText = result.service;
row.appendChild(cidrCell);
row.appendChild(serviceCell);
resultsTableBody.appendChild(row);
})
};
$("#search-input").keypress(function(e) {
if(e.which == 13) {
getResults();
}
});
$("#search-button").click(function(){
getResults();
});
</script>
</body>
</html>