Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C#] Check If Executed From USB Drive
#1
Quote:public static void usbcheck()
{
DriveInfo[] drives = DriveInfo.GetDrives();
{

foreach (DriveInfo drive in drives)
if (drive.DriveType == DriveType.Removable)
if (drive.RootDirectory.Root.ToString()[0] == Environment.CurrentDirectory[0])
// Is USB Drive
else
{
// Not USB Drive
}
}
}

Grabbed from my TBOT Source.

it doesnt have to have a malware application.

very usefull code.
Reply
#2
Thanks. Another helpful bit of code.
Reply
#3
Thanks for the snippet man!
Reply
#4
Thanks this will come in handy.
Reply
#5
When a program is auto executed, is it the code itself or a file to manage it?
Reply
#6
Translated to VB.NET

Code:
Public Shared Sub usbcheck()
        Dim drives() As DriveInfo = DriveInfo.GetDrives
        For Each drive As DriveInfo In drives
            If (drive.DriveType = DriveType.Removable) Then
                If (drive.RootDirectory.Root.ToString(0) = Environment.CurrentDirectory(0)) Then
                Else
                    ' Not USB Drive
                End If
            End If
        Next
    End Sub
USB Anti-virus? Try USB Drive Defender
[Image: 8bQCusS.jpg]
Reply
#7
Thank for shared that, it will be usefull. Smile

Use the code tag instead of quote.
Reply
#8
Another
[Image: UTLN2.gif]
That's not my Sig . So don't flame me.
Reply
#9
Your TBOT Source? Me and T3rror coded this, T3rror coded this specific function.
Reply
#10
I may add this in my crypter as a little extra.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] USB Drive Defender euverve 0 1,204 03-22-2013, 06:21 AM
Last Post: euverve
  [VB.NET] USB Listener wchar_t 1 2,716 09-14-2010, 08:38 PM
Last Post: -BoodyE-
  Check If Executed For First Time. (Simple) wchar_t 3 1,118 08-19-2010, 02:24 PM
Last Post: Buzz Lightyear
  how to connect the USB with the program Shadowdancer 1 811 10-29-2009, 04:47 AM
Last Post: Shadowdancer

Forum Jump:


Users browsing this thread: 1 Guest(s)