This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| narzedzia:dnat_auth [2025/05/07 12:13] – created administrator | narzedzia:dnat_auth [2025/05/16 16:47] (current) – administrator | ||
|---|---|---|---|
| Line 1: | Line 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 | ||
| Line 71: | Line 156: | ||
| app.run(debug=False) | app.run(debug=False) | ||
| - | <code/> | + | </code> |