Browse Source

Update 'README.md'

Jose E. Rodriguez 1 month ago
parent
commit
47f9a67676
1 changed files with 223 additions and 0 deletions
  1. 223
    0
      README.md

+ 223
- 0
README.md View File

@@ -1,2 +1,225 @@
1 1
 # Network_Scanner_Low_cost
2 2
 
3
+
4
+This project automates network discovery, port scanning, target creation, task management, and report generation using OpenVAS and Python scripts. It also includes a web application for visualizing reports and provides instructions for accessing OpenVAS via the web interface and API.
5
+
6
+---
7
+
8
+## **Prerequisites**
9
+
10
+### **1. Install Dependencies**
11
+
12
+#### **Required Software**
13
+- **Nmap**: A network discovery and scanning tool.
14
+  ```bash
15
+  sudo apt install nmap  # For Ubuntu/Debian
16
+  brew install nmap      # For MacOS
17
+  ```
18
+- **Docker**: Used to run OpenVAS as a containerized service.
19
+  - Install Docker: [Docker Installation Guide](https://docs.docker.com/get-docker/)
20
+  - Install Docker Compose:
21
+    ```bash
22
+    sudo apt install docker-compose  # Ubuntu/Debian
23
+    brew install docker-compose      # MacOS
24
+    ```
25
+
26
+#### **Python Libraries**
27
+Install the required Python libraries:
28
+```bash
29
+pip install pandas dash plotly gvm-tools psutil nmap
30
+```
31
+
32
+---
33
+
34
+## **Project Setup**
35
+
36
+### **1. Setup OpenVAS with Docker**
37
+1. Navigate to the `docker` directory:
38
+   ```bash
39
+   cd docker
40
+   ```
41
+2. Build the OpenVAS Docker container:
42
+   ```bash
43
+   docker compose build
44
+   ```
45
+3. Start the OpenVAS container:
46
+   ```bash
47
+   docker compose up -d
48
+   ```
49
+4. **Wait 30 minutes** for OpenVAS to complete its database setup and updates.
50
+
51
+### **Accessing OpenVAS**
52
+
53
+#### **Web Interface**
54
+1. Open a browser and go to `https://localhost:9392` (or replace `localhost` with your server's IP address).
55
+2. Log in using the default credentials:
56
+   - Username: `admin`
57
+   - Password: `admin` (or the password you set during installation).
58
+
59
+#### **Using the OpenVAS API**
60
+1. The OpenVAS API listens on port `9390` (default).
61
+2. Use tools like `gvm-cli` or Python's `gvm-tools` library to interact with the API.
62
+
63
+
64
+## **Scripts Workflow**
65
+
66
+Run the scripts in the following order:
67
+
68
+### **Step 1: Network Discovery**
69
+Run `networkdiscovery.py` to identify active hosts on the network:
70
+```bash
71
+sudo python networkdiscovery.py
72
+```
73
+This script:
74
+- Uses Nmap to discover active hosts in your local network.
75
+- Generates a CSV file named `active_hosts.csv` containing the discovered hosts.
76
+
77
+---
78
+
79
+### **Step 2: Port Scanning**
80
+Run `portscanner.py` to scan open ports on the discovered hosts:
81
+```bash
82
+sudo python portscanner.py
83
+```
84
+This script:
85
+- Reads the `active_hosts.csv` file.
86
+- Scans the specified ports for each host.
87
+- Outputs results in `ports.csv`.
88
+
89
+---
90
+
91
+### **Step 3: Create Targets in OpenVAS**
92
+Run `createtargets.py` to create OpenVAS targets for each active host:
93
+```bash
94
+python createtargets.py
95
+```
96
+This script:
97
+- Reads the `active_hosts.csv` file.
98
+- Creates targets in OpenVAS for each discovered host.
99
+- Outputs target IDs in `target_id.csv`.
100
+
101
+---
102
+
103
+### **Step 4: Create Tasks in OpenVAS**
104
+Run `taskmaker.py` to create OpenVAS tasks for each target:
105
+```bash
106
+python taskmaker.py
107
+```
108
+This script:
109
+- Reads `target_id.csv`.
110
+- Creates OpenVAS tasks using the "Full and Fast" scan configuration.
111
+- Outputs task IDs in `task_id.csv`.
112
+
113
+---
114
+
115
+### **Step 5: Start Tasks in OpenVAS**
116
+Run `starttask.py` to start all the created OpenVAS tasks:
117
+```bash
118
+python starttask.py
119
+```
120
+This script:
121
+- Reads `task_id.csv`.
122
+- Starts each task in OpenVAS.
123
+
124
+---
125
+
126
+### **Step 6: Generate Reports**
127
+Run `getreports.py` to check task statuses and generate reports:
128
+```bash
129
+python getreports.py
130
+```
131
+This script:
132
+- Checks the status of each task in `task_id.csv`.
133
+- If a task is completed, generates a CSV report for the task.
134
+- Combines all reports into a single consolidated file: `consolidated_reports.csv`.
135
+
136
+---
137
+
138
+### **Step 7: Launch the Web Application**
139
+Run `webapp.py` to launch the web interface for visualizing reports:
140
+```bash
141
+python webapp.py
142
+```
143
+This script:
144
+- Starts a Dash web application.
145
+- Access the web application at `http://127.0.0.1:8050` or replace `127.0.0.1` with your server's IP address.
146
+- Visualize, filter, and analyze vulnerability data interactively.
147
+
148
+---
149
+
150
+## **File Outputs**
151
+
152
+### **Generated Files**
153
+1. **`active_hosts.csv`**:
154
+   - Hosts discovered by `networkdiscovery.py`.
155
+   - Format:
156
+     ```csv
157
+     IP,Discovery Timestamp
158
+     192.168.0.1,2024-11-20 15:16:09
159
+     ```
160
+
161
+2. **`ports.csv`**:
162
+   - Open ports discovered by `portscanner.py`.
163
+   - Format:
164
+     ```csv
165
+     IP,Port,Service
166
+     192.168.0.1,80,HTTP
167
+     ```
168
+
169
+3. **`target_id.csv`**:
170
+   - Target IDs created by `createtargets.py`.
171
+   - Format:
172
+     ```csv
173
+     IP,Target ID
174
+     192.168.0.1,abc123
175
+     ```
176
+
177
+4. **`task_id.csv`**:
178
+   - Task IDs created by `taskmaker.py`.
179
+   - Format:
180
+     ```csv
181
+     Target ID,Task ID
182
+     abc123,task001
183
+     ```
184
+
185
+5. **`task_reports.csv`**:
186
+   - Reports generated by `getreports.py`.
187
+   - Format:
188
+     ```csv
189
+     Task ID,Report File
190
+     task001,report_task001.csv
191
+     ```
192
+
193
+6. **`consolidated_reports.csv`**:
194
+   - Combined report generated by `getreports.py`.
195
+   - Format:
196
+     ```csv
197
+     Task ID,Host,Port,Vulnerability,Severity
198
+     task001,192.168.0.1,80,Example Vulnerability,High
199
+     ```
200
+
201
+---
202
+
203
+## **Usage Notes**
204
+- The OpenVAS database setup might take up to **30 minutes** after starting the Docker container.
205
+- Ensure `task_id.csv` exists before running `starttask.py`.
206
+- The `getreports.py` script might take time to execute, depending on the number of tasks and their completion status.
207
+
208
+---
209
+
210
+## **Troubleshooting**
211
+
212
+### **Docker Issues**
213
+- If OpenVAS doesn't start correctly, check Docker logs:
214
+  ```bash
215
+  docker logs <container_name>
216
+  ```
217
+
218
+### **OpenVAS Login Issues**
219
+- Ensure OpenVAS is running and accessible on port `9392`.
220
+
221
+### **Network Discovery Errors**
222
+- Ensure you have the necessary permissions to run Nmap with `sudo`.
223
+
224
+---
225
+