Initial commit

This commit is contained in:
mmichlol
2026-02-04 21:43:58 +01:00
commit f4ebea4dec
8 changed files with 520 additions and 0 deletions

191
templates/index.html Normal file
View File

@@ -0,0 +1,191 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Skaner Sieci</title>
<style>
body {
font-family: Arial, sans-serif;
color: white;
margin: 0;
padding: 20px;
background-color: #3a3a3a;
}
.container {
max-width: 600px;
height: auto;
margin: auto;
background: #111111;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
button.mainbutton,
button.secondaryabutton {
padding: 12px 24px; /* Increase padding for a more substantial look */
border: none;
font-weight: bold;
border-radius: 5px;
cursor: pointer;
margin-top: 10px;
display: block;
height: 50px;
width: 25%; /* Full width for both buttons */
transition: background 0.3s, transform 0.2s; /* Smooth transitions */
}
button.mainbutton {
background: #e4e4e4; /* Green background for main action */
color: black;
}
button.secondaryabutton {
background: #303030; /* Red background for secondary actions */
border: 1px solid #e4e4e4; /* Match border to background */
height: 50px;
}
button:hover {
background: #9e9e9e;
}
button:active {
transform: scale(0.95); /* Slightly shrink button on press */
}
.console {
margin-top: 20px;
padding: 10px;
background: #e0e0e015;
border-radius: 5px;
max-height: 200px;
overflow-y: auto;
font-family: monospace;
}
select {
width: 100%;
padding: 10px;
margin-top: 20px;
display: none; /* Ukryj na początku */
border-radius: 5px 10px 5px 10px;
}
.action-buttons {
margin-top: 20px; /* Odstęp dla akcji */
display: flex;
justify-content: space-between;
display: none; /* Ukryj przyciski akcji na początku */
height: auto;
resize: none;
}
textarea {
padding: 12px 16px; /* Match button padding */
background-color: #e4e4e4;
border: none;
color: black;
font-weight: bold;
border-radius: 5px 10px 5px 10px;
margin-right: 10px;
margin-left: 10px;
margin-top: 10px;
display: block;
resize: none;
width: 400px; /* Full width */
font-size: 16px; /* Increase font size for better readability */
}
.SSHButtonClass {
display: flex;
height: 60px;
justify-content: space-between;
}
</style>
</head>
<body>
<div class="container">
<h1>Skaner Sieci</h1>
<button class="mainbutton" id="scanButton">Skanuj Sieć</button>
<div class="console" id="console"></div>
<h1>Akcje</h1>
<select id="ipSelect"></select>
<div class="action-buttons" id="actionButtons">
<button class="secondaryabutton" id="RDPButton">Połącz (RDP)</button>
<div class="SSHButtonClass" id="SSHButtons">
<button class="secondaryabutton" id="SSHButton">Połącz (SSH)</button>
<textarea placeholder="Użytkownik SSH" id="SSHLogin"></textarea>
</div>
<button class="secondaryabutton" id="OpenButton">Otwórz</button>
</div>
</div>
<script>
document.getElementById('scanButton').onclick = function() {
fetch('/scan')
.then(response => response.json())
.then(data => {
const consoleDiv = document.getElementById('console');
consoleDiv.innerHTML = "Znalezione urządzenia:<br>";
// Wyczyść rozwijane menu z IP
const select = document.getElementById('ipSelect');
select.innerHTML = ''; // Wyczyść poprzednie opcje
// Dodaj znalezione urządzenia do konsoli i rozwijanego menu
data.forEach(device => {
consoleDiv.innerHTML += `IP: ${device.ip}, Port: ${device.port}<br>`;
const option = document.createElement('option');
option.value = device.ip;
option.textContent = device.ip;
select.appendChild(option);
});
select.style.display = 'block'; // Pokaż rozwijane menu
document.getElementById('actionButtons').style.display = 'block'; // Pokaż przyciski akcji
})
.catch(error => {
console.error('Błąd:', error);
});
};
document.getElementById('RDPButton').onclick = function() {
const selectedIp = document.getElementById('ipSelect').value;
if (selectedIp) {
const consoleDiv = document.getElementById('console');
consoleDiv.innerHTML += `Próba łączenia sie z urządzeniem ${selectedIp} poprzez RDP...<br>`;
}
};
document.getElementById('SSHButton').onclick = function() {
const selectedIp = document.getElementById('ipSelect').value;
const SSHLogin = document.getElementById('SSHLogin').value;
if (selectedIp) {
const Ip = SSHLogin + '@' + selectedIp;
const consoleDiv = document.getElementById('console');
consoleDiv.innerHTML += `Próba połączenia sie z ${selectedIp} poprzez SSH...<br>`;
}
};
document.getElementById('OpenButton').onclick = function() {
const selectedIp = document.getElementById('ipSelect').value;
if (selectedIp) {
window.open('http://' + selectedIp, '_blank');
const consoleDiv = document.getElementById('console');
consoleDiv.innerHTML += `Próba otwarcia urządzenia ${selectedIp} w przeglądarce...<br>`;
}
};
</script>
</body>
</html>