AayanSuleri commited on
Commit
5e574b4
Β·
verified Β·
1 Parent(s): c12703a

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +546 -0
templates/index.html ADDED
@@ -0,0 +1,546 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.0">
6
+ <title>Scam-Signal Verifier</title>
7
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
8
+ <style>
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ body {
16
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
17
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
18
+ min-height: 100vh;
19
+ padding: 20px;
20
+ }
21
+
22
+ .container {
23
+ max-width: 800px;
24
+ margin: 0 auto;
25
+ background: white;
26
+ border-radius: 20px;
27
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
28
+ overflow: hidden;
29
+ }
30
+
31
+ .header {
32
+ background: linear-gradient(135deg, #ff6b6b, #ffa726);
33
+ color: white;
34
+ padding: 30px;
35
+ text-align: center;
36
+ }
37
+
38
+ .header h1 {
39
+ font-size: 2.5rem;
40
+ margin-bottom: 10px;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ gap: 15px;
45
+ }
46
+
47
+ .header p {
48
+ font-size: 1.1rem;
49
+ opacity: 0.9;
50
+ }
51
+
52
+ .main-content {
53
+ padding: 40px;
54
+ }
55
+
56
+ .input-section {
57
+ margin-bottom: 30px;
58
+ }
59
+
60
+ .form-group {
61
+ margin-bottom: 20px;
62
+ }
63
+
64
+ .form-group label {
65
+ display: block;
66
+ margin-bottom: 8px;
67
+ font-weight: 600;
68
+ color: #333;
69
+ }
70
+
71
+ .form-group textarea,
72
+ .form-group input {
73
+ width: 100%;
74
+ padding: 15px;
75
+ border: 2px solid #e1e5e9;
76
+ border-radius: 10px;
77
+ font-size: 14px;
78
+ transition: border-color 0.3s ease;
79
+ }
80
+
81
+ .form-group textarea:focus,
82
+ .form-group input:focus {
83
+ outline: none;
84
+ border-color: #667eea;
85
+ }
86
+
87
+ .form-group textarea {
88
+ resize: vertical;
89
+ min-height: 120px;
90
+ }
91
+
92
+ .analyze-btn {
93
+ background: linear-gradient(135deg, #667eea, #764ba2);
94
+ color: white;
95
+ border: none;
96
+ padding: 15px 40px;
97
+ border-radius: 10px;
98
+ font-size: 16px;
99
+ font-weight: 600;
100
+ cursor: pointer;
101
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
102
+ display: flex;
103
+ align-items: center;
104
+ gap: 10px;
105
+ margin: 0 auto;
106
+ }
107
+
108
+ .analyze-btn:hover {
109
+ transform: translateY(-2px);
110
+ box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
111
+ }
112
+
113
+ .analyze-btn:disabled {
114
+ opacity: 0.6;
115
+ cursor: not-allowed;
116
+ transform: none;
117
+ box-shadow: none;
118
+ }
119
+
120
+ .loading {
121
+ display: none;
122
+ text-align: center;
123
+ padding: 20px;
124
+ color: #666;
125
+ }
126
+
127
+ .loading i {
128
+ font-size: 24px;
129
+ animation: spin 1s linear infinite;
130
+ }
131
+
132
+ @keyframes spin {
133
+ 0% { transform: rotate(0deg); }
134
+ 100% { transform: rotate(360deg); }
135
+ }
136
+
137
+ .results {
138
+ display: none;
139
+ margin-top: 30px;
140
+ }
141
+
142
+ .risk-indicator {
143
+ text-align: center;
144
+ padding: 30px;
145
+ border-radius: 15px;
146
+ margin-bottom: 30px;
147
+ }
148
+
149
+ .risk-high {
150
+ background: linear-gradient(135deg, #ff4757, #ff3838);
151
+ color: white;
152
+ }
153
+
154
+ .risk-medium {
155
+ background: linear-gradient(135deg, #ffa726, #ff9800);
156
+ color: white;
157
+ }
158
+
159
+ .risk-low {
160
+ background: linear-gradient(135deg, #26c6da, #00acc1);
161
+ color: white;
162
+ }
163
+
164
+ .risk-minimal {
165
+ background: linear-gradient(135deg, #66bb6a, #4caf50);
166
+ color: white;
167
+ }
168
+
169
+ .risk-score {
170
+ font-size: 3rem;
171
+ font-weight: 700;
172
+ margin-bottom: 10px;
173
+ }
174
+
175
+ .risk-classification {
176
+ font-size: 1.2rem;
177
+ font-weight: 600;
178
+ margin-bottom: 15px;
179
+ }
180
+
181
+ .risk-summary {
182
+ font-size: 1rem;
183
+ opacity: 0.9;
184
+ }
185
+
186
+ .analysis-section {
187
+ margin-bottom: 30px;
188
+ }
189
+
190
+ .section-title {
191
+ font-size: 1.3rem;
192
+ font-weight: 600;
193
+ color: #333;
194
+ margin-bottom: 15px;
195
+ display: flex;
196
+ align-items: center;
197
+ gap: 10px;
198
+ }
199
+
200
+ .red-flags,
201
+ .recommendations {
202
+ background: #f8f9fa;
203
+ border-radius: 10px;
204
+ padding: 20px;
205
+ }
206
+
207
+ .flag-item,
208
+ .recommendation-item {
209
+ padding: 10px;
210
+ margin-bottom: 10px;
211
+ border-radius: 8px;
212
+ border-left: 4px solid;
213
+ }
214
+
215
+ .flag-item {
216
+ background: #fff5f5;
217
+ border-left-color: #e53e3e;
218
+ color: #c53030;
219
+ }
220
+
221
+ .recommendation-item {
222
+ background: #f0fff4;
223
+ border-left-color: #38a169;
224
+ color: #2d3748;
225
+ }
226
+
227
+ .report-section {
228
+ background: #f7fafc;
229
+ border-radius: 10px;
230
+ padding: 20px;
231
+ }
232
+
233
+ .report-template {
234
+ background: white;
235
+ border: 1px solid #e2e8f0;
236
+ border-radius: 8px;
237
+ padding: 15px;
238
+ font-family: monospace;
239
+ font-size: 12px;
240
+ white-space: pre-wrap;
241
+ max-height: 200px;
242
+ overflow-y: auto;
243
+ }
244
+
245
+ .copy-btn {
246
+ background: #4299e1;
247
+ color: white;
248
+ border: none;
249
+ padding: 8px 16px;
250
+ border-radius: 6px;
251
+ cursor: pointer;
252
+ margin-top: 10px;
253
+ font-size: 14px;
254
+ }
255
+
256
+ .copy-btn:hover {
257
+ background: #3182ce;
258
+ }
259
+
260
+ .footer {
261
+ text-align: center;
262
+ padding: 20px;
263
+ background: #f8f9fa;
264
+ color: #666;
265
+ font-size: 14px;
266
+ }
267
+
268
+ .example-section {
269
+ background: #f0f8ff;
270
+ border-radius: 10px;
271
+ padding: 20px;
272
+ margin-bottom: 30px;
273
+ }
274
+
275
+ .example-title {
276
+ font-weight: 600;
277
+ color: #2c5aa0;
278
+ margin-bottom: 15px;
279
+ }
280
+
281
+ .example-btn {
282
+ background: #e6f3ff;
283
+ border: 1px solid #b3d9ff;
284
+ border-radius: 6px;
285
+ padding: 8px 12px;
286
+ margin: 5px;
287
+ cursor: pointer;
288
+ font-size: 12px;
289
+ color: #2c5aa0;
290
+ transition: background-color 0.2s ease;
291
+ }
292
+
293
+ .example-btn:hover {
294
+ background: #cce7ff;
295
+ }
296
+
297
+ @media (max-width: 768px) {
298
+ .header h1 {
299
+ font-size: 2rem;
300
+ }
301
+
302
+ .main-content {
303
+ padding: 20px;
304
+ }
305
+
306
+ .risk-score {
307
+ font-size: 2.5rem;
308
+ }
309
+ }
310
+ </style>
311
+ </head>
312
+ <body>
313
+ <div class="container">
314
+ <div class="header">
315
+ <h1><i class="fas fa-shield-alt"></i> Scam-Signal Verifier</h1>
316
+ <p>Protect yourself from phishing attempts and fraudulent messages</p>
317
+ </div>
318
+
319
+ <div class="main-content">
320
+ <div class="example-section">
321
+ <div class="example-title">🎯 Try these examples:</div>
322
+ <button class="example-btn" onclick="loadExample('phishing')">Phishing Email</button>
323
+ <button class="example-btn" onclick="loadExample('job')">Fake Job Offer</button>
324
+ <button class="example-btn" onclick="loadExample('investment')">Investment Scam</button>
325
+ <button class="example-btn" onclick="loadExample('lottery')">Lottery Scam</button>
326
+ </div>
327
+
328
+ <div class="input-section">
329
+ <div class="form-group">
330
+ <label for="message-input">πŸ“§ Paste suspicious message or text:</label>
331
+ <textarea id="message-input" placeholder="Paste the suspicious message, email, text, or advertisement content here..."></textarea>
332
+ </div>
333
+
334
+ <div class="form-group">
335
+ <label for="url-input">πŸ”— URL (optional):</label>
336
+ <input type="url" id="url-input" placeholder="https://example.com/suspicious-link">
337
+ </div>
338
+
339
+ <button class="analyze-btn" onclick="analyzeMessage()">
340
+ <i class="fas fa-search"></i>
341
+ <span>Analyze for Scam Signals</span>
342
+ </button>
343
+ </div>
344
+
345
+ <div class="loading">
346
+ <i class="fas fa-spinner"></i>
347
+ <p>Analyzing message for scam signals...</p>
348
+ </div>
349
+
350
+ <div class="results" id="results">
351
+ <!-- Results will be populated here -->
352
+ </div>
353
+ </div>
354
+
355
+ <div class="footer">
356
+ <p>πŸ›‘οΈ Stay safe online β€’ Report suspicious messages to relevant authorities</p>
357
+ </div>
358
+ </div>
359
+
360
+ <script>
361
+ const examples = {
362
+ phishing: `URGENT: Your account will be suspended in 24 hours!
363
+
364
+ Dear Customer,
365
+ We have detected suspicious activity on your account. To prevent closure, verify your information immediately by clicking here: http://secure-bank-verify.net/login
366
+ Your account ID: AC-2024-789456
367
+ Time remaining: 23:47:52
368
+
369
+ Act now to avoid permanent suspension!`,
370
+
371
+ job: `πŸŽ‰ CONGRATULATIONS! You've been selected for a $5000/week work from home opportunity!
372
+
373
+ No experience required! Just send $99 for training materials to get started.
374
+ Limited spots available - act within 2 hours!
375
+ Contact: jobs.opportunity@email.com
376
+ Phone: (555) 123-SCAM`,
377
+
378
+ investment: `πŸ’° Double your Bitcoin in 30 days - GUARANTEED!
379
+
380
+ Join thousands of successful investors earning $10,000+ monthly
381
+ βœ… Risk-free investment
382
+ βœ… Government approved
383
+ βœ… 200% return guaranteed
384
+
385
+ Send minimum $500 to wallet: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
386
+ Limited time offer expires TODAY!`,
387
+
388
+ lottery: `🎊 YOU HAVE WON $2,000,000 in the International Email Lottery!
389
+
390
+ Confirmation Number: UK/2024/WIN/789
391
+ Your winning email was randomly selected from 50 million addresses.
392
+
393
+ To claim your prize:
394
+ 1. Send $500 processing fee
395
+ 2. Provide bank details
396
+ 3. Copy of government ID
397
+
398
+ Contact Mrs. Sarah Johnson: claim.lottery@winner-mail.com
399
+ URGENT: Claim expires in 48 hours!`
400
+ };
401
+
402
+ function loadExample(type) {
403
+ document.getElementById('message-input').value = examples[type];
404
+ document.getElementById('url-input').value = '';
405
+ }
406
+
407
+ async function analyzeMessage() {
408
+ const messageText = document.getElementById('message-input').value.trim();
409
+ const urlText = document.getElementById('url-input').value.trim();
410
+
411
+ if (!messageText && !urlText) {
412
+ alert('Please enter a message or URL to analyze');
413
+ return;
414
+ }
415
+
416
+ // Show loading state
417
+ document.querySelector('.analyze-btn').disabled = true;
418
+ document.querySelector('.loading').style.display = 'block';
419
+ document.querySelector('.results').style.display = 'none';
420
+
421
+ try {
422
+ const response = await fetch('/analyze', {
423
+ method: 'POST',
424
+ headers: {
425
+ 'Content-Type': 'application/json',
426
+ },
427
+ body: JSON.stringify({
428
+ message: messageText,
429
+ url: urlText
430
+ })
431
+ });
432
+
433
+ const data = await response.json();
434
+
435
+ if (data.error) {
436
+ throw new Error(data.error);
437
+ }
438
+
439
+ displayResults(data);
440
+
441
+ } catch (error) {
442
+ alert('Error analyzing message: ' + error.message);
443
+ } finally {
444
+ // Hide loading state
445
+ document.querySelector('.analyze-btn').disabled = false;
446
+ document.querySelector('.loading').style.display = 'none';
447
+ }
448
+ }
449
+
450
+ function displayResults(data) {
451
+ const resultsDiv = document.getElementById('results');
452
+ const explanation = data.explanation;
453
+
454
+ const riskClass = explanation.classification.toLowerCase().replace(' ', '-');
455
+
456
+ resultsDiv.innerHTML = `
457
+ <div class="risk-indicator risk-${riskClass}">
458
+ <div class="risk-score">${explanation.risk_score}</div>
459
+ <div class="risk-classification">${explanation.classification}</div>
460
+ <div class="risk-summary">${explanation.summary}</div>
461
+ </div>
462
+
463
+ ${explanation.red_flags.length > 0 ? `
464
+ <div class="analysis-section">
465
+ <div class="section-title">
466
+ <i class="fas fa-exclamation-triangle"></i>
467
+ Red Flags Detected
468
+ </div>
469
+ <div class="red-flags">
470
+ ${explanation.red_flags.map(flag => `
471
+ <div class="flag-item">🚨 ${flag}</div>
472
+ `).join('')}
473
+ </div>
474
+ </div>
475
+ ` : ''}
476
+
477
+ <div class="analysis-section">
478
+ <div class="section-title">
479
+ <i class="fas fa-lightbulb"></i>
480
+ Recommendations
481
+ </div>
482
+ <div class="recommendations">
483
+ ${explanation.recommendations.map(rec => `
484
+ <div class="recommendation-item">${rec}</div>
485
+ `).join('')}
486
+ </div>
487
+ </div>
488
+
489
+ <div class="analysis-section">
490
+ <div class="section-title">
491
+ <i class="fas fa-flag"></i>
492
+ Report Template
493
+ </div>
494
+ <div class="report-section">
495
+ <div class="report-template" id="report-template">${explanation.report_template}</div>
496
+ <button class="copy-btn" onclick="copyReportTemplate()">
497
+ <i class="fas fa-copy"></i> Copy Report Template
498
+ </button>
499
+ </div>
500
+ </div>
501
+ `;
502
+
503
+ resultsDiv.style.display = 'block';
504
+ resultsDiv.scrollIntoView({ behavior: 'smooth' });
505
+ }
506
+
507
+ function copyReportTemplate() {
508
+ const template = document.getElementById('report-template').textContent;
509
+ navigator.clipboard.writeText(template).then(() => {
510
+ const btn = event.target.closest('.copy-btn');
511
+ const originalText = btn.innerHTML;
512
+ btn.innerHTML = '<i class="fas fa-check"></i> Copied!';
513
+ btn.style.background = '#48bb78';
514
+
515
+ setTimeout(() => {
516
+ btn.innerHTML = originalText;
517
+ btn.style.background = '#4299e1';
518
+ }, 2000);
519
+ }).catch(() => {
520
+ // Fallback for older browsers
521
+ const textArea = document.createElement('textarea');
522
+ textArea.value = template;
523
+ document.body.appendChild(textArea);
524
+ textArea.select();
525
+ document.execCommand('copy');
526
+ document.body.removeChild(textArea);
527
+ alert('Report template copied to clipboard!');
528
+ });
529
+ }
530
+
531
+ // Allow Enter key to submit in textarea (Shift+Enter for new line)
532
+ document.getElementById('message-input').addEventListener('keydown', function(event) {
533
+ if (event.key === 'Enter' && !event.shiftKey) {
534
+ event.preventDefault();
535
+ analyzeMessage();
536
+ }
537
+ });
538
+
539
+ // Auto-resize textarea
540
+ document.getElementById('message-input').addEventListener('input', function() {
541
+ this.style.height = 'auto';
542
+ this.style.height = Math.max(120, this.scrollHeight) + 'px';
543
+ });
544
+ </script>
545
+ </body>
546
+ </html>