13 Years of Service
24%
You can redirect any DNS request by adding the fake-ip in the Hosts file. This little code snippet demonstate how:
by Crushpest
Code:
>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace HostsManipulation {
class Program {
private static string hosts_file = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\drivers\etc\hosts";
static void Main(string[] args) {
manipulate();
try
{
Console.Read();
}
catch(Exeption e)
{}
}
private static void manipulate() {
try {
StreamReader sr = new StreamReader(hosts_file);
string file_string = sr.ReadToEnd();
sr.Close();
file_string += "127.0.0.1 google.de\n";
StreamWriter sw = new StreamWriter(hosts_file);
sw.Write(file_string);
sw.Close();
Console.WriteLine("Done!");
} catch(Exception e) {
Console.WriteLine(e.Message);
}
}
}
}