Skip to content

Commit

Permalink
Add retries to fingerprint downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
coj337 committed Sep 12, 2024
1 parent ba5d8a3 commit 614a45a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Subdominator/SubdomainHijack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,14 @@ public async Task<IEnumerable<Fingerprint>> GetFingerprintsAsync(bool excludeUnl
{
// Download the file if it doesn't exist
var fingerprintsUrl = "https://raw.githubusercontent.com/EdOverflow/can-i-take-over-xyz/master/fingerprints.json";
fingerprintsData = await _httpClient.GetStringAsync(fingerprintsUrl);
try
{
fingerprintsData = await _httpClient.GetStringAsync(fingerprintsUrl);
}
catch // One retry just in case github is having a bad day
{
fingerprintsData = await _httpClient.GetStringAsync(fingerprintsUrl);
}

// Save the file locally for future use
await File.WriteAllTextAsync(filePath, fingerprintsData);
Expand All @@ -185,8 +192,15 @@ public async Task<IEnumerable<Fingerprint>> GetFingerprintsAsync(bool excludeUnl
else
{
var customFingerprintsUrl = "https://raw.githubusercontent.com/Stratus-Security/Subdominator/master/Subdominator/custom_fingerprints.json";
customFingerprintsData = await _httpClient.GetStringAsync(customFingerprintsUrl);

try
{
customFingerprintsData = await _httpClient.GetStringAsync(customFingerprintsUrl);
}
catch
{
customFingerprintsData = await _httpClient.GetStringAsync(customFingerprintsUrl);
}
await File.WriteAllTextAsync(customFilePath, customFingerprintsData);
}

Expand Down

0 comments on commit 614a45a

Please sign in to comment.