├── .gitattributes ├── .vscode └── launch.json ├── App.ps1 ├── Console-HostGenerator.ps1 └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Console-HostGenerator", 6 | "type": "PowerShell", 7 | "request": "launch", 8 | "script": "${workspaceFolder}/Console-HostGenerator.ps1", 9 | "args": [] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /App.ps1: -------------------------------------------------------------------------------- 1 | Class App { 2 | [void] Main() { 3 | $this.Welcome() 4 | $this.GenerateHost($this.GetHostPath()) 5 | $this.Closing() 6 | } 7 | 8 | hidden [void] Welcome() { 9 | Clear-Host 10 | Write-Host "Console HostGenerator 启动!" -ForegroundColor Red 11 | } 12 | 13 | hidden [string] GetHostPath() { 14 | [string] $hostPath = [string]::Empty 15 | 16 | while (-not (Test-Path $hostPath -PathType Container)) { 17 | $hostPath = (Read-Host "输入 Cealing-Host-List.json 文件保存目录路径 (默认脚本根目录)").Trim("""") 18 | 19 | if ([string]::IsNullOrWhiteSpace($hostPath)) { $hostPath = $PSScriptRoot } 20 | } 21 | 22 | return $hostPath 23 | } 24 | 25 | hidden [void] GenerateHost([string] $hostPath) { 26 | [bool] $isGeneralList = $false 27 | [string] $lastListDomain = [string]::Empty 28 | 29 | foreach ($listRule in [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String((Invoke-WebRequest "https://gitlab.com/gfwlist/gfwlist/raw/master/gfwlist.txt"))) -split "`n") { 30 | if (-not $isGeneralList) { 31 | if ($listRule.Contains("General List Start")) { 32 | Set-Content (Join-Path $hostPath "Cealing-Host-List.json") "[" 33 | 34 | $isGeneralList = $true 35 | } 36 | 37 | continue 38 | } 39 | elseif ($listRule.Contains("General List End")) { 40 | Add-Content (Join-Path $hostPath "Cealing-Host-List.json") "]" -NoNewline 41 | 42 | return 43 | } 44 | 45 | if ($listRule -notmatch "^[!@\[/]" -and -not [string]::IsNullOrWhiteSpace($listRule)) { 46 | [string] $listDomain = $listRule.Trim() -replace "^[|.*]+", [string]::Empty -replace "^https?://", [string]::Empty -replace "/.*$", [string]::Empty 47 | [int] $tryCount = 3 48 | 49 | if ($listDomain -eq $lastListDomain) { continue } 50 | else { $lastListDomain = $listDomain } 51 | 52 | while ($true) { 53 | try { 54 | [array] $hostIpAnswer = (Invoke-RestMethod "https://ns.net.kg/dns-query?name=$listDomain").Answer 55 | 56 | if ($hostIpAnswer) { Add-Content (Join-Path $hostPath "Cealing-Host-List.json") "`t[[""*$listDomain""],"""",""$($hostIpAnswer[-1].data)""]," } 57 | else { Write-Host "$listDomain 解析失败" } 58 | 59 | break 60 | } 61 | catch { 62 | if (-not $tryCount--) { 63 | Write-Host "$listDomain 解析失败" 64 | 65 | break 66 | } 67 | } 68 | } 69 | } 70 | } 71 | } 72 | 73 | hidden [void] Closing() { 74 | Write-Host "伪造规则,生出来啦!" -ForegroundColor Red 75 | } 76 | } -------------------------------------------------------------------------------- /Console-HostGenerator.ps1: -------------------------------------------------------------------------------- 1 | param ([string] $trans, [switch] $loop) 2 | 3 | do { 4 | if (Test-Path $trans) { Start-Transcript (Join-Path $trans "Trans.log") -UseMinimalHeader | Out-Null } 5 | 6 | if ($PSEdition -ne "Core") { 7 | Write-Host "该脚本需要在 PowerShell 7.x 环境运行" 8 | } 9 | else { 10 | foreach ($ps1File in Get-ChildItem $PSScriptRoot "*.ps1") { 11 | if ($ps1File.FullName -ne $PSCommandPath) { . $ps1File.FullName } 12 | } 13 | 14 | [App]::new().Main() 15 | } 16 | 17 | if (Test-Path $trans) { Stop-Transcript } 18 | if ($loop) { Start-Sleep 60 } 19 | } while ($loop) 20 | 21 | Read-Host "按回车键结束" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Console - HostGenerator

2 |

- Gen Gen Need Cealing Host -

3 |
4 | 5 | ## 自我介绍 6 | **Console HostGenerator**: 一只基于 **Pwsh(.Net8)** 的 Cealing Host 自动化生成工具 (目前仅支持从 GFWList 生成) 7 | 8 | * 适用平台: Any 9 | 10 | ## 词汇解释 11 | **[Sheas Cealer Dictionary](https://github.com/SpaceTimee/Sheas-Cealer/wiki/Sheas-Cealer-Dictionary)** 12 | 13 | ## 注意事项 14 | 本项目仅供测试 Sheas Cealer 的 单次规则注入量 极限,无意绕过任何审查设备的审查 15 | 16 | ## 下载地址 17 | Github Release: [https://github.com/SpaceTimee/Console-HostGenerator/releases](https://github.com/SpaceTimee/Console-HostGenerator/releases) 18 | 19 | ## 食用方式 20 | 在 pwsh 7.x 环境中运行 Console-HostGenerator.ps1 脚本 -> 按照提示操作即可 21 | 22 | ## 开发者 23 | **Space Time** 24 | 25 | ## 联系方式 26 | 1. **QQ 群 (主群): 1034315671,716266896,338919498** 27 | 2. TG 群 (分群): [PixCealerChat](https://t.me/PixCealerChat) 28 | 3. **邮箱: Zeus6_6@163.com** 29 | 30 | •ᴗ• 31 | --------------------------------------------------------------------------------