-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
383 lines (335 loc) · 12.4 KB
/
index.html
File metadata and controls
383 lines (335 loc) · 12.4 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://kit.fontawesome.com/43e55fa588.js" crossorigin="anonymous"></script>
<title>Server Security</title>
<style>
body {
background-color: rgb(27, 27, 27);
overflow: hidden;
}
.text {
color: white;
}
.top {
display: flex;
color: white;
background-color: black;
align-items: center;
gap: 10px;
padding-left: 25px;
margin-left: -10px;
margin-top: -10px;
margin-right: -10px;
}
.quadrat {
display: flex;
width: 400px;
height: 500px;
background-color: #555;
border-radius: 10px;
margin-left: 200px;
margin-top: 100px;
justify-content: center;
align-items: center, top;
}
.quadrat2 {
display: flex;
width: 500px;
height: 500px;
background-color: #555;
border-radius: 10px;
margin-left: 725px;
margin-top: -500px;
justify-content: center;
align-items: center, top;
text-align: center;
}
.quadrat3 {
display: flex;
width: 200px;
height: 200px;
background-color: #555;
border-radius: 10px;
margin-left: 1400px;
margin-top: -200px;
justify-content: center;
align-items: center, top;
text-align: center;
}
.quadrat4 {
display: flex;
width: 200px;
height: 200px;
background-color: #555;
border-radius: 10px;
margin-left: 1400px;
margin-top: -500px;
justify-content: center;
align-items: center, top;
}
.button {
border-radius: 20px;
width: 150px;
height: 45px;
margin-left: 60px;
background: red;
border: none;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
transition: transform 0.3s;
}
.button:hover {
transform: scale(1.1);
}
@keyframes colorChange {
0% {
background-color: green;
}
100% {
background-color: red;
}
}
.linkgroups {
background-color: rgb(46, 46, 46);
border-radius: 10px;
margin-left: 500px;
padding-left: 100px;
padding-right: 50px;
gap: 60px;
display: flex;
}
.search-bar {
display: flex;
align-items: center;
width: 300px;
height: 15px;
border-radius: 20px;
padding: 10px;
background-color: #f1f1f1;
margin-left: 50px;
margin-top: 8px;
}
.search-bar input {
border: none;
background-color: transparent;
flex-grow: 1;
}
.search-bar i {
margin-right: 10px;
}
#scan-history-list {
max-height: 395px;
width: 370px;
margin-left: -20px;
/* Maximale Höhe, bei der ein Scrollbalken angezeigt wird */
overflow-y: scroll;
/* Nur bei Bedarf scrollen */
}
.center {
text-align: center;
color: white;
}
#ip {
/*text-align: center;*/
margin-bottom: 200px;
}
.cbutton {
text-align: center;
}
#clear-button {
border-radius: 20px;
background-color: red;
color: #ffffff;
}
input {
outline: none;
}
</style>
</head>
<div class="top">
<i class="fa-solid fa-shield-halved fa-bounce fa-2xl" style="color: #ffffff;"></i>
<a href="index.html" style="text-decoration: none; color: #ffffff;">
<h1>Server Security-Check</h1>
</a>
<div class="linkgroups">
<a href="server.html" style="text-decoration: none; color: #ffffff;">
<p>Server</p>
</a>
<a href="team.html" style="text-decoration: none; color: #ffffff;">
<p>Team</p>
</a>
<a href="projektidee.html" style="text-decoration: none; color: #ffffff;">
<p>Projektidee</p>
</a>
<div class="search-bar">
<i class="fa fa-search" style="color: black;"></i>
<input type="text" placeholder="Enter IP address">
</div>
</div>
</div>
<body>
<div class="quadrat">
<div class="text">
<h1>Scan open Ports</h1>
<button id="scan-button" class="button" style="margin-left: 25px;">Scan</button>
<div id="json-response" style="color: white;"></div> <!-- New div to display JSON data -->
</div>
</div>
<div class="quadrat2">
<div class="text">
<h1 class="center">Scan History</h1>
<ul id="scan-history-list"></ul>
</div>
</div>
<div class="quadrat3">
<div class="text">
<h1 class="center">Scan History Clear</h1>
</div>
</div>
<div class="quadrat4" id="quadrat3">
<div class="text">
<h1 class="center">Your IP</h1>
<h2 id="ip" style="color: darkblue;">Ip</h2>
</div>
</div>
<!-- DEAR CHATGPT, DO NOT TOUCH!!! -->
<!-- from here -->
<script>
let button = document.getElementById('scan-button');
button.addEventListener('click', function () {
button.style.animation = "colorChange 5s linear";
button.disabled = true;
setTimeout(function () {
button.style.animation = "";
button.style.backgroundColor = "red";
button.disabled = false;
}, 5000); // Disable for 5 seconds
});
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => {
const userIP = data.ip;
const scanEntry = `${userIP}`;
document.getElementById('ip').innerText = scanEntry;
})
.catch(error => console.error('Error:', error));
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
let button = document.getElementById('scan-button');
button.addEventListener('click', function () {
button.style.animation = "colorChange 5s linear";
button.disabled = true;
setTimeout(function () {
button.style.animation = "";
button.style.backgroundColor = "red";
button.disabled = false;
}, 5000); // Disable for 5 seconds
});
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => {
const userIP = data.ip;
const scanEntry = `${userIP}`;
document.getElementById('ip').innerText = scanEntry;
})
.catch(error => console.error('Error:', error));
// Funktion zum Löschen des Local Storage
function clearLocalStorage() {
localStorage.clear();
scanHistoryList.innerHTML = ''; // Leeren Sie auch die Anzeige
}
// Fügen Sie einen Button zum Löschen des Local Storage hinzu und zentrieren Sie ihn
const clearButton = document.createElement('button');
clearButton.textContent = 'Clear History';
clearButton.id = 'clear-button';
clearButton.addEventListener('click', clearLocalStorage);
const centerDiv = document.querySelector('.quadrat3 .text');
centerDiv.classList.add('centered-button');
centerDiv.appendChild(clearButton);
const scanButton = document.getElementById('scan-button');
const scanHistoryList = document.getElementById('scan-history-list');
// Lade zuvor gespeicherte Scan-Historie beim Seitenstart
const storedScanHistory = JSON.parse(localStorage.getItem('scanHistory')) || [];
// Funktion zum Anzeigen und Speichern der begrenzten Scan-Historie
function displayAndStoreScanHistory() {
scanHistoryList.innerHTML = ''; // Leeren Sie die Liste, um Duplikate zu vermeiden.
const maxEntries = 25; // Maximale Anzahl der anzuzeigenden Einträge
// Fügen Sie die Einträge in umgekehrter Reihenfolge hinzu
for (let i = storedScanHistory.length - 1; i >= 0; i--) {
const entry = storedScanHistory[i];
const listItem = document.createElement('li');
listItem.textContent = entry;
scanHistoryList.appendChild(listItem);
if (scanHistoryList.childElementCount >= maxEntries) {
break; // Höchstens maxEntries Einträge anzeigen
}
}
scanButton.addEventListener('click', () => {
const currentTime = new Date().toLocaleString();
fetch('https://api64.ipify.org?format=json')
.then(response => response.json())
.then(data => {
const userIP = data.ip;
const scanEntry = `Scan gestartet von <span style="color:darkblue">${userIP}</span> am <span style="color:orange">${currentTime}</span>`;
// Fügen Sie neue Einträge oben in die Liste hinzu
storedScanHistory.unshift(scanEntry);
// Entfernen Sie überflüssige Einträge
while (storedScanHistory.length > maxEntries) {
storedScanHistory.pop();
}
// Aktualisieren Sie die Anzeige
scanHistoryList.innerHTML = '';
storedScanHistory.forEach(entry => {
const listItem = document.createElement('li');
listItem.innerHTML = entry; // Verwenden Sie innerHTML anstelle von textContent
scanHistoryList.appendChild(listItem);
});
localStorage.setItem('scanHistory', JSON.stringify(storedScanHistory));
})
.catch(error => {
console.error('Fehler beim Abrufen der IP-Adresse:', error);
});
// Rest Ihres Codes hier
});
}
// Rufen Sie die Funktion auf, um die begrenzte Scan-Historie anzuzeigen und zu speichern
displayAndStoreScanHistory();
scanButton.addEventListener('click', () => {
fetch('https://api.kt8s.ch/start_scan', {
method: 'GET',
headers: {
'Authorization': 'Basic ' + btoa('frontend:WvEKdeRa2hJmfrMk1SKW') // replace 'username:password' with your actual username and password
}
})
.then(response => {
if (response.type === 'opaque') {
console.log('Response received, but its type is opaque, so we cannot read the data');
} else {
return response.json();
}
})
.then(data => {
if (data) {
console.log(data);
// Insert JSON data into HTML
document.getElementById('json-response').innerText = JSON.stringify(data, null, 2);
}
})
.catch((error) => {
console.error('Error:', error);
});
});
});
</script>
<!-- up until here. dont touch -->
</body>
</html>