commit 8a76155151d767740572403ab9a94f85376d3d00
parent f6c3d70d2f412a6569ffc7a180582df01cf654a8
Author: Matthias Jaros <jaros@mailbox.org>
Date: Wed, 1 Jul 2026 13:44:15 +0200
Properly and consistently named cli parameter and its internal representation
Diffstat:
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/it_jaros/jscanner/CliParser.java b/src/main/java/com/it_jaros/jscanner/CliParser.java
@@ -18,7 +18,7 @@ public class CliParser {
int maxHostsLimit = CliDefaults.MAX_HOSTS_LIMIT;
String ports = CliDefaults.PORTS;
boolean showFilteredPorts = CliDefaults.SHOW_FILTERED_PORTS;
- boolean disableHostCheck = CliDefaults.DISABLE_HOST_CHECK;
+ boolean disableOnlineCheck = CliDefaults.DISABLE_HOST_CHECK;
String hostsFile = null;
for (int i = 0; i < args.length; i++) {
@@ -53,8 +53,8 @@ public class CliParser {
case "--showFilteredPorts", "-sf":
showFilteredPorts = true;
break;
- case "--disableHostCheck", "-dt":
- disableHostCheck = true;
+ case "--disableOnlineCheck", "-dt":
+ disableOnlineCheck = true;
break;
case "--file", "-f":
hostsFile = requireValue(args, ++i, currentArg);
@@ -65,10 +65,10 @@ public class CliParser {
}
System.out.printf(
- "Parsed arguments: hostsArgv('%s'), ports(%s), socketLimit(%s), delayInMillis(%s), timeoutInMillis(%s), maxWorkersPerHost(%s), maxTargetsLimit(%s), showFilteredPorts(%s), disableTargetCheck(%s), file(%s) %n",
- hostsArgv, ports, socketLimit, delayInMillis, timeoutInMillis, maxWorkersPerHost, maxHostsLimit, showFilteredPorts, disableHostCheck, hostsFile);
+ "Parsed arguments: hostsArgv('%s'), ports(%s), socketLimit(%s), delayInMillis(%s), timeoutInMillis(%s), maxWorkersPerHost(%s), maxTargetsLimit(%s), showFilteredPorts(%s), disableOnlineCheck(%s), file(%s) %n",
+ hostsArgv, ports, socketLimit, delayInMillis, timeoutInMillis, maxWorkersPerHost, maxHostsLimit, showFilteredPorts, disableOnlineCheck, hostsFile);
- return new ScanOptions(hostsArgv.stream().toList(), socketLimit, delayInMillis, timeoutInMillis, maxWorkersPerHost, maxHostsLimit, ports, showFilteredPorts, disableHostCheck, hostsFile);
+ return new ScanOptions(hostsArgv.stream().toList(), socketLimit, delayInMillis, timeoutInMillis, maxWorkersPerHost, maxHostsLimit, ports, showFilteredPorts, disableOnlineCheck, hostsFile);
}
private String requireValue(String[] args, int index, String option) {
@@ -100,7 +100,7 @@ public class CliParser {
--maxWorkersPerHost, -wh:\tVirtual Worker Threads run per Host. Higher doesn't mean necessarily faster. But the more you use the more RAM is required (Default: 1000)
--maxHostsLimit, -tl:\tMax number of Hosts that are scanned at the same time (Default: 10)
--showFilteredPorts, -sf:\tShow also filtered ports
- --disableHostCheck, -dt:\tDon't check if Host is reachable
+ --disableOnlineCheck, -dt:\tDon't check if Host is reachable
--file, -f:\t\t\tRead hosts to scan from file instead of stdin
Examples:
diff --git a/src/main/java/com/it_jaros/jscanner/Scanner.java b/src/main/java/com/it_jaros/jscanner/Scanner.java
@@ -28,15 +28,15 @@ public class Scanner {
private final long delayInNanos;
private final int maxWorkersPerHost;
private final int maxHostsLimit;
- private final boolean disableHostCheck;
+ private final boolean disableOnlineCheck;
- public Scanner(int socketLimit, int timeoutInMillis, int delayInMillis, int maxWorkersPerHost, int maxHostsLimit, boolean disableHostCheck) {
+ public Scanner(int socketLimit, int timeoutInMillis, int delayInMillis, int maxWorkersPerHost, int maxHostsLimit, boolean disableOnlineCheck) {
this.timeoutInMillis = timeoutInMillis;
this.delayInNanos = TimeUnit.MILLISECONDS.toNanos(Math.max(0, delayInMillis));
this.socketLimit = new Semaphore(socketLimit);
this.maxWorkersPerHost = maxWorkersPerHost;
this.maxHostsLimit = maxHostsLimit;
- this.disableHostCheck = disableHostCheck;
+ this.disableOnlineCheck = disableOnlineCheck;
}
public List<ScanResult> scan(ScanOptions options) {
@@ -116,7 +116,7 @@ public class Scanner {
Progress progress = new Progress(host, portRange.getTotal(), new AtomicInteger(), new AtomicInteger(), new AtomicInteger());
progressBar.submit(progress);
- if(!disableHostCheck && !checkHostOnline(host)) {
+ if(!disableOnlineCheck && !checkHostOnline(host)) {
// Visually show that this host is basically done
progress.done().set(progress.total());
return new ScanResult(host, openPorts, filteredPorts, bannerRecognition);