You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance Shodan2DB: Improve database schema, optimize JSON parsing, and revamp HTML report template
- Updated database schema in shodan2db.py for better performance and integrity, including new indexes and constraints.
- Refactored JSON parsing logic to minimize memory usage and improve error handling.
- Introduced a new report template with enhanced styling and layout for better readability and user experience.
- Added support for dynamic filtering of hosts in the HTML report.
- Improved error messages and validation for file paths and database connections.
🔌 Shodan export to SQLite database and generate an HTML report.
3
+
🔌 Utility designed to parse Shodan JSON exports, store them into an optimized SQLite database, and generate comprehensive HTML vulnerability exposure reports.
4
4
5
5
## Purpose
6
6
7
-
The purpose of this tool is to parse Shodan export files and put them into a SQLite database.
7
+
The primary objective of this tool is to centralize Shodan export data into a structured SQLite environment for advanced querying and infrastructure monitoring.
8
8
9
-
Exports bypass the restriction on "**vuln**" and "**tag**" tags, which are only available with Small Business, Corporate or Enterprise accounts. These data are included present in Shodan exports.
9
+
**Account Restriction Bypass :** Shodan JSON exports natively include valuable fields like `"vulns"` and `"tags"` regardless of your tier. This tool extracts these premium attributes—normally locked behind expensive Small Business, Corporate, or Enterprise API accounts—and surfaces them directly for analysis.
10
10
11
-
Once in the database, it's easier to analyze the data and extract a list of machines with CVEs.
11
+
## Key Features
12
12
13
-
Generate a report of found CVEs with HTML template.
14
-
Customize the report in `templates/` folder using jinja2 and Bulma CSS.
13
+
-**Blazing Fast Imports:** Leverages SQLite WAL (Write-Ahead Logging) and atomic transaction batching, reducing disk I/O bottlenecks. Perfect for running on lightweight hardware.
14
+
-**Robust Exception Handling:** Implements defensive data extraction wrappers preventing common `KeyError` crashes caused by incomplete Shodan geographic metadata.
15
+
-**Dynamic HTML Indexing:** Generates responsive, elegant dashboards styled with **Bulma CSS** and **Bootstrap Icons**, complete with client-side filtering and real-time live search.
16
+
-**Strict Data Integrity:** Enforces database-level composite unique constraints (`UNIQUE(ip, cveid)`) preventing redundant storage overhead during overlapping historical imports.
15
17
16
18
## Requirements
17
19
20
+
Ensure your local execution environment satisfies the necessary dependencies:
21
+
18
22
```bash
19
23
pip install -r requirements.txt
20
24
```
21
25
22
-
## Usage and options
26
+
## Usage and Options
23
27
24
28
```bash
25
29
Usage: shodan2db.py [OPTIONS] COMMAND [ARGS]...
@@ -32,7 +36,7 @@ Commands:
32
36
parse Parse the Shodan JSON export file and store data in the database.
**Tags** and **vulns** are visible directly in the **Summary** table.
88
103
89
104
<imgsrc="img/Summary.png">
90
105
91
-
Example of report :
106
+
## Database Architecture
92
107
93
-
<imgsrc="img/report.png">
108
+
Upon initialization, the tool optimizes SQLite pragmas and automatically structures the underlying relational objects:
94
109
95
-
## Templates
110
+
-**`services`**: Houses core operational network service logs, banners, geo-coordinates, ISP allocations, and metadata.
111
+
-**`vulnerabilities`**: Stores indexed granular mappings of CVE IDs alongside their verified CVSS scores and threat summary descriptions.
112
+
-**`Summary` (View)**: An internal prioritized virtual evaluation layer sorting network entities by physical exposure risk (`nbvulns DESC`).
96
113
97
-
Customize the report template in [templates/report.html](templates/report.html)
114
+
## Templates Customization
98
115
99
-
The current one uses [Bulma CSS](https://bulma.io/).
116
+
The presentation architecture is entirely modular. You can seamlessly customize the structural layout or interface themes inside `templates/report.html`.
117
+
118
+
The default layout leverages **Bulma CSS** to render high-contrast, professional cybersecurity matrices with custom conditional coloring for CVSS threat scales.
100
119
101
120
## Development
102
121
103
-
Use Shodan2DBas python class
122
+
You can import `Shodan2DB` directly into third-party automated playbooks or continuous integration loops as a native Python class:
0 commit comments