Różnice między wybraną wersją a wersją aktualną.
| Nowa wersja | Poprzednia wersja | ||
| narzedzia:dnat_auth [2025/05/07 12:13] – created administrator | narzedzia:dnat_auth [2025/05/16 16:47] (aktualna) – administrator | ||
|---|---|---|---|
| Linia 1: | Linia 1: | ||
| + | ==== PY: Skrypt NAT port knocking z uwierzytelnieniem ==== | ||
| + | |||
| === template login.html === | === template login.html === | ||
| - | <code html> | + | < |
| + | < | ||
| + | <html lang=" | ||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | < | ||
| + | body { | ||
| + | font-family: | ||
| + | background-color: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | display: flex; | ||
| + | justify-content: | ||
| + | align-items: | ||
| + | height: 100vh; | ||
| + | } | ||
| + | .container { | ||
| + | background-color: | ||
| + | padding: 20px; | ||
| + | border-radius: | ||
| + | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); | ||
| + | text-align: center; | ||
| + | } | ||
| + | h2 { | ||
| + | margin-bottom: | ||
| + | } | ||
| + | .logo { | ||
| + | max-width: 100px; | ||
| + | margin-bottom: | ||
| + | } | ||
| + | form { | ||
| + | display: flex; | ||
| + | flex-direction: | ||
| + | align-items: | ||
| + | } | ||
| + | label { | ||
| + | margin-bottom: | ||
| + | } | ||
| + | input[type=" | ||
| + | input[type=" | ||
| + | width: 100%; | ||
| + | padding: 10px; | ||
| + | margin-bottom: | ||
| + | border: 1px solid #ccc; | ||
| + | border-radius: | ||
| + | box-sizing: border-box; | ||
| + | } | ||
| + | input[type=" | ||
| + | width: 100%; | ||
| + | padding: 10px; | ||
| + | background-color: | ||
| + | color: #fff; | ||
| + | border: none; | ||
| + | border-radius: | ||
| + | cursor: pointer; | ||
| + | transition: background-color 0.3s ease; | ||
| + | } | ||
| + | input[type=" | ||
| + | background-color: | ||
| + | } | ||
| + | .error { | ||
| + | color: red; | ||
| + | margin-top: 10px; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <div class=" | ||
| + | < | ||
| + | {% if error %} | ||
| + | <p class=" | ||
| + | {% endif %} | ||
| + | <form action="/" | ||
| + | <label for=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | <input type=" | ||
| + | <input type=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </html> | ||
| - | <code/> | + | </code> |
| === Kod samego programu === | === Kod samego programu === | ||
| - | <code python> | + | <code python |
| from flask import Flask, request, render_template | from flask import Flask, request, render_template | ||
| import paramiko | import paramiko | ||
| Linia 71: | Linia 156: | ||
| app.run(debug=False) | app.run(debug=False) | ||
| - | <code/> | + | </code> |