Skip to content

Commit 1afabca

Browse files
committed
Fix output generation
1 parent 976f291 commit 1afabca

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Subdominator/Program.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,6 @@ static async Task<bool> CheckAndLogDomain(SubdomainHijack hijackChecker, string
251251
}
252252
var fingerPrintName = result.Fingerprint == null ? "-" : result.Fingerprint.Service;
253253

254-
// Build the output string
255-
var output = $"{(result.IsVerified ? "✅ " : "")}[{fingerPrintName}] {domain} - CNAME: {string.Join(", ", result.CNAMES ?? [])}";
256-
257254
// Show where we matched the takeover
258255
var locationString = "";
259256
if(result.MatchedRecord == MatchedRecord.CNAME)
@@ -274,18 +271,21 @@ static async Task<bool> CheckAndLogDomain(SubdomainHijack hijackChecker, string
274271
locationString = $" - AAAA: {string.Join(", ", result.AAAA ?? [])}";
275272
}
276273

274+
// Build the output string after determining locationString
275+
var output = $"{(result.IsVerified ? "✅ " : "")}[{fingerPrintName}] {domain}{locationString}";
276+
277277
// Thread-safe console print and append to results file
278278
lock (_fileLock)
279279
{
280280
Console.Write($"{(result.IsVerified ? "✅ " : "")}[");
281281
Console.ForegroundColor = result.IsVulnerable ? ConsoleColor.Red : ConsoleColor.Green;
282282
Console.Write(fingerPrintName);
283283
Console.ResetColor();
284-
Console.Write($"] {domain}" + locationString + Environment.NewLine);
284+
Console.Write($"] {domain}{locationString}" + Environment.NewLine);
285285

286286
if (_outputFileWriter != null)
287287
{
288-
_outputFileWriter.WriteLine(output + locationString);
288+
_outputFileWriter.WriteLine(output);
289289
}
290290
}
291291
}

0 commit comments

Comments
 (0)