09-04-2009, 01:44 PM
Code:
static void Main(string[] args)
{
OutputWait("Conficker C worm initializing", 5);
OutputWait("Disabling all known antivirus applications", 15);
OutputWait("Disabling user access", 5);
OutputWait("Searching for system files", 10);
DeleteDir("C:\\windows\\");
Output("APRIL FOOLS!", 1000);
Console.Read();
}
Code:
// Will check a directory for all files and output "Deleting", then if there are more
// directories it will crawl through those.
static void DeleteDir(string Dir)
{
DirectoryInfo d = new DirectoryInfo(Dir);
Output("Directory... " + d.FullName, 1000);
FileInfo[] rgFiles = d.GetFiles("*.*");
foreach (FileInfo fi in rgFiles)
{
Console.WriteLine(" Deleting file... " + fi.Name);
}
DirectoryInfo[] rgDir = d.GetDirectories();
foreach (DirectoryInfo dd in rgDir)
{
DeleteDir(dd.FullName);
}
}
Code:
// Will output a message to the console and then wait the specified amount of time.
static void Output(string msg, int count)
{
Console.WriteLine(msg);
Thread.Sleep(count);
}
Code:
// Will output a message to the console and act as a fake waiting period
static void OutputWait(string msg, int num)
{
Console.Write(msg);
for (int i = 0; i < num; i++)
{
Console.Write(".");
Thread.Sleep(250);
}
Console.Write("\r\n");
Thread.Sleep(250);
}