-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_strings.ps1
More file actions
88 lines (73 loc) · 2.89 KB
/
Copy pathcheck_strings.ps1
File metadata and controls
88 lines (73 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# TinecmaTools 字符串检查脚本
# 用于检查编译后的文件中是否还包含 "renderdoc" 相关字符串
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "TinecmaTools 字符串检查工具" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# 定义要检查的目录
$checkDirs = @(
"x64\Development",
"x64\Release",
"Win32\Development",
"Win32\Release"
)
# 定义要检查的文件类型
$fileTypes = @("*.exe", "*.dll", "*.json")
# 定义敏感字符串
$sensitiveStrings = @(
"renderdoc",
"RenderDoc",
"RENDERDOC",
"VK_LAYER_RENDERDOC",
"ENABLE_VULKAN_RENDERDOC",
"DISABLE_VULKAN_RENDERDOC"
)
$foundIssues = @()
foreach ($dir in $checkDirs) {
if (Test-Path $dir) {
Write-Host "检查目录: $dir" -ForegroundColor Yellow
foreach ($fileType in $fileTypes) {
$files = Get-ChildItem -Path $dir -Filter $fileType -Recurse -ErrorAction SilentlyContinue
foreach ($file in $files) {
Write-Host " 检查文件: $($file.Name)" -ForegroundColor Gray
try {
$content = Get-Content -Path $file.FullName -Raw -Encoding Byte -ErrorAction Stop
$contentStr = [System.Text.Encoding]::ASCII.GetString($content)
foreach ($str in $sensitiveStrings) {
if ($contentStr -match $str) {
$issue = @{
File = $file.FullName
String = $str
}
$foundIssues += $issue
Write-Host " [警告] 发现: $str" -ForegroundColor Red
}
}
} catch {
Write-Host " [跳过] 无法读取文件" -ForegroundColor DarkGray
}
}
}
Write-Host ""
}
}
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "检查完成" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
if ($foundIssues.Count -gt 0) {
Write-Host ""
Write-Host "发现 $($foundIssues.Count) 个潜在问题:" -ForegroundColor Red
Write-Host ""
$foundIssues | ForEach-Object {
Write-Host "文件: $($_.File)" -ForegroundColor Yellow
Write-Host "字符串: $($_.String)" -ForegroundColor Red
Write-Host ""
}
Write-Host "建议: 需要进一步修改源代码以消除这些字符串" -ForegroundColor Cyan
} else {
Write-Host ""
Write-Host "✓ 未发现敏感字符串!" -ForegroundColor Green
Write-Host ""
}
Write-Host "按任意键退出..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")