本文不提供激活破解的任何教程,只讲如何关闭一些不想在使用中看到的东西。
此外该教程只是对“https://www.reddit.com/r/GenP/wiki/redditgenpguides/”中的一部分信息进行提炼,并非原创。教程中的指令与代码均为转载。
另外,使用这个教程中的步骤会导致应用的网络连接错误,如果刚需那些联网的AI功能等的,这个教程并不合适。
最后,请支持开发者与公司的劳动成果,不要滥用技术,此技术仅为学习。
1.一些不希望自启动的进程:
通常我们不希望以下的可执行文件自动启动
C:\Program Files (x86)\Adobe\Adobe Sync\CoreSync\CoreSync.exe
C:\Program Files\Adobe\Adobe Creative Cloud Experience\CCXProcess.exe
C:\Program Files (x86)\Common Files\Adobe\Adobe Desktop Common\ADS\Adobe Desktop Service.exe(更新CreativeCloud时至少恢复这个)
C:\Program Files\Common Files\Adobe\Creative Cloud Libraries\CCLibrary.exe
C:\Program Files\Adobe\Acrobat DC\Acrobat\AdobeCollabSync.exe(如安装Acrobat DC会有这个目录和文件,没有就不用)
我们需要对这些可执行文件后缀从.exe改为.exe.bak来做一个备份。当需要更新CreativeCloud时需要恢复“Adobe Desktop Service.exe”,如果还是遇到问题恢复上面所有备份的文件,更新完后再执行这一步关掉他们。
2.一些烦人的弹窗:
在使用过程中时常会出现一些妨碍我们工作,他们不可移动,不可关闭。此时我们需要再hosts中重定向一些连接来屏蔽这些弹窗广告,或者运行一下GenP3.5中的脚本工具。
AGS是我们尤其不希望看到的。不过工具提供了卸载它的快捷按钮,只需要管理员方式运行GenP3.5-->Pop-upTools-->remove AGS
然后是另一些弹窗,他们需要hosts去阻断链接。
我们选择使用“教程”中的方案2,“UpdateHostsFile”。但是需要注意的,这是一个自动化脚本存在风险,请在知晓此点后选择是否使用。
*执行之前先把GenP3.5放到“C:\GenP.v3.5.0-CGP\”这个位置,确保“C:\GenP.v3.5.0-CGP\GenP 3.5.0.exe”路径存在。然后请使用PowerShell执行以下的代码。
$scriptDir = "C:\Windows\System32\drivers\etc"
$scriptPath = "$scriptDir\UpdateHostsFile.ps1"
if (Get-ScheduledTask -TaskName "UpdateHostsFile" -ErrorAction SilentlyContinue) { Unregister-ScheduledTask -TaskName "UpdateHostsFile" -Confirm:$false }
if (-not (Test-Path -Path $scriptDir)) { New-Item -ItemType Directory -Path $scriptDir -Force }
Set-Content -Path $scriptPath -Value @'
$logDirectory = "C:\Windows\System32\drivers\etc"
$logFile = "$logDirectory\UpdateHostsFile.log"
if (-not (Test-Path -Path $logDirectory)) { New-Item -ItemType Directory -Path $logDirectory -Force }
Set-Content -Path $logFile -Value $null
function Write-Log {
param ([string]$message)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$logEntry = "$timestamp - $message"
Add-Content -Path $logFile -Value $logEntry
}
function Test-IsAdmin {
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Log "This script requires administrative privileges. Please run PowerShell as Administrator."
Write-Output "This script requires administrative privileges. Please run PowerShell as Administrator."
exit
}
}
function SafeFileOperation {
param (
[string]$Action,
[string]$Source,
[string]$Destination
)
try {
switch ($Action) {
"Copy" { Copy-Item -Path $Source -Destination $Destination -Force }
"Rename" { Rename-Item -Path $Source -NewName $Destination -Force }
}
Write-Log "$Action operation successful: $Source -> $Destination"
} catch {
Write-Log "Failed to $Action file: Please ensure the source file exists and you have the necessary permissions."
}
}
Test-IsAdmin
Write-Log "Script execution started."
$hostsFile = "C:\Windows\System32\drivers\etc\hosts"
$backupCurrent = "C:\Windows\System32\drivers\etc\hosts.bak"
$plainBackup = "C:\Windows\System32\drivers\etc\hosts.plain"
$tempFile = "$scriptDir\hosts_temp"
$primaryGenPPath = "C:\GenP.v3.5.0-CGP\GenP 3.5.0.exe"
if (-not (Test-Path $hostsFile)) {
Write-Log "The hosts file does not exist at the specified path: $hostsFile"
exit
}
if (-not (Test-Path $primaryGenPPath)) {
Write-Log "The specified GenP executable does not exist at: $primaryGenPPath"
exit
}
if ((Get-Item $hostsFile).Attributes -band [System.IO.FileAttributes]::ReadOnly) {
Write-Log "The hosts file is currently read-only. Attempting to remove read-only attribute."
try {
Set-ItemProperty -Path $hostsFile -Name IsReadOnly -Value $false
Write-Log "Removed read-only attribute from the hosts file."
} catch {
Write-Log "Could not change the read-only status of the hosts file. Please check permissions."
}
}
$currentContent = Get-Content -Path $hostsFile -Raw -ErrorAction SilentlyContinue
if (-not (Test-Path $backupCurrent) -or ($currentContent -ne (Get-Content -Path $backupCurrent -Raw -ErrorAction SilentlyContinue))) {
Write-Log "Creating a new backup of the hosts file."
SafeFileOperation -Action "Copy" -Source $hostsFile -Destination $backupCurrent
} else {
Write-Log "Hosts file has not changed since the last backup. Skipping backup."
}
$hostsContent = Get-Content -Path $hostsFile -Raw -ErrorAction SilentlyContinue
Write-Log "Hosts file content retrieved."
$maxRetries = 3
$retryDelay = 2
$newBlocklist = @()
Write-Log "Attempting to execute GenP.exe for blocklist."
try {
Start-Process -FilePath $primaryGenPPath -ArgumentList "-popup" -NoNewWindow -Wait
Write-Log "GenP.exe executed successfully."
$hostsContent = Get-Content -Path $hostsFile -Raw
if ($hostsContent -match "^0\.0\.0\.0") {
Write-Log "GenP.exe output detected and valid."
$newBlocklist = $hostsContent -split "`n" | Where-Object { $_.Trim() -match '^0\.0\.0\.0' }
} else {
Write-Log "GenP.exe output missing or invalid."
throw "Invalid GenP.exe output."
}
} catch {
Write-Log "Failed to run GenP to fetch the blocklist; please ensure the executable is present and try again."
}
if (-not $newBlocklist.Count) {
Write-Log "Attempting to retrieve blocklist from fallback URLs."
$encodedUrls = @(
"aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL2lnbmFjaW9jYXN0cm8vYS1kb3ZlLWlzLWR1bUIvcmVmcy9oZWFkcy9tYWluL2xpc3QudHh0",
"aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL2lnbmFjaW9jYXN0cm8vYS1kb3ZlLWlzLWR1bUIvcmVmcy9oZWFkcy9tYWluL3dpbmhvc3RzLnR4dA=="
)
foreach ($encodedUrl in $encodedUrls) {
$decodedUrl = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encodedUrl))
Write-Log "Trying to access fallback URL."
for ($attempt = 1; $attempt -le $maxRetries; $attempt++) {
try {
Write-Log "Retrieving blocklist content from fallback URL."
$response = Invoke-WebRequest -Uri $decodedUrl -Method Get -ErrorAction Stop
if ($response.Content) {
Write-Log "Successfully retrieved content from fallback URL on attempt $attempt."
$newBlocklist += $response.Content -split "`n" | Where-Object { $_ -match "^0\.0\.0\.0|^# Last update:" }
break
}
} catch {
Write-Log "Failed to connect to the provided URL; please check internet connectivity or the URL itself."
if ($attempt -lt $maxRetries) {
Write-Log "Retrying in $retryDelay seconds."
Start-Sleep -Seconds $retryDelay
}
}
}
if ($newBlocklist.Count -gt 0) { break }
}
}
if ($newBlocklist.Count -eq 0) {
Write-Log "No valid blocklist entries retrieved from all sources. Attempting to restore hosts file from hosts.plain."
if (Test-Path $plainBackup) {
Write-Log "Restoring hosts file from hosts.plain file."
$plainContent = Get-Content -Path $plainBackup -Raw -ErrorAction SilentlyContinue
if (-not [string]::IsNullOrWhiteSpace($plainContent)) {
Write-Log "Restoring hosts file."
Set-Content -Path $hostsFile -Value $plainContent -NoNewline
Write-Log "Successfully restored hosts file from hosts.plain."
} else {
Write-Log "hosts.plain is empty or invalid; unable to restore hosts file."
}
} else {
Write-Log "hosts.plain file does not exist; cannot restore hosts file."
Write-Log "Restoring hosts file from backup."
SafeFileOperation -Action "Copy" -Source $backupCurrent -Destination $hostsFile
}
Write-Log "Exiting script."
exit
}
Write-Log "Total valid blocklist entries pulled: $($newBlocklist.Count)"
$blocklistHeader = "# START - Adobe Blocklist"
$blocklistFooter = "# END - Adobe Blocklist"
$lastUpdateComment = ""
foreach ($line in $newBlocklist) {
if ($line.Trim().StartsWith("# Last update:")) {
$lastUpdateComment = "`n$($line.Trim())"
}
}
$filteredBlocklist = $newBlocklist | Where-Object { -not ($_.Trim().StartsWith("# Last update:")) -and $_.Trim() -ne "" }
$finalContent = ""
if (Test-Path $plainBackup) {
$plainContent = Get-Content -Path $plainBackup -Raw -ErrorAction SilentlyContinue
if (-not [string]::IsNullOrWhiteSpace($plainContent)) {
Write-Log "Including content from hosts.plain at the top of the hosts file."
$finalContent += $plainContent.Trim() + "`n"
} else {
Write-Log "The file hosts.plain is empty; it will not be included."
}
}
$finalContent += "$blocklistHeader$lastUpdateComment`n$($filteredBlocklist -join "`n")`n$blocklistFooter".Trim()
$finalContent = $finalContent -replace "`r?`n`r?`n", "`n"
for ($attempt = 1; $attempt -le $maxRetries; $attempt++) {
try {
Start-Sleep -Seconds 1
Write-Log "Attempting to write to $tempFile, Attempt #$attempt"
if ((Get-Item $hostsFile).Attributes -band [System.IO.FileAttributes]::ReadOnly) {
Write-Log "The hosts file is currently read-only. Attempting to remove read-only attribute."
Set-ItemProperty -Path $hostsFile -Name IsReadOnly -Value $false
Write-Log "Removed read-only attribute from hosts file."
}
Set-Content -Path $tempFile -Value $finalContent -NoNewline
Write-Log "Temporary file created successfully."
SafeFileOperation -Action "Copy" -Source $tempFile -Destination $hostsFile
Write-Log "Hosts file successfully updated from temporary file."
break
} catch {
Write-Log "An error occurred while updating the hosts file. Ensure you have sufficient permissions."
if ($errorMsg -like "*denied*") {
Write-Log "Access to $hostsFile is denied. Retrying in $retryDelay seconds..."
Start-Sleep -Seconds $retryDelay
} else {
Write-Log "An unexpected error occurred: $errorMsg"
break
}
}
}
Remove-Item -Path $tempFile -ErrorAction SilentlyContinue
Write-Log "Script execution completed successfully."
'@
if (Test-Path $scriptPath) {
Write-Output "Script file successfully created at $scriptPath."
} else {
Write-Output "Script file creation failed. Please check permissions or paths."
}
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`""
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Hours 3) -RepetitionDuration (New-TimeSpan -Days 3650)
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -MultipleInstances IgnoreNew -ExecutionTimeLimit (New-TimeSpan -Minutes 2)
try {
Register-ScheduledTask -TaskName "UpdateHostsFile" -Action $action -Trigger $trigger -Settings $settings -User "SYSTEM" -RunLevel Highest
Write-Output "Scheduled task 'UpdateHostsFile' created successfully."
} catch {
Write-Output "Failed to create scheduled task."
}
Start-Sleep -Seconds 5
try {
Start-ScheduledTask -TaskName "UpdateHostsFile"
Write-Output "Scheduled task 'UpdateHostsFile' started successfully."
} catch {
Write-Output "Failed to start scheduled task."
}
Start-Process -FilePath "powershell.exe" -ArgumentList "-Command exit"
Stop-Process -Id $PID -Force
exit
运行完这个脚本后打开任务计划程序-->任务计划程序库-->UpdateHostFile-->运行
检查一下hosts文件内是否发生了变化。
3.文末
这只是幻梦本人在使用过程中的操作步骤,需要更详细的帮助请使用文章头部留下的链接,看完后足够解决大部分问题。