File size: 5,544 Bytes
40f3dcd
 
 
 
 
bb3c1b4
40f3dcd
bb3c1b4
 
 
 
 
 
b15a70c
bb3c1b4
 
 
 
 
 
 
 
 
b15a70c
bb3c1b4
 
 
 
 
40f3dcd
bb3c1b4
40f3dcd
bb3c1b4
 
 
 
 
40f3dcd
bb3c1b4
 
 
 
40f3dcd
bb3c1b4
40f3dcd
bb3c1b4
 
 
 
b15a70c
bb3c1b4
40f3dcd
bb3c1b4
 
 
 
40f3dcd
bb3c1b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40f3dcd
 
 
 
bb3c1b4
 
 
 
 
 
 
 
 
 
 
 
40f3dcd
b15a70c
bb3c1b4
 
 
7ef8775
bb3c1b4
 
 
b15a70c
7ef8775
bb3c1b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a172f1d
bb3c1b4
 
a172f1d
bb3c1b4
 
 
 
 
 
 
 
 
 
 
40f3dcd
bb3c1b4
 
92018fe
bb3c1b4
 
 
 
 
 
 
 
 
 
 
b15a70c
bb3c1b4
 
 
 
 
 
 
 
 
 
 
 
40f3dcd
 
bb3c1b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hacker's Python Terminal</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: 'Courier New', monospace;
            background-color: #000;
            color: #0f0;
            overflow: hidden;
        }
        .container {
            display: flex;
            height: 100%;
        }
        .terminal {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            box-sizing: border-box;
        }
        .file-explorer {
            width: 200px;
            background-color: #111;
            padding: 10px;
            overflow-y: auto;
        }
        #output {
            margin-bottom: 20px;
            white-space: pre-wrap;
        }
        #input-line {
            display: flex;
            align-items: center;
        }
        #prompt {
            margin-right: 10px;
        }
        #code-input {
            flex: 1;
            background-color: transparent;
            border: none;
            color: #0f0;
            font-family: 'Courier New', monospace;
            font-size: 16px;
            outline: none;
        }
        .file-item {
            cursor: pointer;
            padding: 5px;
            transition: background-color 0.3s;
        }
        .file-item:hover {
            background-color: #222;
        }
        @keyframes glitch {
            0% {
                text-shadow: 0.05em 0 0 #00fffc, -0.05em -0.025em 0 #fc00ff,
                    0.025em 0.05em 0 #fffc00;
            }
            14% {
                text-shadow: 0.05em 0 0 #00fffc, -0.05em -0.025em 0 #fc00ff,
                    0.025em 0.05em 0 #fffc00;
            }
            15% {
                text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.025em 0 #fc00ff,
                    -0.05em -0.05em 0 #fffc00;
            }
            49% {
                text-shadow: -0.05em -0.025em 0 #00fffc, 0.025em 0.025em 0 #fc00ff,
                    -0.05em -0.05em 0 #fffc00;
            }
            50% {
                text-shadow: 0.025em 0.05em 0 #00fffc, 0.05em 0 0 #fc00ff,
                    0 -0.05em 0 #fffc00;
            }
            99% {
                text-shadow: 0.025em 0.05em 0 #00fffc, 0.05em 0 0 #fc00ff,
                    0 -0.05em 0 #fffc00;
            }
            100% {
                text-shadow: -0.025em 0 0 #00fffc, -0.025em -0.025em 0 #fc00ff,
                    -0.025em -0.05em 0 #fffc00;
            }
        }
        .glitch {
            animation: glitch 1s linear infinite;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="terminal">
            <div id="output"></div>
            <div id="input-line">
                <span id="prompt" class="glitch">&gt;</span>
                <input type="text" id="code-input" autofocus>
            </div>
        </div>
        <div class="file-explorer">
            <h3 class="glitch">Files</h3>
            <div id="file-list"></div>
        </div>
    </div>
    <script>
        const outputDiv = document.getElementById('output');
        const codeInput = document.getElementById('code-input');
        const fileList = document.getElementById('file-list');

        function addToOutput(text) {
            outputDiv.innerHTML += text + '\n';
            outputDiv.scrollTop = outputDiv.scrollHeight;
        }

        function executeCode() {
            const command = codeInput.value;
            addToOutput(`> ${command}`);

            fetch("/execute", {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({ code: command }),
            })
            .then(response => response.json())
            .then(data => {
                addToOutput(data.result);
                updateFileList();
            })
            .catch(error => {
                addToOutput(`Error: ${error}`);
            });

            codeInput.value = '';
        }

        function updateFileList() {
            fetch("/list_files")
            .then(response => response.json())
            .then(data => {
                fileList.innerHTML = '';
                data.files.forEach(file => {
                    const fileItem = document.createElement('div');
                    fileItem.className = 'file-item';
                    fileItem.textContent = file;
                    fileItem.onclick = () => downloadFile(file);
                    fileList.appendChild(fileItem);
                });
            });
        }

        function downloadFile(filename) {
            window.location.href = `/download/${filename}`;
        }

        function cleanup() {
            fetch("/cleanup", { method: "POST" })
            .then(response => response.json())
            .then(data => {
                addToOutput(data.result);
                updateFileList();
            });
        }

        codeInput.addEventListener('keydown', function(event) {
            if (event.key === 'Enter') {
                executeCode();
            }
        });

        window.addEventListener('load', updateFileList);
        window.addEventListener('beforeunload', cleanup);

        // Initial message
        addToOutput("Welcome to the Hacker's Python Terminal. Type your commands below.");
    </script>
</body>
</html>