Following the documentation of arsoft.tools.net at https://docs.ar-soft.de/arsoft.tools.net/ , we just created a DNS server to intercept every request from the network, everything works fine!
The thing that slows us down: when a customer calls www.google.com (for example), we want to show or redirect to www.yahoo.com (or IP address), any key on how we can achieve this?
Some people are looking for the exact same solution here:
https://arsofttoolsnet.codeplex.com/discussions?searchText=redirect
Tks
UPDATE 1:
So far this is what I have, but the redirect does not work:
class Program
{
static void Main(string[] args)
{
using (DnsServer server = new DnsServer(System.Net.IPAddress.Any, 10, 10))
{
server.QueryReceived += OnQueryReceived;
server.Start();
Console.WriteLine("Press any key to stop server");
Console.ReadLine();
}
}
static async Task OnQueryReceived(object sender, QueryReceivedEventArgs e)
{
DnsMessage query = e.Query as DnsMessage;
if (query == null)
return;
DnsMessage response = query.CreateResponseInstance();
if ((response.Questions.Count == 1))
{
DnsQuestion question = response.Questions[0];
if (question.Name.ToString().Contains("www.google.com"))
{
DnsMessage upstreamResponse = await DnsClient.Default.ResolveAsync(DomainName.Parse("www.yahoo.com"), question.RecordType, question.RecordClass);
foreach (DnsRecordBase record in (upstreamResponse.AnswerRecords))
{
response.AnswerRecords.Add(record);
}
foreach (DnsRecordBase record in (upstreamResponse.AdditionalRecords))
{
response.AdditionalRecords.Add(record);
}
response.ReturnCode = ReturnCode.NoError;
e.Response = response;
}
}
}
}