add python script and make editor functionaly - Follow Up Deployment
Browse files- index.html +66 -0
index.html
CHANGED
|
@@ -455,6 +455,26 @@
|
|
| 455 |
<h2 class="font-semibold text-lg mb-2 flex items-center">
|
| 456 |
<i class="fas fa-chart-line mr-2 text-blue-400"></i> Analysis Tools
|
| 457 |
</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
<div class="space-y-3">
|
| 459 |
<button class="w-full p-2 bg-gray-700 hover:bg-gray-600 rounded flex items-center">
|
| 460 |
<i class="fas fa-user-shield mr-2 text-green-400"></i>
|
|
@@ -814,6 +834,52 @@
|
|
| 814 |
// In a real implementation, you would overlay a canvas for drawing
|
| 815 |
});
|
| 816 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 817 |
// Analysis tools buttons
|
| 818 |
const analysisButtons = document.querySelectorAll('.analysis-tools button');
|
| 819 |
const analysisModal = document.getElementById('analysisModal');
|
|
|
|
| 455 |
<h2 class="font-semibold text-lg mb-2 flex items-center">
|
| 456 |
<i class="fas fa-chart-line mr-2 text-blue-400"></i> Analysis Tools
|
| 457 |
</h2>
|
| 458 |
+
<div class="mb-4">
|
| 459 |
+
<h3 class="font-medium mb-2 flex items-center">
|
| 460 |
+
<i class="fas fa-code mr-2 text-green-400"></i> Python Script
|
| 461 |
+
</h3>
|
| 462 |
+
<div class="bg-gray-700 rounded p-2 mb-2 h-32">
|
| 463 |
+
<textarea id="pythonScript" class="w-full h-full bg-gray-800 text-xs font-mono p-2 rounded focus:outline-none focus:ring-1 focus:ring-blue-500" placeholder="Enter Python script here..."></textarea>
|
| 464 |
+
</div>
|
| 465 |
+
<div class="flex space-x-2">
|
| 466 |
+
<button id="runScript" class="px-3 py-1 bg-green-600 hover:bg-green-700 rounded text-sm">
|
| 467 |
+
<i class="fas fa-play mr-1"></i> Run
|
| 468 |
+
</button>
|
| 469 |
+
<button id="saveScript" class="px-3 py-1 bg-blue-600 hover:bg-blue-700 rounded text-sm">
|
| 470 |
+
<i class="fas fa-save mr-1"></i> Save
|
| 471 |
+
</button>
|
| 472 |
+
<button id="loadScript" class="px-3 py-1 bg-gray-700 hover:bg-gray-600 rounded text-sm">
|
| 473 |
+
<i class="fas fa-folder-open mr-1"></i> Load
|
| 474 |
+
</button>
|
| 475 |
+
</div>
|
| 476 |
+
</div>
|
| 477 |
+
</h2>
|
| 478 |
<div class="space-y-3">
|
| 479 |
<button class="w-full p-2 bg-gray-700 hover:bg-gray-600 rounded flex items-center">
|
| 480 |
<i class="fas fa-user-shield mr-2 text-green-400"></i>
|
|
|
|
| 834 |
// In a real implementation, you would overlay a canvas for drawing
|
| 835 |
});
|
| 836 |
|
| 837 |
+
// Python script controls
|
| 838 |
+
const pythonScript = document.getElementById('pythonScript');
|
| 839 |
+
const runScriptBtn = document.getElementById('runScript');
|
| 840 |
+
const saveScriptBtn = document.getElementById('saveScript');
|
| 841 |
+
const loadScriptBtn = document.getElementById('loadScript');
|
| 842 |
+
|
| 843 |
+
runScriptBtn.addEventListener('click', () => {
|
| 844 |
+
const script = pythonScript.value;
|
| 845 |
+
if (script.trim()) {
|
| 846 |
+
const result = executePythonScript(script);
|
| 847 |
+
alert(result);
|
| 848 |
+
} else {
|
| 849 |
+
alert('Please enter a Python script first');
|
| 850 |
+
}
|
| 851 |
+
});
|
| 852 |
+
|
| 853 |
+
saveScriptBtn.addEventListener('click', () => {
|
| 854 |
+
const script = pythonScript.value;
|
| 855 |
+
if (script.trim()) {
|
| 856 |
+
const blob = new Blob([script], { type: 'text/plain' });
|
| 857 |
+
const url = URL.createObjectURL(blob);
|
| 858 |
+
const a = document.createElement('a');
|
| 859 |
+
a.href = url;
|
| 860 |
+
a.download = 'forensic_script.py';
|
| 861 |
+
a.click();
|
| 862 |
+
URL.revokeObjectURL(url);
|
| 863 |
+
} else {
|
| 864 |
+
alert('No script to save');
|
| 865 |
+
}
|
| 866 |
+
});
|
| 867 |
+
|
| 868 |
+
loadScriptBtn.addEventListener('click', () => {
|
| 869 |
+
const input = document.createElement('input');
|
| 870 |
+
input.type = 'file';
|
| 871 |
+
input.accept = '.py,.txt';
|
| 872 |
+
input.onchange = e => {
|
| 873 |
+
const file = e.target.files[0];
|
| 874 |
+
const reader = new FileReader();
|
| 875 |
+
reader.onload = event => {
|
| 876 |
+
pythonScript.value = event.target.result;
|
| 877 |
+
};
|
| 878 |
+
reader.readAsText(file);
|
| 879 |
+
};
|
| 880 |
+
input.click();
|
| 881 |
+
});
|
| 882 |
+
|
| 883 |
// Analysis tools buttons
|
| 884 |
const analysisButtons = document.querySelectorAll('.analysis-tools button');
|
| 885 |
const analysisModal = document.getElementById('analysisModal');
|