-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
656 lines (601 loc) ยท 25 KB
/
Copy pathapp.py
File metadata and controls
656 lines (601 loc) ยท 25 KB
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
import streamlit as st
import asyncio
import aiohttp
import time
import pandas as pd
# ==========================================
# ๐๏ธ TUWAIQ | ุทูููู โ Mobile-First v3
# ==========================================
st.set_page_config(
page_title="Tuwaiq | ุทููู AI",
page_icon="๐๏ธ",
layout="centered", # โ centered = no wide overflow on mobile
initial_sidebar_state="collapsed"
)
# โโ Language & Ops State (default = English) โโโโโโโโโโโโโโโ
if 'lang' not in st.session_state:
st.session_state.lang = 'en'
if 'show_ops' not in st.session_state:
st.session_state.show_ops = False
def toggle_lang():
st.session_state.lang = 'en' if st.session_state.lang == 'ar' else 'ar'
def open_ops():
st.session_state.show_ops = True
# โโ Dictionary โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
D = {
'en': {
'title': 'TUWAIQ | ุทูููู',
'sub': 'Advanced Performance Intelligence โ AI Swarm Platform',
'ops': 'Operations Room',
'target': 'Target URL',
'swarm': 'Swarm Size',
'launch': 'LAUNCH SWARM',
'main_btn': 'START NOW',
'side_desc': 'Swarm Intelligence AI to simulate thousands of real users, stress test networks, and gather OSINT performance intelligence in seconds.',
'status_online': 'ONLINE',
'mission_reports':'Mission Reports',
'metric_time': 'Attack Time',
'metric_success': 'Successful Hits',
'metric_fail': 'Connection Fails',
'metric_avg': 'Avg Response',
'tab_logs': 'Operations Log',
'tab_charts': 'Performance',
'chart_title': 'Server Response Fluctuations During Attack',
'success_msg': 'Swarm withdrawn โ intelligence reports received.',
'lang_btn': 'ุงูุนุฑุจูุฉ',
'intel_label': 'Platform Intel',
'badge': 'AI SWARM PLATFORM',
'standby': 'SYSTEM STANDBY',
},
'ar': {
'title': 'TUWAIQ | ุทูููู',
'sub': 'ู
ูุตุฉ ุงุณุชุฎุจุงุฑุงุช ูุงุฎุชุจุงุฑ ุงูุฃุฏุงุก โ AI Swarm Intelligence',
'ops': 'ุบุฑูุฉ ุงูุนู
ููุงุช',
'target': 'ุงูุฑุงุจุท ุงูู
ุณุชูุฏู',
'swarm': 'ุญุฌู
ุงูุณุฑุจ',
'launch': 'ุฅุทูุงู ุงูุณุฑุจ',
'main_btn': 'ุงุจุฏุฃ ุงูุขู',
'side_desc': 'ูุธุงู
ุฐูุงุก ุงุตุทูุงุนู ูุนุชู
ุฏ ุนูู ุงูุฃุณุฑุงุจ ูู
ุญุงูุงุฉ ุขูุงู ุงูู
ุณุชุฎุฏู
ูู ุจุฏูุฉุ ูุงุฎุชุจุงุฑ ุงูุดุจูุงุชุ ูุฌู
ุน ุงุณุชุฎุจุงุฑุงุช ุงูุฃุฏุงุก ูู ุซูุงูู.',
'status_online': 'ONLINE',
'mission_reports':'ุชูุงุฑูุฑ ุงูู
ูู
ุฉ',
'metric_time': 'ุฒู
ู ุงูุชูููุฐ',
'metric_success': 'ุงุฎุชุฑุงูุงุช ูุงุฌุญุฉ',
'metric_fail': 'ูุดู ุงูุงุชุตุงู',
'metric_avg': 'ู
ุชูุณุท ุงูุงุณุชุฌุงุจุฉ',
'tab_logs': 'ุณุฌู ุงูุนู
ููุงุช',
'tab_charts': 'ุชุญููู ุงูุฃุฏุงุก',
'chart_title': 'ุชุฐุจุฐุจ ุงุณุชุฌุงุจุฉ ุงูุฎุงุฏู
ุฃุซูุงุก ุงููุฌูู
',
'success_msg': 'ุชู
ุณุญุจ ุงูุณุฑุจ ุจูุฌุงุญ โ ุชูุงุฑูุฑ ุงูุงุณุชุฎุจุงุฑุงุช ูุตูุช.',
'lang_btn': 'English',
'intel_label': 'ู
ูุตุฉ ุงูู
ุนููู
ุงุช',
'badge': 'AI SWARM PLATFORM',
'standby': 'SYSTEM STANDBY',
}
}
T = D[st.session_state.lang]
# โโ Hide sidebar + Streamlit chrome โโโโโโโโโโโโโโโโโโโโโโโโ
st.markdown("""
<style>
[data-testid="collapsedControl"],
#MainMenu, footer, header { display:none!important; }
</style>
""", unsafe_allow_html=True)
# โโ SVG Robot icon (cyan/purple, no emoji) โโโโโโโโโโโโโโโโโโ
ROBOT_SVG = """
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="72" height="72">
<defs>
<linearGradient id="rg" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#00d4ff"/>
<stop offset="100%" stop-color="#7b61ff"/>
</linearGradient>
</defs>
<!-- antenna -->
<line x1="32" y1="6" x2="32" y2="14" stroke="url(#rg)" stroke-width="2" stroke-linecap="round"/>
<circle cx="32" cy="5" r="2.5" fill="#00d4ff"/>
<!-- head -->
<rect x="16" y="14" width="32" height="22" rx="5" fill="none" stroke="url(#rg)" stroke-width="2"/>
<!-- eyes -->
<circle cx="25" cy="24" r="4" fill="none" stroke="#00d4ff" stroke-width="1.5"/>
<circle cx="25" cy="24" r="1.8" fill="#00d4ff" opacity=".7"/>
<circle cx="39" cy="24" r="4" fill="none" stroke="#7b61ff" stroke-width="1.5"/>
<circle cx="39" cy="24" r="1.8" fill="#7b61ff" opacity=".7"/>
<!-- mouth -->
<rect x="24" y="31" width="16" height="2.5" rx="1.2" fill="url(#rg)" opacity=".6"/>
<!-- neck -->
<rect x="29" y="36" width="6" height="4" rx="1" fill="url(#rg)" opacity=".5"/>
<!-- body -->
<rect x="14" y="40" width="36" height="20" rx="5" fill="none" stroke="url(#rg)" stroke-width="2"/>
<!-- chest light -->
<rect x="26" y="46" width="12" height="7" rx="2" fill="none" stroke="#00d4ff" stroke-width="1.2" opacity=".5"/>
<rect x="29" y="48.5" width="6" height="2" rx="1" fill="#00d4ff" opacity=".4"/>
<!-- arms -->
<rect x="4" y="41" width="8" height="14" rx="3" fill="none" stroke="url(#rg)" stroke-width="1.8"/>
<rect x="52" y="41" width="8" height="14" rx="3" fill="none" stroke="url(#rg)" stroke-width="1.8"/>
<!-- legs -->
<rect x="19" y="60" width="9" height="4" rx="2" fill="url(#rg)" opacity=".4"/>
<rect x="36" y="60" width="9" height="4" rx="2" fill="url(#rg)" opacity=".4"/>
</svg>
"""
# โโ Full CSS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
st.markdown("""
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@400;600;700&family=Cairo:wght@400;700;900&display=swap" rel="stylesheet">
<style>
:root {
--bg: #03050d;
--panel: #070c18;
--border: #0f1e36;
--border-hi: #1a3a6e;
--accent: #00d4ff;
--accent2: #7b61ff;
--success: #00ff88;
--text: #c8d8f0;
--muted: #3d5278;
--mono: 'Share Tech Mono', monospace;
--head: 'Rajdhani', sans-serif;
--ar: 'Cairo', sans-serif;
}
html, body, [class*="css"] {
font-family: var(--ar), var(--head), sans-serif !important;
background-color: var(--bg) !important;
color: var(--text) !important;
}
/* prevent horizontal scroll on mobile */
.main .block-container {
max-width: 100% !important;
padding: 0 16px !important;
overflow-x: hidden !important;
}
/* scanline */
.stApp::before {
content:""; position:fixed; inset:0;
background: repeating-linear-gradient(
0deg,transparent,transparent 2px,
rgba(0,212,255,.012) 2px,rgba(0,212,255,.012) 4px
);
pointer-events:none; z-index:9999;
}
.stApp {
background-color: var(--bg) !important;
background-image:
radial-gradient(ellipse 80% 40% at 50% 0%, rgba(0,100,200,.13) 0%,transparent 65%),
radial-gradient(ellipse 60% 50% at 80% 100%, rgba(123,97,255,.09) 0%,transparent 60%);
background-attachment: fixed;
}
/* โโ BADGE โโ */
.tw-badge {
display: block;
font-family: var(--mono);
font-size: .6rem;
color: var(--accent);
background: rgba(0,212,255,.07);
border: 1px solid rgba(0,212,255,.22);
padding: 3px 14px;
border-radius: 2px;
letter-spacing: 4px;
text-align: center;
width: fit-content;
margin: 20px auto 10px;
}
/* โโ TITLE โโ */
.tw-title {
font-family: var(--head), sans-serif;
font-size: clamp(1.8rem, 7vw, 3rem);
font-weight: 700;
letter-spacing: 4px;
text-align: center;
white-space: nowrap;
background: linear-gradient(90deg,#fff 0%,var(--accent) 50%,var(--accent2) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin: 0 0 6px;
line-height: 1.1;
}
.tw-sub {
font-family: var(--mono);
font-size: clamp(.52rem, 2vw, .7rem);
color: var(--muted);
letter-spacing: 2px;
text-transform: uppercase;
text-align: center;
margin: 4px 0 0;
line-height: 1.5;
}
.tw-line {
height:1px;
background:linear-gradient(90deg,transparent,#00d4ff,#7b61ff,transparent);
opacity:.35; margin:10px 0 0;
}
/* โโ HEADER RIGHT โโ */
.hdr-right {
display:flex; align-items:center;
justify-content:flex-end;
gap:10px; padding-top:20px;
}
.status-pill {
display:flex; align-items:center; gap:5px;
font-family:var(--mono); font-size:.6rem;
color:var(--success); letter-spacing:2px;
border:1px solid rgba(0,255,136,.25);
border-radius:2px; padding:4px 8px;
background:rgba(0,255,136,.04);
}
.sdot {
width:6px;height:6px;border-radius:50%;
background:var(--success);flex-shrink:0;
animation:blink 1.4s ease-in-out infinite;
}
@keyframes blink{0%,100%{opacity:1}50%{opacity:.2}}
/* โโ RING โโ */
.ring-wrap {
position:relative; width:190px; height:190px;
margin:36px auto 24px;
}
.ring1,.ring2 {
position:absolute; border-radius:50%;
top:0;left:0;
}
.ring1 {
width:190px;height:190px;
border:1.5px solid rgba(0,212,255,.1);
border-top:2.5px solid #00d4ff;
border-right:2.5px solid #7b61ff;
animation:spinR 7s linear infinite;
}
.ring2 {
width:136px;height:136px;
top:27px;left:27px;
border:1px solid rgba(123,97,255,.1);
border-bottom:2px solid #7b61ff;
animation:spinR 4.5s linear infinite reverse;
}
.ring-center {
position:absolute;
top:50%;left:50%;
transform:translate(-50%,-50%);
animation:pf 2.5s ease-in-out infinite;
}
@keyframes spinR{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
@keyframes pf{0%,100%{opacity:.55;transform:translate(-50%,-50%) scale(1)}
50%{opacity:1;transform:translate(-50%,-50%) scale(1.08)}}
/* โโ STANDBY LABEL โโ */
.standby-label {
font-family:var(--mono);font-size:.63rem;
color:var(--muted);letter-spacing:5px;
text-transform:uppercase;text-align:center;
display:block;margin-bottom:16px;
}
.standby-desc {
font-size:.85rem;color:var(--muted);
text-align:center;line-height:1.75;
margin:14px auto 0;max-width:360px;
}
/* โโ PULSE BUTTON โโ */
div[data-testid="stButton"]:has(button[key="start_now"]) button {
background: linear-gradient(90deg,rgba(0,212,255,.14),rgba(123,97,255,.14)) !important;
border: 2px solid #00d4ff !important;
color: #fff !important;
font-family: var(--mono) !important;
font-size: .95rem !important;
letter-spacing: 5px !important;
padding: 14px 0 !important;
border-radius: 50px !important;
animation: pulseGlow 1.8s ease-in-out infinite !important;
}
@keyframes pulseGlow {
0% {box-shadow:0 0 0 0 rgba(0,212,255,.7);}
50% {box-shadow:0 0 28px 8px rgba(0,212,255,.25);}
100% {box-shadow:0 0 0 0 rgba(0,212,255,0);}
}
div[data-testid="stButton"]:has(button[key="start_now"]) button:hover {
background:linear-gradient(90deg,rgba(0,212,255,.28),rgba(123,97,255,.28))!important;
}
/* โโ STATS CARDS โโ */
.stats-row {
display:grid;grid-template-columns:repeat(2,1fr);
gap:10px;margin:32px 0 0;
}
.stat-card {
background:rgba(0,212,255,.03);
border:1px solid var(--border);
border-top:1px solid var(--border-hi);
border-radius:4px;padding:14px 16px;
text-align:center;
}
.stat-label {
font-family:var(--mono);font-size:.55rem;
color:var(--accent);letter-spacing:3px;
text-transform:uppercase;margin-bottom:5px;display:block;
}
.stat-val {
font-family:var(--head),sans-serif;
font-size:1.4rem;color:#fff;font-weight:700;
}
/* โโ DIVIDER โโ */
.tw-divider {
display:flex;align-items:center;gap:10px;
margin:28px 0 20px;
}
.tw-divider-line{flex:1;height:1px;background:var(--border);}
.tw-divider-text {
font-family:var(--mono);font-size:.6rem;
color:var(--accent);letter-spacing:3px;
text-transform:uppercase;white-space:nowrap;
}
/* โโ OPS PANEL โโ */
.ops-panel {
background:rgba(7,12,24,.88);
border:1px solid var(--border-hi);
border-top:2px solid var(--accent);
border-radius:8px;
padding:20px 18px 24px;
margin-bottom:20px;
}
.ops-title {
font-family:var(--mono);font-size:.68rem;
color:var(--accent);letter-spacing:3px;
text-transform:uppercase;margin-bottom:12px;
}
.intel-box {
background:rgba(0,212,255,.03);
border-left:2px solid var(--accent);
border-radius:3px;padding:10px 14px;
margin-bottom:18px;font-size:.82rem;
color:#7a9ac0;line-height:1.7;
}
/* โโ INPUTS โโ */
div[data-testid="stTextInput"] input {
background:rgba(0,212,255,.04)!important;
border:1px solid var(--border-hi)!important;
border-radius:4px!important;
color:var(--text)!important;
font-family:var(--mono)!important;
font-size:.82rem!important;
}
div[data-testid="stTextInput"] input:focus {
border-color:var(--accent)!important;
box-shadow:0 0 14px rgba(0,212,255,.15)!important;
}
div[data-testid="stSlider"] > div > div > div{background:var(--accent)!important;}
/* โโ BUTTONS โโ */
.stButton > button {
background:transparent!important;
border:1px solid var(--accent)!important;
border-radius:3px!important;
color:var(--accent)!important;
font-family:var(--mono)!important;
font-size:.7rem!important;
letter-spacing:2px!important;
text-transform:uppercase!important;
transition:all .2s!important;
}
.stButton > button:hover {
background:rgba(0,212,255,.1)!important;
box-shadow:0 0 16px rgba(0,212,255,.2)!important;
}
.stButton > button[kind="primary"] {
background:linear-gradient(90deg,rgba(0,212,255,.13),rgba(123,97,255,.13))!important;
border:1px solid var(--accent)!important;
color:#fff!important;font-size:.74rem!important;
}
.stButton > button[kind="primary"]:hover {
background:linear-gradient(90deg,rgba(0,212,255,.28),rgba(123,97,255,.28))!important;
box-shadow:0 0 24px rgba(0,212,255,.28)!important;
}
/* โโ METRICS โโ */
div[data-testid="stMetric"] {
background:rgba(0,212,255,.03)!important;
border:1px solid var(--border)!important;
border-radius:4px!important;padding:14px 10px!important;
position:relative;overflow:hidden;transition:all .25s;
}
div[data-testid="stMetric"]::before {
content:"";position:absolute;top:0;left:0;right:0;height:1px;
background:linear-gradient(90deg,var(--accent),var(--accent2));opacity:.7;
}
div[data-testid="stMetric"]:hover{transform:translateY(-2px);}
div[data-testid="stMetricLabel"] {
color:var(--muted)!important;font-family:var(--mono)!important;
font-size:.58rem!important;letter-spacing:2px!important;text-transform:uppercase!important;
}
div[data-testid="stMetricValue"] {
color:#fff!important;font-family:var(--head),sans-serif!important;
font-size:1.7rem!important;font-weight:700!important;
}
/* โโ TABS โโ */
.stTabs [data-baseweb="tab-list"] {
background:transparent!important;
border-bottom:1px solid var(--border)!important;gap:0!important;
}
.stTabs [data-baseweb="tab"] {
background:transparent!important;border-radius:0!important;
color:var(--muted)!important;font-family:var(--mono)!important;
font-size:.65rem!important;letter-spacing:2px!important;
text-transform:uppercase!important;padding:10px 18px!important;
border-bottom:2px solid transparent!important;transition:all .2s!important;
}
.stTabs [data-baseweb="tab"]:hover{color:var(--accent)!important;}
.stTabs [data-baseweb="tab"][aria-selected="true"] {
color:var(--accent)!important;
border-bottom:2px solid var(--accent)!important;
background:rgba(0,212,255,.04)!important;
}
.stTabs [data-baseweb="tab-panel"]{padding-top:16px!important;}
/* โโ MISC โโ */
div[data-testid="stDataFrame"]{border:1px solid var(--border)!important;border-radius:4px!important;}
div[data-testid="stAlert"]{border-radius:4px!important;font-family:var(--mono)!important;font-size:.76rem!important;}
hr{border-color:var(--border)!important;margin:20px 0!important;}
::-webkit-scrollbar{width:4px;height:4px;}
::-webkit-scrollbar-track{background:var(--bg);}
::-webkit-scrollbar-thumb{background:var(--border-hi);border-radius:2px;}
::-webkit-scrollbar-thumb:hover{background:var(--accent);}
</style>
""", unsafe_allow_html=True)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# HEADER
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
col_title, col_right = st.columns([3, 1])
with col_title:
# badge centered above title
st.markdown(f"<span class='tw-badge'>{T['badge']}</span>", unsafe_allow_html=True)
st.markdown(f"<h1 class='tw-title'>{T['title']}</h1>", unsafe_allow_html=True)
st.markdown(f"<p class='tw-sub'>{T['sub']}</p>", unsafe_allow_html=True)
with col_right:
st.markdown("<div style='height:20px'></div>", unsafe_allow_html=True)
st.button(f"๐ {T['lang_btn']}", on_click=toggle_lang, use_container_width=True, key="lang_btn")
st.markdown(f"""
<div class="status-pill" style="margin-top:8px;justify-content:center;">
<span class="sdot"></span>{T['status_online']}
</div>
""", unsafe_allow_html=True)
st.markdown("<div class='tw-line'></div>", unsafe_allow_html=True)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# HERO
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# spinning rings + SVG robot
st.markdown(f"""
<div style="text-align:center;padding:44px 0 0;">
<div class="ring-wrap">
<div class="ring1"></div>
<div class="ring2"></div>
<div class="ring-center">{ROBOT_SVG}</div>
</div>
<span class="standby-label">โฆ {T['standby']} โฆ</span>
</div>
""", unsafe_allow_html=True)
# pulse button
btn_col = st.columns([1, 3, 1])
with btn_col[1]:
clicked = st.button(f" {T['main_btn']} ", use_container_width=True,
key="start_now", on_click=open_ops)
# auto-scroll JS โ fires when show_ops becomes True
if st.session_state.show_ops:
st.markdown("""
<script>
window.setTimeout(function(){
var el = document.getElementById('ops-anchor');
if(el){ el.scrollIntoView({behavior:'smooth',block:'start'}); }
}, 120);
</script>
""", unsafe_allow_html=True)
st.markdown(f"<p class='standby-desc'>{T['side_desc']}</p>", unsafe_allow_html=True)
# 4-stat cards (2ร2 grid on mobile)
st.markdown(f"""
<div class="stats-row">
<div class="stat-card">
<span class="stat-label">MAX SWARM</span>
<div class="stat-val">2,000</div>
</div>
<div class="stat-card">
<span class="stat-label">ENGINE</span>
<div class="stat-val">ASYNC</div>
</div>
<div class="stat-card">
<span class="stat-label">PROTOCOL</span>
<div class="stat-val">HTTP</div>
</div>
<div class="stat-card">
<span class="stat-label">MODE</span>
<div class="stat-val">OSINT</div>
</div>
</div>
""", unsafe_allow_html=True)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# OPS PANEL
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
if st.session_state.show_ops:
# anchor for auto-scroll
st.markdown("<div id='ops-anchor' style='height:44px'></div>", unsafe_allow_html=True)
st.markdown(f"""
<div class="tw-divider">
<div class="tw-divider-line"></div>
<span class="tw-divider-text">โ {T['ops']} โ</span>
<div class="tw-divider-line"></div>
</div>
<div class="ops-panel">
<div class="ops-title">โ {T['intel_label']}</div>
<div class="intel-box">{T['side_desc']}</div>
</div>
""", unsafe_allow_html=True)
target_url = st.text_input(f"๐ฏ {T['target']}", value="https://example.com", key="target_url")
swarm_size = st.slider(f"๐ค {T['swarm']}", min_value=10, max_value=2000,
value=200, step=10, key="swarm_size")
st.markdown("<div style='height:6px'></div>", unsafe_allow_html=True)
launch_btn = st.button(T['launch'], use_container_width=True, type="primary", key="launch")
# โโ Core Engine โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
async def agent_task(session, agent_id, url, lang):
try:
t0 = time.time()
async with session.get(url, timeout=10) as resp:
await resp.read()
lat = round(time.time() - t0, 2)
ok = "Success" if lang == 'en' else "ูุฌุงุญ"
return {"Agent": f"Agent-{agent_id:04d}", "Status": resp.status,
"Latency (s)": lat, "Result": f"OK {ok}"}
except Exception:
fail = "Failed" if lang == 'en' else "ูุดู"
return {"Agent": f"Agent-{agent_id:04d}", "Status": 500,
"Latency (s)": 0, "Result": f"ERR {fail}"}
async def launch_swarm(url, size, lang):
async with aiohttp.ClientSession() as session:
tasks = [agent_task(session, i, url, lang) for i in range(1, size + 1)]
return await asyncio.gather(*tasks)
# โโ Results โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
if launch_btn:
if not target_url.startswith("http"):
st.error("URL must start with http:// or https://"
if st.session_state.lang == 'en'
else "ุงูุฑุงุจุท ูุฌุจ ุฃู ูุจุฏุฃ ุจู http:// ุฃู https://")
else:
spin = (f"Deploying {swarm_size} agents to {target_url} ..."
if st.session_state.lang == 'en'
else f"ุฌุงุฑู ูุดุฑ {swarm_size} ูููู ูุญู {target_url} ...")
with st.spinner(spin):
t0 = time.time()
results = asyncio.run(launch_swarm(target_url, swarm_size, st.session_state.lang))
total = round(time.time() - t0, 2)
df = pd.DataFrame(results)
ok_key = "OK Success" if st.session_state.lang == 'en' else "OK ูุฌุงุญ"
err_key = "ERR Failed" if st.session_state.lang == 'en' else "ERR ูุดู"
s_cnt = len(df[df["Result"] == ok_key])
f_cnt = len(df[df["Result"] == err_key])
avg_lat = round(df[df["Result"] == ok_key]["Latency (s)"].mean(), 2) if s_cnt > 0 else 0
st.success(T['success_msg'])
st.markdown(f"""
<div class="tw-divider" style="margin-top:24px">
<div class="tw-divider-line"></div>
<span class="tw-divider-text">โ {T['mission_reports']} โ</span>
<div class="tw-divider-line"></div>
</div>
""", unsafe_allow_html=True)
c1, c2, c3, c4 = st.columns(4)
with c1: st.metric(T['metric_time'], f"{total} s")
with c2: st.metric(T['metric_success'], s_cnt)
with c3: st.metric(T['metric_fail'], f_cnt)
with c4: st.metric(T['metric_avg'], f"{avg_lat} s")
st.divider()
tab1, tab2 = st.tabs([T['tab_logs'], T['tab_charts']])
with tab1:
st.dataframe(df, use_container_width=True, height=400)
with tab2:
if s_cnt > 0:
st.markdown(
f"<p style='font-family:var(--mono);font-size:.66rem;"
f"color:#00d4ff;letter-spacing:2px;'>โ {T['chart_title']}</p>",
unsafe_allow_html=True)
st.area_chart(
df[df["Result"] == ok_key]["Latency (s)"].reset_index(drop=True),
color="#00d4ff")
else:
st.warning("No successful data to chart."
if st.session_state.lang == 'en'
else "ูุง ุชูุฌุฏ ุจูุงูุงุช ูุงุฌุญุฉ.")
# โโ Footer โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
st.markdown("""
<div style="text-align:center;padding:48px 0 20px;
font-family:'Share Tech Mono',monospace;
font-size:.58rem;color:#1a3a6e;letter-spacing:2px;">
DEVELOPED IN KSA โฆ @DEVSAUDI โฆ TUWAIQ AI SWARM
</div>
""", unsafe_allow_html=True)