Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Subdominator -d sub.example.com
-d, --domain <domain> A single domain to check
-l, --list <list> A list of domains to check (line delimited)
-o, --output <output> Output subdomains to a file
-t, --threads <threads> Number of domains to check at once [default: 50]
-t, --threads <threads> Number of domains to check at once; values \<= 0 use the default [default: 50]
-v, --verbose Print extra information
-q, --quiet Quiet mode: Only print found results
-eu, --exclude-unlikely Exclude unlikely (edge-case) fingerprints
Expand Down
15 changes: 15 additions & 0 deletions Subdominator.Tests/ThreadValidationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Subdominator;

namespace Subdominator.Tests;

[TestClass]
public class ThreadValidationTests
{
[TestMethod]
public void InvalidThreadValuesDefaultTo50()
{
Assert.AreEqual(50, Program.ValidateThreadCount(0));
Assert.AreEqual(50, Program.ValidateThreadCount(-5));
Assert.AreEqual(10, Program.ValidateThreadCount(10));
}
}
9 changes: 7 additions & 2 deletions Subdominator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static async Task Main(string[] args = null)
new Option<string>(["-d", "--domain"], "A single domain to check"),
new Option<string>(["-l", "--list"], "A list of domains to check (line delimited)") { Name = "DomainsFile" },
new Option<string>(["-o", "--output"], "Output subdomains to a file") { Name = "OutputFile" },
new Option<int>(["-t", "--threads"], () => 50, "Number of domains to check at once"),
new Option<int>(["-t", "--threads"], () => 50, "Number of domains to check at once (0 or less uses default of 50)"),
new Option<bool>(["-v", "--verbose"], "Print extra information"),
new Option<bool>(["-q", "--quiet"], "Quiet mode: Only print found results"),
new Option<string>(["-c", "--csv"], "Heading or column index to parse for CSV file. Forces -l to read as CSV instead of line-delimited") { Name = "CsvHeading" },
Expand Down Expand Up @@ -120,7 +120,7 @@ _____ _ _ _ _
}

// Define maximum concurrent tasks
int maxConcurrentTasks = o.Threads;
int maxConcurrentTasks = ValidateThreadCount(o.Threads);
var vulnerableCount = 0;

// Pre-check domains passed in and filter any that are invalid
Expand Down Expand Up @@ -296,4 +296,9 @@ static async Task<bool> CheckAndLogDomain(SubdomainHijack hijackChecker, string
}
return isFound;
}

public static int ValidateThreadCount(int threads)
{
return threads > 0 ? threads : 50;
}
}
Loading