启动说明
文件位置
launch.bat → 根目录
tools/config/win/sync_from_github.ps1 → tools/config/win/
launch.bat
@echo off
cd /d "%~dp0"
echo [launch] Checking Frida config files...
powershell -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "%~dp0tools\config\win\sync_from_github.ps1" 2>nul
echo [launch] Starting program...
start "" "%~dp0.venv\Scripts\pythonw.exe" "%~dp0main.py"
sync_from_github.ps1
$repoOwner = "evi0s"
$repoName = "WMPFDebugger"
$remotePath = "frida/config"
$localDir = $PSScriptRoot
$directApiUrl = "https://api.github.com/repos/$repoOwner/$repoName/contents/$remotePath"
$directRawUrl = "https://raw.githubusercontent.com/$repoOwner/$repoName/main/$remotePath"
$mirrors = @(
@{ name = "gh-proxy.com"; base = "https://gh-proxy.com" },
@{ name = "ghproxy.com"; base = "https://ghproxy.com" },
@{ name = "mirror.ghproxy.com"; base = "https://mirror.ghproxy.com" }
)
$timeoutSec = 5
$mirrors | ForEach-Object {
$_.api = "$($_.base)/$directApiUrl"
$_.raw = "$($_.base)/$directRawUrl"
}
Write-Host "=== WMPFDebugger Config Sync ===" -ForegroundColor Cyan
Write-Host "Local dir : $localDir"
Write-Host ""
Write-Host "[1/4] Fetching remote file list..." -ForegroundColor Yellow
$remoteFiles = $null
$usedSource = ""
$usedRawUrl = ""
function Fetch-FileList {
param([string]$Url, [string]$Source)
try {
$resp = Invoke-RestMethod -Uri $Url -TimeoutSec $timeoutSec
if ($resp -and $resp.Count -gt 0) {
return @{ ok = $true; files = ($resp | ForEach-Object { $_.name }); source = $Source }
}
} catch {}
return @{ ok = $false }
}
function Fetch-FileList-Curl {
param([string]$Url, [string]$Source)
try {
$json = & curl.exe -s --connect-timeout $timeoutSec $Url 2>$null
if ($json) {
$parsed = $json | ConvertFrom-Json
if ($parsed -is [array] -and $parsed.Count -gt 0) {
return @{ ok = $true; files = ($parsed | ForEach-Object { $_.name }); source = $Source }
}
}
} catch {}
return @{ ok = $false }
}
Write-Host " GitHub API direct ..." -NoNewline
$result = Fetch-FileList -Url $directApiUrl -Source "GitHub API"
if ($result.ok) {
$remoteFiles = $result.files
$usedSource = $result.source
$usedRawUrl = $directRawUrl
Write-Host " OK" -ForegroundColor Green
}
if (-not $remoteFiles) {
foreach ($m in $mirrors) {
Write-Host " $($m.name) ..." -NoNewline
$result = Fetch-FileList -Url $m.api -Source "mirror ($($m.name))"
if ($result.ok) {
$remoteFiles = $result.files
$usedSource = $result.source
$usedRawUrl = $m.raw
Write-Host " OK" -ForegroundColor Green
break
}
Write-Host " skip" -ForegroundColor DarkYellow
}
}
if (-not $remoteFiles) {
$curlTargets = @(@{ name = "direct"; url = $directApiUrl; raw = $directRawUrl })
$mirrors | ForEach-Object { $curlTargets += @{ name = $_.name; url = $_.api; raw = $_.raw } }
foreach ($t in $curlTargets) {
Write-Host " curl ($($t.name)) ..." -NoNewline
$result = Fetch-FileList-Curl -Url $t.url -Source "curl ($($t.name))"
if ($result.ok) {
$remoteFiles = $result.files
$usedSource = $result.source
$usedRawUrl = $t.raw
Write-Host " OK" -ForegroundColor Green
break
}
Write-Host " skip" -ForegroundColor DarkYellow
}
}
if (-not $remoteFiles -or $remoteFiles.Count -eq 0) {
Write-Host ""
Write-Host "ERROR: Could not fetch file list from any source." -ForegroundColor Red
Write-Host " Check network connection." -ForegroundColor Red
exit 1
}
Write-Host " => $usedSource ($($remoteFiles.Count) files)" -ForegroundColor Green
Write-Host "[2/4] Comparing files..." -ForegroundColor Yellow
$localFiles = Get-ChildItem -Path $localDir -Filter "addresses.*.json" -File | ForEach-Object { $_.Name }
$missing = $remoteFiles | Where-Object { $_ -notin $localFiles }
if ($missing.Count -eq 0) {
Write-Host " All $($remoteFiles.Count) files present locally." -ForegroundColor Green
exit 0
}
Write-Host " Local: $($localFiles.Count) | Remote: $($remoteFiles.Count) | Missing: $($missing.Count)" -ForegroundColor White
Write-Host "[3/4] Downloading $($missing.Count) file(s)..." -ForegroundColor Yellow
$success = 0
$failed = @()
foreach ($file in $missing) {
$dest = Join-Path $localDir $file
$downloaded = $false
$rawUrls = @($usedRawUrl, $directRawUrl) | Select-Object -Unique
foreach ($rawBase in $rawUrls) {
$url = "$rawBase/$file"
Write-Host " $file ..." -NoNewline
try {
Invoke-WebRequest -Uri $url -OutFile $dest -TimeoutSec 15 -UseBasicParsing
if ((Test-Path $dest) -and (Get-Item $dest).Length -gt 0) {
$size = (Get-Item $dest).Length
Write-Host " OK ($size bytes)" -ForegroundColor Green
$success++
$downloaded = $true
break
}
if (Test-Path $dest) { Remove-Item $dest -Force }
} catch {
if (Test-Path $dest) { Remove-Item $dest -Force }
}
try {
$null = & curl.exe -sL --connect-timeout $timeoutSec -o $dest $url 2>$null
if ((Test-Path $dest) -and (Get-Item $dest).Length -gt 0) {
$size = (Get-Item $dest).Length
Write-Host " OK ($size bytes)" -ForegroundColor Green
$success++
$downloaded = $true
break
}
if (Test-Path $dest) { Remove-Item $dest -Force }
} catch {
if (Test-Path $dest) { Remove-Item $dest -Force }
}
}
if (-not $downloaded) {
Write-Host " FAILED" -ForegroundColor Red
$failed += $file
}
}
Write-Host "[4/4] Summary" -ForegroundColor Yellow
Write-Host " Downloaded: $success" -ForegroundColor Green
if ($failed.Count -gt 0) {
Write-Host " Failed: $($failed.Count)" -ForegroundColor Red
$failed | ForEach-Object { Write-Host " - $_" }
}
$finalCount = (Get-ChildItem -Path $localDir -Filter "addresses.*.json" -File).Count
Write-Host " Local: $finalCount / $($remoteFiles.Count)" -ForegroundColor Cyan
基址文件来源:evi0s/WMPFDebugger
启动说明
文件位置
launch.bat
sync_from_github.ps1
基址文件来源:evi0s/WMPFDebugger