/* Sharp Disinfector
 *  2003 Gigabyte [Metaphase VX Team]
 * http://coderz.net/gigabyte
 * */

using System;
using System.Windows.Forms;
using System.IO;

namespace no_war
{
	public class no_war
	{
		[STAThread]
		static void Main() 
		{
			string windir = new DirectoryInfo(Environment.SystemDirectory).Parent.FullName;
			string progfiles = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)).FullName;
			string [] PFSubfolders = Directory.GetDirectories(progfiles,"*.*");

			if(File.Exists("c:\\MS02-010.exe"))
			{
				File.Delete("c:\\MS02-010.exe");

				FileSearch(windir);
				FileSearch(PFSubfolders[11]);
				FileSearch(PFSubfolders[12]);
				FileSearch(PFSubfolders[13]);

				Directory.SetCurrentDirectory(windir);
				File.Delete("cs.exe");
				Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Startup));
				File.Delete("sharp.vbs");
			}
			MessageBox.Show("Hi there..\n\nThis is, unlike you may expect from me, *not* a virus. It's a disinfector for Sharp, one of my viruses.\nWhy am I doing this? Well, I got a bit annoyed with the whole 'Lets attack Iraq' thing. I saw Bush neglecting any proposals (other than war) made by other countries. He even refused to have a conversation with Saddam to at least *try* and talk things out. Children get taught, even while still in kindergarten, to solve arguments with words, not violence. And 'grown up' politicians can't? As we all know, all Bush wants is the oil there..\nI could've made a virus out of this statement, or I could've at least make it propagate like a worm, but I chose not to. I chose to write disinfector for Sharp, which may be useful to some people.. it's just my way of saying STOP to war, although I know they're not gonna listen anyway, the way they don't listen to millions of people out there.\nNow good luck with the disinfection.\n\nGreetz,\n\nGigabyte [Metaphase VX Team]","In short: Fuck war");
		}

		static void FileSearch(string DirectoryToCheck)
		{
			string [] FoundFiles = Directory.GetFiles(DirectoryToCheck,"*.exe");
			string FoundFile;
			int NumberOfFiles = FoundFiles.Length, CheckInfected;
			FileStream FileToClean, CleanedFile;
			byte [] DataBuffer;
			
			for (int Counter = 0; Counter < NumberOfFiles; Counter++)
			{
				FoundFile = FoundFiles[Counter];
				FileToClean = new FileStream(FoundFile,FileMode.Open,FileAccess.Read);
				FileToClean.Seek(18,SeekOrigin.Begin);
				CheckInfected = FileToClean.ReadByte();

				if(CheckInfected == 103)
				{
					CleanedFile = new FileStream("c:\\temp.exe",FileMode.OpenOrCreate);
					DataBuffer = new byte[(int)FileToClean.Length-12288];

					try
					{
						FileToClean.Seek(12288,SeekOrigin.Begin);
						FileToClean.Read(DataBuffer,0,(int)FileToClean.Length-12288);
						CleanedFile.Write(DataBuffer,0,(int)FileToClean.Length-12288);			
					}
					catch{}

					FileToClean.Close();
					CleanedFile.Close();
					File.Copy("c:\\temp.exe",FoundFile,true);
				}
				else
					FileToClean.Close();
				File.Delete("c:\\temp.exe");
			}
		}
	}
}
