Skip to content

Commit 743fa1c

Browse files
committedSep 7, 2020
Introduce the -no-nmap option
As the name implies this will allow RustScan to to run the scan without starting an nmap scan with ports that are found.
1 parent 87de96c commit 743fa1c

File tree

3 files changed

+48
-29
lines changed

3 files changed

+48
-29
lines changed
 

‎CODE_OF_CONDUCT.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at brandon@skerritt.blog. All
58+
reported by contacting the project team at our discord via a private message to any of the owners. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.
@@ -67,10 +67,10 @@ members of the project's leadership.
6767

6868
## Attribution
6969

70-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
70+
This Code of Conduct is adapted from the Contributor Covenant homepage, version 1.4,
7171
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
7272

73-
[homepage]: https://www.contributor-covenant.org
73+
homepage: https://www.contributor-covenant.org
7474

7575
For answers to common questions about this code of conduct, see
7676
https://www.contributor-covenant.org/faq

‎src/input.rs

+16-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct Opts {
6868

6969
/// Whether to ignore the configuration file or not.
7070
#[structopt(short, long)]
71-
pub ignore_config: bool,
71+
pub no_config: bool,
7272

7373
/// Quiet mode. Only output the ports. No Nmap. Useful for grep or outputting to a file.
7474
#[structopt(short, long)]
@@ -78,6 +78,10 @@ pub struct Opts {
7878
#[structopt(long)]
7979
pub accessible: bool,
8080

81+
/// Turns off Nmap.
82+
#[structopt(long)]
83+
pub no_nmap: bool,
84+
8185
/// The batch size for port scanning, it increases or slows the speed of
8286
/// scanning. Depends on the open file limit of your OS. If you do 65535
8387
/// it will do every port at the same time. Although, your OS may not
@@ -125,7 +129,7 @@ impl Opts {
125129
/// Reads the command line arguments into an Opts struct and merge
126130
/// values found within the user configuration file.
127131
pub fn merge(&mut self, config: &Config) {
128-
if !self.ignore_config {
132+
if !self.no_config {
129133
self.merge_required(&config);
130134
self.merge_optional(&config);
131135
}
@@ -180,6 +184,7 @@ pub struct Config {
180184
accessible: Option<bool>,
181185
batch_size: Option<u16>,
182186
timeout: Option<u32>,
187+
no_nmap: Option<bool>,
183188
ulimit: Option<rlimit::rlim>,
184189
scan_order: Option<ScanOrder>,
185190
command: Option<Vec<String>>,
@@ -241,8 +246,9 @@ mod tests {
241246
ulimit: None,
242247
command: vec![],
243248
accessible: false,
249+
no_nmap: false,
244250
scan_order: ScanOrder::Serial,
245-
ignore_config: true,
251+
no_config: true,
246252
};
247253

248254
let config = Config {
@@ -253,6 +259,7 @@ mod tests {
253259
batch_size: Some(25_000),
254260
timeout: Some(1_000),
255261
ulimit: None,
262+
no_nmap: Some(false),
256263
command: Some(vec!["-A".to_owned()]),
257264
accessible: Some(true),
258265
scan_order: Some(ScanOrder::Random),
@@ -281,12 +288,14 @@ mod tests {
281288
command: vec![],
282289
accessible: false,
283290
scan_order: ScanOrder::Serial,
284-
ignore_config: false,
291+
no_nmap: false,
292+
no_config: false,
285293
};
286294

287295
let config = Config {
288296
ips_or_hosts: Some(vec!["127.0.0.1".to_owned()]),
289297
ports: None,
298+
no_nmap: Some(false),
290299
range: None,
291300
quiet: Some(true),
292301
batch_size: Some(25_000),
@@ -320,7 +329,8 @@ mod tests {
320329
command: vec![],
321330
accessible: false,
322331
scan_order: ScanOrder::Serial,
323-
ignore_config: false,
332+
no_nmap: false,
333+
no_config: false,
324334
};
325335

326336
let config = Config {
@@ -333,6 +343,7 @@ mod tests {
333343
quiet: None,
334344
batch_size: None,
335345
timeout: None,
346+
no_nmap: Some(false),
336347
ulimit: Some(1_000),
337348
command: None,
338349
accessible: None,

‎src/main.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ mod tests {
277277
command: Vec::new(),
278278
accessible: false,
279279
scan_order: ScanOrder::Serial,
280-
ignore_config: false,
280+
no_config: false,
281+
no_nmap: false,
281282
};
282283
let batch_size = infer_batch_size(&opts, 120);
283284

@@ -297,7 +298,8 @@ mod tests {
297298
command: Vec::new(),
298299
accessible: false,
299300
scan_order: ScanOrder::Serial,
300-
ignore_config: false,
301+
no_config: false,
302+
no_nmap: false,
301303
};
302304
let batch_size = infer_batch_size(&opts, 9_000);
303305

@@ -318,7 +320,8 @@ mod tests {
318320
command: Vec::new(),
319321
accessible: false,
320322
scan_order: ScanOrder::Serial,
321-
ignore_config: false,
323+
no_config: false,
324+
no_nmap: false,
322325
};
323326
let batch_size = infer_batch_size(&opts, 5_000);
324327

@@ -338,7 +341,8 @@ mod tests {
338341
command: Vec::new(),
339342
accessible: false,
340343
scan_order: ScanOrder::Serial,
341-
ignore_config: false,
344+
no_config: false,
345+
no_nmap: false,
342346
};
343347
let batch_size = adjust_ulimit_size(&opts);
344348

@@ -363,7 +367,8 @@ mod tests {
363367
command: Vec::new(),
364368
accessible: true,
365369
scan_order: ScanOrder::Serial,
366-
ignore_config: false,
370+
no_config: false,
371+
no_nmap: false,
367372
};
368373

369374
infer_batch_size(&opts, 1_000_000);
@@ -384,7 +389,8 @@ mod tests {
384389
command: Vec::new(),
385390
accessible: false,
386391
scan_order: ScanOrder::Serial,
387-
ignore_config: false,
392+
no_config: false,
393+
no_nmap: false,
388394
};
389395
let ips = parse_ips(&opts);
390396

@@ -404,7 +410,8 @@ mod tests {
404410
command: Vec::new(),
405411
accessible: false,
406412
scan_order: ScanOrder::Serial,
407-
ignore_config: false,
413+
no_config: false,
414+
no_nmap: false,
408415
};
409416
let ips = parse_ips(&opts);
410417

@@ -424,7 +431,8 @@ mod tests {
424431
command: Vec::new(),
425432
accessible: false,
426433
scan_order: ScanOrder::Serial,
427-
ignore_config: false,
434+
no_config: false,
435+
no_nmap: false,
428436
};
429437
let ips = parse_ips(&opts);
430438

0 commit comments

Comments
 (0)
Please sign in to comment.