-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_pdf.py
More file actions
787 lines (709 loc) · 25.6 KB
/
Copy pathgenerate_pdf.py
File metadata and controls
787 lines (709 loc) · 25.6 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
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
import os
import re
import markdown
from xhtml2pdf import pisa
def clean_for_pdf(text):
"""Replaces Unicode special characters with standard WinAnsi / Latin-1 compatible representations."""
replacements = {
'—': ' - ',
'–': '-',
'’': "'",
'‘': "'",
'“': '"',
'”': '"',
'…': '...',
'🛡️': '[VULNSCAN]',
'📑': '[INDEX]',
'🔌': '[PORT SCAN]',
'🌐': '[DNS ENUM]',
'📋': '[WHOIS]',
'🔒': '[SSL/TLS]',
'💻': '[TECH DETECT]',
'🌍': '[SUBDOMAINS]',
'🔴': '<span class="badge badge-critical">CRITICAL</span>',
'🟠': '<span class="badge badge-high">HIGH</span>',
'🟡': '<span class="badge badge-medium">MEDIUM</span>',
'🔵': '<span class="badge badge-low">LOW</span>',
'⚪': '<span class="badge badge-info">INFO</span>',
'✅': '<span style="color:#059669; font-weight:bold;">[PASSED]</span>',
'❌': '<span style="color:#dc2626; font-weight:bold;">[MISSING]</span>',
'⚠️': '<span style="color:#d97706; font-weight:bold;">[WARNING]</span>',
'➔': ' -> ',
'•': '•',
}
for orig, rep in replacements.items():
text = text.replace(orig, rep)
return text
def convert_mindmap_to_html():
return """<div class="diagram-card">
<div class="diagram-header"><strong>CORE ARCHITECTURAL PILLARS & VISION</strong></div>
<table class="pillar-table">
<tr>
<td class="pillar-cell" style="width: 25%;">
<div class="pillar-title">1. Privacy First</div>
<ul class="pillar-list">
<li>100% Local Inference</li>
<li>Zero Cloud Leakage</li>
<li>Ollama Llama-3.2 Native</li>
</ul>
</td>
<td class="pillar-cell" style="width: 25%;">
<div class="pillar-title">2. Automated Recon</div>
<ul class="pillar-list">
<li>27 Port TCP Scanner</li>
<li>Multi-Record DNS Enum</li>
<li>WHOIS & SSL/TLS Expiry</li>
<li>OWASP Security Headers</li>
<li>40+ Subdomain Probing</li>
</ul>
</td>
<td class="pillar-cell" style="width: 25%;">
<div class="pillar-title">3. AI Guardrails</div>
<ul class="pillar-list">
<li>Strict JSON Schema</li>
<li>Evidence Grounded</li>
<li>CVSS & CVE Mapping</li>
<li>Remediation Guidance</li>
</ul>
</td>
<td class="pillar-cell" style="width: 25%;">
<div class="pillar-title">4. User Experience</div>
<ul class="pillar-list">
<li>Glassmorphism Dark UI</li>
<li>Interactive AI Tutor</li>
<li>NDJSON Live Streaming</li>
<li>Print-Ready PDF Reports</li>
</ul>
</td>
</tr>
</table>
</div>"""
def convert_flowchart_to_html():
return """<div class="diagram-card">
<div class="diagram-header"><strong>SYSTEM ARCHITECTURE & DATA FLOW TOPOLOGY</strong></div>
<table class="flow-table">
<tr>
<td class="flow-box" style="width: 30%;">
<div class="flow-box-title">LAYER 1: CLIENT BROWSER</div>
<div class="flow-box-desc">
- Cyberpunk Glassmorphism UI<br/>
- Real-Time NDJSON Parser<br/>
- Interactive Chat Tutor Modal<br/>
- Report PDF Export Generator
</div>
</td>
<td class="flow-arrow" style="width: 5%;">-></td>
<td class="flow-box" style="width: 30%;">
<div class="flow-box-title">LAYER 2: FASTAPI BACKEND</div>
<div class="flow-box-desc">
- Asynchronous API Gateway<br/>
- 8-Module Reconnaissance Engine<br/>
- Token Compactor & Normalizer<br/>
- Pydantic Schema Validator
</div>
</td>
<td class="flow-arrow" style="width: 5%;">-></td>
<td class="flow-box" style="width: 30%;">
<div class="flow-box-title">LAYER 3: LOCAL AI ENGINE</div>
<div class="flow-box-desc">
- Ollama Daemon (Port 11434)<br/>
- Model: llama3.2:latest<br/>
- Zero-Cloud Network Egress<br/>
- Deterministic JSON Output
</div>
</td>
</tr>
</table>
</div>"""
def convert_sequence_to_html():
return """<div class="diagram-card">
<div class="diagram-header"><strong>END-TO-END EXECUTION LIFECYCLE SEQUENCE</strong></div>
<table class="data-table" style="margin: 0;">
<thead>
<tr>
<th style="width: 8%;">Step</th>
<th style="width: 26%;">Origin -> Destination</th>
<th style="width: 38%;">Action / Payload</th>
<th style="width: 28%;">Security Context</th>
</tr>
</thead>
<tbody>
<tr><td><strong>01</strong></td><td>Analyst -> Frontend</td><td>Input Target Domain (e.g. <code>example.com</code>)</td><td>User initiates external reconnaissance</td></tr>
<tr><td><strong>02</strong></td><td>Frontend -> FastAPI</td><td><code>POST /api/recon</code></td><td>Asynchronous target dispatch</td></tr>
<tr><td><strong>03</strong></td><td>FastAPI -> Target Network</td><td>Parallel TCP Probing, DNS, SSL, Headers, WHOIS</td><td>Non-destructive defensive scanning</td></tr>
<tr><td><strong>04</strong></td><td>FastAPI -> Frontend</td><td>Full Recon JSON Payload (200 OK)</td><td>Visual module cards rendered</td></tr>
<tr><td><strong>05</strong></td><td>Frontend -> FastAPI</td><td><code>POST /api/analyze</code></td><td>Token compaction (< 1,500 tokens)</td></tr>
<tr><td><strong>06</strong></td><td>FastAPI -> Ollama</td><td>Structured Prompt + JSON Schema Contract</td><td>Local CPU/GPU inference execution</td></tr>
<tr><td><strong>07</strong></td><td>FastAPI -> Frontend</td><td>NDJSON Progress Stream (15% -> 50% -> 100%)</td><td>Live streaming UI state update</td></tr>
<tr><td><strong>08</strong></td><td>Frontend</td><td>Render Findings Matrix & PDF Report</td><td>Actionable remediation formulated</td></tr>
</tbody>
</table>
</div>"""
def convert_threat_to_html():
return """<div class="diagram-card">
<div class="diagram-header"><strong>APPLICATION THREAT MODEL & TRUST BOUNDARIES</strong></div>
<table class="data-table" style="margin: 0;">
<thead>
<tr>
<th style="width: 22%;">Threat Vector</th>
<th style="width: 28%;">Potential Risk</th>
<th style="width: 25%;">Target Component</th>
<th style="width: 25%;">Mitigating Security Control</th>
</tr>
</thead>
<tbody>
<tr><td><strong>SSRF Injection</strong></td><td>Probing internal loopbacks or AWS metadata</td><td>Recon Socket & DNS Engine</td><td>Strict hostname URI parsing & protocol filter</td></tr>
<tr><td><strong>Prompt Injection</strong></td><td>Manipulating LLM output via crafted banners</td><td>Ollama Inference Worker</td><td>Fixed JSON Schema & Evidence Grounding</td></tr>
<tr><td><strong>LLM Context DoS</strong></td><td>Huge banner payloads causing OOM / Hang</td><td>Token Compactor</td><td><code>MAX_RECON_CHARS = 12000</code> Buffer Capping</td></tr>
<tr><td><strong>Data Exfiltration</strong></td><td>Target recon telemetry leaking to 3rd parties</td><td>Network Perimeter</td><td>100% Offline Local Ollama Binding</td></tr>
<tr><td><strong>XSS in Reports</strong></td><td>Malicious script execution via target headers</td><td>Browser Frontend</td><td>Escaped DOM text rendering & strict sanitization</td></tr>
</tbody>
</table>
</div>"""
def convert_gantt_to_html():
return """<div class="diagram-card">
<div class="diagram-header"><strong>DEVELOPMENT ROADMAP & MILESTONES</strong></div>
<table class="data-table" style="margin: 0;">
<thead>
<tr>
<th style="width: 16%;">Phase / Quarter</th>
<th style="width: 36%;">Deliverable Milestone</th>
<th style="width: 26%;">Core Focus Area</th>
<th style="width: 22%;">Status</th>
</tr>
</thead>
<tbody>
<tr><td><strong>2026 - Q3</strong></td><td>Active Subprocess Nuclei Template Integration</td><td>Core Scanner Engine</td><td><span class="badge badge-high">IN PROGRESS</span></td></tr>
<tr><td><strong>2026 - Q3</strong></td><td>CVE Live Database NVD API Synchronization</td><td>Vulnerability Intelligence</td><td><span class="badge badge-low">PLANNED</span></td></tr>
<tr><td><strong>2026 - Q4</strong></td><td>Model Switcher UI (Mistral 7B / Qwen 2.5)</td><td>AI Intelligence Layer</td><td><span class="badge badge-low">PLANNED</span></td></tr>
<tr><td><strong>2026 - Q4</strong></td><td>Automated Bash/Ansible Remediation Scripts</td><td>Automation & Fixes</td><td><span class="badge badge-low">PLANNED</span></td></tr>
<tr><td><strong>2027 - Q1</strong></td><td>Multi-Scan SQLite / PostgreSQL Database</td><td>Enterprise Architecture</td><td><span class="badge badge-info">PROPOSED</span></td></tr>
<tr><td><strong>2027 - Q1</strong></td><td>Automated Server-Side PDF Export Engine</td><td>Reporting Infrastructure</td><td><span class="badge badge-info">COMPLETED</span></td></tr>
<tr><td><strong>2027 - Q2</strong></td><td>Webhook Alerting (Discord / Slack / Telegram)</td><td>Integrations & SIEM</td><td><span class="badge badge-info">PROPOSED</span></td></tr>
</tbody>
</table>
</div>"""
def build_pdf(md_file="PROJECT_REPORT.md", pdf_file="VULNSCAN_Project_Report.pdf"):
if not os.path.exists(md_file):
print(f"Error: {md_file} does not exist.")
return False
with open(md_file, "r", encoding="utf-8") as f:
raw_text = f.read()
# Isolate main body starting cleanly from Section 1 (Executive Summary)
exec_idx = raw_text.find("## 1. Executive Summary")
if exec_idx != -1:
md_body = raw_text[exec_idx:]
else:
md_body = raw_text
# Clean characters
md_body = clean_for_pdf(md_body)
# Extract Mermaid diagrams and replace with non-markdown token placeholders
diagram_replacements = {}
diagram_counter = 0
def extract_mermaid(match):
nonlocal diagram_counter
placeholder = f"XMERMAIDDIAG{diagram_counter}X"
content = match.group(1).strip()
if content.startswith('mindmap'):
diagram_replacements[placeholder] = convert_mindmap_to_html()
elif content.startswith('flowchart'):
diagram_replacements[placeholder] = convert_flowchart_to_html()
elif content.startswith('sequenceDiagram'):
diagram_replacements[placeholder] = convert_sequence_to_html()
elif content.startswith('graph'):
diagram_replacements[placeholder] = convert_threat_to_html()
elif content.startswith('gantt'):
diagram_replacements[placeholder] = convert_gantt_to_html()
else:
diagram_replacements[placeholder] = f'<div class="diagram-card"><pre class="diagram-code">{content}</pre></div>'
diagram_counter += 1
return f"\n\n{placeholder}\n\n"
md_body = re.sub(r'```mermaid(.*?)```', extract_mermaid, md_body, flags=re.DOTALL)
# Convert markdown to html
html_content = markdown.markdown(md_body, extensions=['tables', 'fenced_code'])
# Re-insert diagram components into HTML
for placeholder, diag_html in diagram_replacements.items():
html_content = html_content.replace(f"<p>{placeholder}</p>", diag_html)
html_content = html_content.replace(placeholder, diag_html)
# Format screenshots
cwd = os.getcwd().replace("\\", "/")
html_content = re.sub(
r'<img([^>]+)src="screenshots/([^"]+)"([^>]*)>',
rf'<div class="screenshot-box"><img src="{cwd}/screenshots/\2" style="width: 440pt; height: auto;" /><div class="screenshot-label">System Visual Proof: \2</div></div>',
html_content
)
html_doc = f"""<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>VULNSCAN Technical Architecture Report</title>
<style>
@page cover_page {{
size: a4 portrait;
margin: 1.5cm;
@frame content_frame {{
left: 1.5cm; right: 1.5cm; top: 1.5cm; bottom: 1.5cm;
}}
}}
@page main_page {{
size: a4 portrait;
margin: 2.0cm 1.5cm 1.8cm 1.5cm;
@frame header_frame {{
-pdf-frame-content: page_header;
left: 1.5cm; right: 1.5cm; top: 0.8cm; height: 1cm;
}}
@frame content_frame {{
left: 1.5cm; right: 1.5cm; top: 1.9cm; bottom: 1.8cm;
}}
@frame footer_frame {{
-pdf-frame-content: page_footer;
left: 1.5cm; right: 1.5cm; bottom: 0.7cm; height: 1cm;
}}
}}
.cover-container {{
page: cover_page;
page-break-after: always;
}}
.main-body {{
page: main_page;
}}
body {{
font-family: Helvetica, Arial, sans-serif;
color: #1e293b;
font-size: 8.5pt;
line-height: 1.4;
}}
.header-content {{
font-size: 7pt;
color: #64748b;
border-bottom: 1px solid #cbd5e1;
padding-bottom: 3px;
font-family: Helvetica, Arial, sans-serif;
}}
.footer-content {{
font-size: 7pt;
color: #94a3b8;
border-top: 1px solid #e2e8f0;
padding-top: 3px;
font-family: Helvetica, Arial, sans-serif;
}}
/* ── Cover Page Elements ── */
.cover-hero {{
background-color: #0f172a;
color: #ffffff;
padding: 22pt 18pt;
border-radius: 6pt;
margin-bottom: 16pt;
border-left: 6pt solid #38bdf8;
}}
.cover-tag {{
color: #38bdf8;
font-size: 7.5pt;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1.5px;
margin-bottom: 5pt;
}}
.cover-title {{
font-size: 20pt;
font-weight: bold;
color: #ffffff;
line-height: 1.2;
margin-bottom: 5pt;
}}
.cover-subtitle {{
font-size: 10pt;
color: #94a3b8;
line-height: 1.35;
}}
.meta-box {{
border: 1px solid #cbd5e1;
border-radius: 4pt;
padding: 10pt 14pt;
background-color: #f8fafc;
margin-bottom: 14pt;
}}
.meta-table {{
width: 100%;
border-collapse: collapse;
}}
.meta-table td {{
border: none;
padding: 3.5pt 5pt;
font-size: 8pt;
vertical-align: top;
}}
.meta-table td strong {{
color: #0f172a;
}}
.abstract-box {{
background-color: #f0f9ff;
border: 1px solid #bae6fd;
border-left: 4pt solid #0284c7;
padding: 10pt 12pt;
border-radius: 4pt;
font-size: 8pt;
line-height: 1.45;
color: #0369a1;
margin-bottom: 14pt;
}}
.toc-box {{
border: 1px solid #cbd5e1;
border-radius: 4pt;
background-color: #ffffff;
padding: 8pt 12pt;
}}
.toc-title {{
font-size: 9pt;
font-weight: bold;
color: #0f172a;
margin-bottom: 5pt;
text-transform: uppercase;
letter-spacing: 1px;
}}
.toc-table {{
width: 100%;
border-collapse: collapse;
}}
.toc-table td {{
border: none;
padding: 2.5pt 0;
font-size: 7.8pt;
color: #334155;
}}
/* ── Content Headings ── */
h1 {{
color: #0f172a;
font-size: 13.5pt;
font-weight: bold;
border-bottom: 2px solid #0284c7;
padding-bottom: 3pt;
margin-top: 14pt;
margin-bottom: 6pt;
page-break-after: avoid;
-pdf-keep-with-next: true;
}}
h2 {{
color: #0369a1;
font-size: 10.5pt;
font-weight: bold;
border-bottom: 1px solid #e2e8f0;
padding-bottom: 2pt;
margin-top: 12pt;
margin-bottom: 5pt;
page-break-after: avoid;
-pdf-keep-with-next: true;
}}
h3 {{
color: #334155;
font-size: 9pt;
font-weight: bold;
margin-top: 9pt;
margin-bottom: 3pt;
page-break-after: avoid;
-pdf-keep-with-next: true;
}}
p {{
margin-bottom: 5pt;
text-align: justify;
}}
ul, ol {{
margin-top: 2pt;
margin-bottom: 5pt;
padding-left: 14pt;
}}
li {{
margin-bottom: 1.5pt;
}}
table {{
width: 100%;
border-collapse: collapse;
margin: 6pt 0 8pt 0;
font-size: 7.5pt;
page-break-inside: avoid;
}}
th, td {{
border: 1px solid #cbd5e1;
padding: 4pt 5pt;
text-align: left;
vertical-align: top;
}}
th {{
background-color: #0f172a;
color: #ffffff;
font-weight: bold;
font-size: 7.2pt;
text-transform: uppercase;
-pdf-keep-with-next: true;
}}
tr:nth-child(even) td {{
background-color: #f8fafc;
}}
pre, code {{
font-family: Courier, monospace;
font-size: 7pt;
}}
code {{
background-color: #f1f5f9;
color: #0f172a;
padding: 1pt 3pt;
border-radius: 2pt;
}}
pre {{
background-color: #0f172a;
color: #f8fafc;
border-radius: 4pt;
padding: 6pt 8pt;
margin: 6pt 0;
line-height: 1.3;
page-break-inside: avoid;
}}
blockquote {{
border-left: 3pt solid #0284c7;
background-color: #f0f9ff;
padding: 5pt 8pt;
margin: 6pt 0;
color: #0369a1;
font-style: italic;
page-break-inside: avoid;
}}
hr {{
border: none;
border-top: 1px solid #e2e8f0;
margin: 8pt 0;
}}
.badge {{
display: inline-block;
padding: 1.5pt 4pt;
border-radius: 2pt;
font-size: 6pt;
font-weight: bold;
text-transform: uppercase;
font-family: Helvetica, Arial, sans-serif;
}}
.badge-critical {{ background-color: #fee2e2; color: #dc2626; border: 1px solid #f87171; }}
.badge-high {{ background-color: #fef3c7; color: #d97706; border: 1px solid #fbbf24; }}
.badge-medium {{ background-color: #ffedd5; color: #ea580c; border: 1px solid #fb923c; }}
.badge-low {{ background-color: #e0f2fe; color: #0284c7; border: 1px solid #38bdf8; }}
.badge-info {{ background-color: #f1f5f9; color: #475569; border: 1px solid #94a3b8; }}
/* ── Diagram Card Components ── */
.diagram-card {{
background-color: #ffffff;
border: 1px solid #cbd5e1;
border-radius: 4pt;
margin: 8pt 0;
page-break-inside: avoid;
}}
.diagram-header {{
background-color: #0f172a;
color: #38bdf8;
padding: 4pt 7pt;
font-size: 7.2pt;
font-weight: bold;
letter-spacing: 0.5px;
}}
.pillar-table, .flow-table {{
width: 100%;
border: none;
margin: 0;
}}
.pillar-cell {{
border: 1px solid #e2e8f0;
padding: 5pt;
vertical-align: top;
background-color: #f8fafc;
}}
.pillar-title {{
font-size: 7.2pt;
font-weight: bold;
color: #0284c7;
margin-bottom: 3pt;
border-bottom: 1px solid #cbd5e1;
padding-bottom: 1.5pt;
}}
.pillar-list {{
margin: 0;
padding-left: 9pt;
font-size: 6.8pt;
color: #334155;
}}
.pillar-list li {{
margin-bottom: 1.5pt;
}}
.flow-box {{
background-color: #f8fafc;
border: 1px solid #cbd5e1;
padding: 5pt;
vertical-align: top;
}}
.flow-box-title {{
font-size: 7.2pt;
font-weight: bold;
color: #0284c7;
margin-bottom: 2pt;
}}
.flow-box-desc {{
font-size: 6.8pt;
color: #475569;
line-height: 1.3;
}}
.flow-arrow {{
text-align: center;
vertical-align: middle;
font-size: 10pt;
color: #0284c7;
font-weight: bold;
border: none;
}}
.screenshot-box {{
margin: 8pt 0;
text-align: center;
border: 1px solid #cbd5e1;
background-color: #ffffff;
padding: 5pt;
border-radius: 4pt;
page-break-inside: avoid;
}}
.screenshot-label {{
font-size: 7pt;
color: #64748b;
font-style: italic;
margin-top: 3pt;
}}
.signoff-box {{
margin-top: 14pt;
border-top: 1.5px solid #cbd5e1;
padding-top: 8pt;
page-break-inside: avoid;
}}
</style>
</head>
<body>
<!-- Running Header (Pages 2+) -->
<div id="page_header" class="header-content">
<table style="width: 100%; border: none; margin: 0;">
<tr>
<td style="text-align: left; border: none; padding: 0; font-weight: bold; color: #0284c7;">
[VULNSCAN] - Technical Architecture & Security Report
</td>
<td style="text-align: right; border: none; padding: 0; color: #64748b;">
CONFIDENTIAL | SOC & BLUE TEAM
</td>
</tr>
</table>
</div>
<!-- Running Footer (Pages 2+) -->
<div id="page_footer" class="footer-content">
<table style="width: 100%; border: none; margin: 0;">
<tr>
<td style="text-align: left; border: none; padding: 0;">
VULNSCAN AI Platform • Author: Natto Muni Chakma (MRNATTO)
</td>
<td style="text-align: right; border: none; padding: 0; font-weight: bold;">
Page <pdf:pagenumber> of <pdf:pagecount>
</td>
</tr>
</table>
</div>
<!-- ═══ COVER PAGE ═══ -->
<div class="cover-container">
<div class="cover-hero">
<div class="cover-tag">DEFENSIVE CYBERSECURITY & RECONNAISSANCE PLATFORM</div>
<div class="cover-title">VULNSCAN: AI-Assisted Vulnerability Scanner</div>
<div class="cover-subtitle">Comprehensive Technical Project & Security Architecture Report</div>
</div>
<div class="meta-box">
<table class="meta-table">
<tr>
<td style="width: 25%;"><strong>Primary Author:</strong></td>
<td style="width: 35%;">Natto Muni Chakma (MRNATTO)</td>
<td style="width: 20%;"><strong>Document Version:</strong></td>
<td style="width: 20%;">1.0.0 (Release)</td>
</tr>
<tr>
<td><strong>Role / Specialization:</strong></td>
<td>Security Analyst / SOC & Blue Team</td>
<td><strong>Document Date:</strong></td>
<td>August 2026</td>
</tr>
<tr>
<td><strong>Repository:</strong></td>
<td>github.com/NATTOMR/AI-Assisted-Vulnerability-Scanner</td>
<td><strong>Classification:</strong></td>
<td><span class="badge badge-high">RESTRICTED // INTERNAL</span></td>
</tr>
<tr>
<td><strong>AI Engine:</strong></td>
<td>Ollama Llama-3.2 (100% Local Inference)</td>
<td><strong>Web Framework:</strong></td>
<td>FastAPI + Modern Vanilla JS</td>
</tr>
</table>
</div>
<div class="abstract-box">
<strong>EXECUTIVE ABSTRACT:</strong><br/>
This document delivers an in-depth architectural and operational breakdown of <strong>VULNSCAN</strong>, an enterprise-grade, privacy-first cybersecurity reconnaissance and vulnerability assessment platform. By coupling an automated 8-module external reconnaissance engine with local, zero-leakage Large Language Model (LLM) inference, VULNSCAN enables security operators and student analysts to enumerate target attack surfaces, evaluate potential vulnerabilities, and generate standardized compliance reports without transmitting sensitive infrastructure details to third-party cloud AI vendors.
</div>
<div class="toc-box">
<div class="toc-title">Table of Contents Overview</div>
<table class="toc-table">
<tr>
<td style="width: 50%;">1. Executive Summary</td>
<td style="width: 50%;">7. System Screenshots & Visual Proofs</td>
</tr>
<tr>
<td>2. Project Vision & Objectives</td>
<td>8. Threat Modeling & Security Posture</td>
</tr>
<tr>
<td>3. System Architecture & Data Flow</td>
<td>9. Performance & Engineering Challenges</td>
</tr>
<tr>
<td>4. Passive & Active Reconnaissance Engine</td>
<td>10. Future Roadmap & Enhancement Milestones</td>
</tr>
<tr>
<td>5. Local AI Vulnerability Analysis Engine</td>
<td>11. Conclusion</td>
</tr>
<tr>
<td>6. User Interface & Dashboard Experience</td>
<td></td>
</tr>
</table>
</div>
</div>
<!-- ═══ MAIN REPORT BODY ═══ -->
<div class="main-body">
{html_content}
<!-- Sign-off Section -->
<div class="signoff-box">
<table style="width: 100%; border: none; margin: 0;">
<tr>
<td style="width: 50%; border: none; padding: 0;">
<strong>Document Prepared By:</strong><br/>
Natto Muni Chakma (MRNATTO)<br/>
<em>Security Analyst & Core Maintainer</em>
</td>
<td style="width: 50%; border: none; padding: 0; text-align: right;">
<strong>Status:</strong> APPROVED & VERIFIED<br/>
<em>VULNSCAN Security Systems Group</em>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>"""
with open(pdf_file, "wb") as f:
pisa_status = pisa.CreatePDF(html_doc, dest=f)
if pisa_status.err:
print(f"Error creating PDF: {pisa_status.err}")
return False
else:
size_kb = os.path.getsize(pdf_file) / 1024
print(f"SUCCESS: {pdf_file} generated! Size: {size_kb:.1f} KB")
return True
if __name__ == "__main__":
build_pdf()