Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +49 -14
templates/index.html
CHANGED
|
@@ -13,31 +13,66 @@
|
|
| 13 |
<h1>๐ก๏ธ Microsoft Security Attack Classifier</h1>
|
| 14 |
<p>Select values and see if the model detects an attack based on the security update.</p>
|
| 15 |
|
| 16 |
-
<form method="POST">
|
| 17 |
-
{% for feature in features %}
|
| 18 |
-
<label for="{{ feature }}">{{ feature }}</label><br>
|
| 19 |
-
<select name="{{ feature }}" required>
|
| 20 |
-
{% for option in options_dict[feature] %}
|
| 21 |
-
<option value="{{ option }}">{{ option }}</option>
|
| 22 |
{% endfor %}
|
| 23 |
-
</select><br><br>
|
| 24 |
{% endfor %}
|
| 25 |
|
| 26 |
-
<button type="submit">๐ Predict </button>
|
| 27 |
</form>
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
<
|
| 33 |
</div>
|
| 34 |
{% endif %}
|
| 35 |
|
| 36 |
-
|
| 37 |
<footer>
|
| 38 |
โก Built by <a href="https://github.com/ss331144" target="_blank">Sahar Yaccov</a> and <a href="https://github.com/BarCohen-dot" target="_blank">Bar Cohen</a>
|
| 39 |
</footer>
|
| 40 |
-
|
| 41 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
</body>
|
| 43 |
</html>
|
|
|
|
| 13 |
<h1>๐ก๏ธ Microsoft Security Attack Classifier</h1>
|
| 14 |
<p>Select values and see if the model detects an attack based on the security update.</p>
|
| 15 |
|
| 16 |
+
<form id="predictForm" method="POST">
|
| 17 |
+
{% for feature in features %}
|
| 18 |
+
<label for="{{ feature }}">{{ feature }}</label><br>
|
| 19 |
+
<select name="{{ feature }}" required>
|
| 20 |
+
{% for option in options_dict[feature] %}
|
| 21 |
+
<option value="{{ option }}">{{ option }}</option>
|
| 22 |
{% endfor %}
|
| 23 |
+
</select><br><br>
|
| 24 |
{% endfor %}
|
| 25 |
|
| 26 |
+
<button type="submit">๐ Predict </button>
|
| 27 |
</form>
|
| 28 |
|
| 29 |
+
{% if prediction %}
|
| 30 |
+
<div class="result">
|
| 31 |
+
<h2>{{ prediction }}</h2>
|
| 32 |
+
<button id="downloadBtn">โฌ๏ธ Download Prediction</button>
|
| 33 |
</div>
|
| 34 |
{% endif %}
|
| 35 |
|
|
|
|
| 36 |
<footer>
|
| 37 |
โก Built by <a href="https://github.com/ss331144" target="_blank">Sahar Yaccov</a> and <a href="https://github.com/BarCohen-dot" target="_blank">Bar Cohen</a>
|
| 38 |
</footer>
|
|
|
|
| 39 |
</div>
|
| 40 |
+
|
| 41 |
+
<script>
|
| 42 |
+
{% if prediction %}
|
| 43 |
+
document.getElementById('downloadBtn').addEventListener('click', function() {
|
| 44 |
+
// ืืกืืฃ ืืช ืืขืจืืื ืืืืืคืก
|
| 45 |
+
const form = document.getElementById('predictForm');
|
| 46 |
+
const formData = new FormData(form);
|
| 47 |
+
let content = '';
|
| 48 |
+
|
| 49 |
+
// ืืืกืฃ ืชืืจืื ืืฉืขื
|
| 50 |
+
const now = new Date();
|
| 51 |
+
content += `Date: ${now.toISOString().slice(0,10)}\n`;
|
| 52 |
+
content += `Time: ${now.toTimeString().slice(0,8)}\n\n`;
|
| 53 |
+
|
| 54 |
+
// ืืืกืฃ ืื ืฉืื ืืืืืคืก
|
| 55 |
+
for (let [key, value] of formData.entries()) {
|
| 56 |
+
content += `${key}: ${value}\n`;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
// ืืืกืฃ ืืช ืืืืืื
|
| 60 |
+
content += `\nPrediction: {{ prediction | e }}\n`;
|
| 61 |
+
|
| 62 |
+
// ืฆืืจ ืืืื ืืงืกื
|
| 63 |
+
const blob = new Blob([content], { type: 'text/plain' });
|
| 64 |
+
const url = URL.createObjectURL(blob);
|
| 65 |
+
|
| 66 |
+
// ืฆืืจ ืงืืฉืืจ ืืืืจืื ื"ืงืืืง" ืขืืื
|
| 67 |
+
const a = document.createElement('a');
|
| 68 |
+
a.href = url;
|
| 69 |
+
a.download = 'prediction.txt';
|
| 70 |
+
a.click();
|
| 71 |
+
|
| 72 |
+
// ืฉืืจืจ ืืช ืืืืืืืงื
|
| 73 |
+
URL.revokeObjectURL(url);
|
| 74 |
+
});
|
| 75 |
+
{% endif %}
|
| 76 |
+
</script>
|
| 77 |
</body>
|
| 78 |
</html>
|