|
1 | 1 | //! Provides a means to read, parse and hold configuration options for scans. |
2 | 2 | use clap::{Parser, ValueEnum}; |
3 | 3 | use serde_derive::Deserialize; |
4 | | -use std::collections::HashMap; |
5 | 4 | use std::fs; |
6 | 5 | use std::path::PathBuf; |
7 | 6 |
|
@@ -218,11 +217,7 @@ impl Opts { |
218 | 217 |
|
219 | 218 | // Only use top ports when the user asks for them |
220 | 219 | if self.top && config.ports.is_some() { |
221 | | - let mut ports: Vec<u16> = Vec::with_capacity(config.ports.as_ref().unwrap().len()); |
222 | | - for entry in config.ports.as_ref().unwrap().keys() { |
223 | | - ports.push(entry.parse().unwrap()); |
224 | | - } |
225 | | - self.ports = Some(ports); |
| 220 | + self.ports = config.ports.clone(); |
226 | 221 | } |
227 | 222 |
|
228 | 223 | merge_optional!(range, resolver, ulimit, exclude_ports, exclude_addresses); |
@@ -263,7 +258,7 @@ impl Default for Opts { |
263 | 258 | #[derive(Debug, Deserialize)] |
264 | 259 | pub struct Config { |
265 | 260 | addresses: Option<Vec<String>>, |
266 | | - ports: Option<HashMap<String, u16>>, |
| 261 | + ports: Option<Vec<u16>>, |
267 | 262 | range: Option<PortRange>, |
268 | 263 | greppable: Option<bool>, |
269 | 264 | accessible: Option<bool>, |
|
0 commit comments