VMP加壳NET 相关的强度代码

VB.NET · 昨天 · 15 人浏览

变异+虚拟

<System.Reflection.Obfuscation(Feature:="ultra", Exclude:=False)>

虚拟化:

<System.Reflection.Obfuscation(Feature:="virtualization", Exclude:=False)>

变异:

<System.Reflection.Obfuscation(Feature:="mutation", Exclude:=False)>

锁定到序列号:

<System.Reflection.Obfuscation(Feature:="virtualizationlockbykey", Exclude:=False)>

变异+虚拟+锁定到序列号:

<System.Reflection.Obfuscation(Feature:="ultralockbykey", Exclude:=False)>

基本用法:

全局:

Public hwid As String = VMProtect.SDK.GetCurrentHWID()  

启动时:

<System.Reflection.Obfuscation(Feature:="ultra", Exclude:=False)>
Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    If hwid = "myhwid" Then
        MessageBox.Show("请编译后再使用!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End
    End If

    Dim res As Integer
    Dim sd As New SerialNumberData

    Try
        Dim keyfilepath As String = System.IO.Path.Combine(Application.StartupPath, "License.txt")

        If Not System.IO.File.Exists(keyfilepath) Then
            HandleAuthFailure("未找到授权文件 License.txt,请将其放置在软件同目录下。")
            Return
        End If

        Dim serialkey As String = System.IO.File.ReadAllText(keyfilepath).Trim()

        If String.IsNullOrEmpty(serialkey) Then
            HandleAuthFailure("License.txt 授权文件为空!")
            Return
        End If

        res = VMProtect.SDK.SetSerialNumber(serialkey)

        If res = 0 Then
            VMProtect.SDK.GetSerialNumberData(sd)
            If DateTime.Now > sd.Expires Then
                HandleAuthFailure($"授权已于 {sd.Expires:yyyy-MM-dd} 过期,请续费。")
                Return
            End If
            '成功运行
            Try
                Me.Text = "获取配置中.."
                Await Task.Run(Async Function()
                                   Await InitCAAsync()
                               End Function)
                Me.Text = "种草链接提交 - 配置获取完成"
            Catch ex As Exception
                MessageBox.Show(Me, "初始化失败:" & ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Application.Exit()
            End Try
            ToolStripStatusLabel1.Text = $"用户:{sd.UserName} * 过期时间:{sd.Expires:yyyy-MM-dd}  [授权正常]"
        Else
            Dim errormsg As String = "授权验证失败,请检查授权码是否正确。"
            If (res And 1) <> 0 Then errormsg = "授权码被破坏"
            If (res And 2) <> 0 Then errormsg = "授权已过期"
            If (res And 4) <> 0 Then errormsg = "机器码不匹配,请在当前机器重新生成授权。"
            If (res And 8) <> 0 Then errormsg = "此授权码已被列入黑名单"

            HandleAuthFailure(errormsg)
            Return
        End If

    Catch ex As Exception
        MessageBox.Show($"程序启动异常:  {ex.Message}", "致命错误", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End
    End Try
End Sub
    
    
    
    
<System.Reflection.Obfuscation(Feature:="ultra", Exclude:=False)>
    Private Sub HandleAuthFailure(msg As String)
        Me.Hide()
        MessageBox.Show($"{msg}{vbCrLf}{vbCrLf}您的机器码为:[{hwid}] (已自动复制)", "授权保护", MessageBoxButtons.OK, MessageBoxIcon.Stop)
        Try : Clipboard.SetText(hwid) : Catch : End Try
        End
    End Sub