Skip to content
Merged
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
10 changes: 5 additions & 5 deletions Subdominator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ static async Task<bool> CheckAndLogDomain(SubdomainHijack hijackChecker, string
}
var fingerPrintName = result.Fingerprint == null ? "-" : result.Fingerprint.Service;

// Build the output string
var output = $"{(result.IsVerified ? "✅ " : "")}[{fingerPrintName}] {domain} - CNAME: {string.Join(", ", result.CNAMES ?? [])}";

// Show where we matched the takeover
var locationString = "";
if(result.MatchedRecord == MatchedRecord.CNAME)
Expand All @@ -274,18 +271,21 @@ static async Task<bool> CheckAndLogDomain(SubdomainHijack hijackChecker, string
locationString = $" - AAAA: {string.Join(", ", result.AAAA ?? [])}";
}

// Build the output string after determining locationString
var output = $"{(result.IsVerified ? "✅ " : "")}[{fingerPrintName}] {domain}{locationString}";

// Thread-safe console print and append to results file
lock (_fileLock)
{
Console.Write($"{(result.IsVerified ? "✅ " : "")}[");
Console.ForegroundColor = result.IsVulnerable ? ConsoleColor.Red : ConsoleColor.Green;
Console.Write(fingerPrintName);
Console.ResetColor();
Console.Write($"] {domain}" + locationString + Environment.NewLine);
Console.Write($"] {domain}{locationString}" + Environment.NewLine);

if (_outputFileWriter != null)
{
_outputFileWriter.WriteLine(output + locationString);
_outputFileWriter.WriteLine(output);
}
}
}
Expand Down
Loading