← Back to Skills Marketplace
vay-qz

github改hosts文件加速skill,仅针对windows

by qz · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
73
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install github-hosts-windows
Description
Optimize GitHub access speed on Windows by finding the fastest IPs and updating the hosts file to reduce latency.
README (SKILL.md)

GitHub Hosts Optimizer

On Windows, directly modify C:\Windows\System32\drivers\etc\hosts to map GitHub domains to faster IPs.

Workflow

  1. Resolve GitHub IPs using nslookup:

    • github.com
    • api.github.com
    • objects.githubusercontent.com
  2. Ping each IP to measure latency (ping -n 3 \x3CIP>)

  3. Select fastest IP (lowest average latency)

  4. Update hosts file with entries:

    \x3Cfastest_ip> github.com
    \x3Cfastest_ip> api.github.com
    \x3Cfastest_ip> github.com  (duplicate for reliability)
    
  5. Flush DNS cache:

    ipconfig /flushdns
    

PowerShell Script

$hostsPath = "$env:SystemRoot\System32\drivers\etc\hosts"
$domains = @("github.com", "api.github.com", "objects.githubusercontent.com")

# Resolve IPs
$ips = @{}
foreach ($domain in $domains) {
    $result = nslookup $domain 2>$null
    $ips[$domain] = ($result | Select-String -Pattern "Addresses:" -Context 0,10 | ForEach-Object { $_.Context.PostContext }) -replace '\s+', '' | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+$' }
}

# Ping each IP and find fastest
$results = @()
foreach ($ip in ($ips.Values | Select-Object -Unique)) {
    $avg = (ping -n 3 $ip | Select-String -Pattern "平均").ToString() -replace '.*= (\d+)ms.*', '$1'
    if ($avg) { $results += [PSCustomObject]@{ IP = $ip; Avg = [int]$avg } }
}
$fastest = ($results | Sort-Object Avg | Select-Object -First 1).IP

# Update hosts
$entry = "$fastest github.com`n$fastest api.github.com"
$current = Get-Content $hostsPath -Raw -ErrorAction SilentlyContinue
if ($current -notmatch "github\.com") {
    Add-Content -Path $hostsPath -Value $entry
} else {
    $updated = $current -replace "[\d\.]+\s+github\.com`n?[\d\.]+\s+api\.github\.com", $entry
    Set-Content -Path $hostsPath -Value $updated
}

# Flush DNS
ipconfig /flushdns | Out-Null
Write-Host "Done! Fastest IP: $fastest"

Key Notes

  • Hosts file requires Administrator privileges to modify
  • If direct edit fails, output the entry and instruct user to manually add it
  • The fastest IP may change over time; re-run when GitHub access slows again
Usage Guidance
This skill does what it says (probe IPs and edit Windows hosts), but it performs a high‑privilege, system‑wide change with sloppy, locale‑dependent parsing and brittle replacement logic. Before installing or running it: (1) get the skill's source or homepage and review the exact script, (2) ensure you run it only with Administrator consent and after making a backup of C:\Windows\System32\drivers\etc\hosts, (3) prefer the script be modified to: back up hosts, validate IP ownership for GitHub, avoid locale‑dependent parsing, and use safer, more specific host entry replacement, (4) consider testing manually first rather than allowing an agent to run it autonomously. The domain/entry mismatches in the SKILL.md should be corrected before use.
Capability Analysis
Type: OpenClaw Skill Name: github-hosts-windows Version: 1.0.0 The skill automates the modification of the Windows system hosts file (C:\Windows\System32\drivers\etc\hosts) to optimize GitHub connectivity. While the logic in SKILL.md appears to serve its stated purpose by dynamically resolving IPs via nslookup and selecting the fastest via ping, the requirement for administrative privileges and the direct modification of system-level network configurations are high-risk behaviors. Additionally, the PowerShell script relies on localized string parsing (e.g., searching for '平均' for latency), which may cause unpredictable behavior on non-Chinese system locales.
Capability Assessment
Purpose & Capability
Name/description align with the actions (resolve IPs, test latency, edit Windows hosts). However the SKILL.md lists domains to resolve (including objects.githubusercontent.com) but the script only writes entries for github.com and api.github.com; the Workflow section also mentions a duplicate github.com line that the script does not include. These inconsistencies are sloppy and reduce confidence.
Instruction Scope
Instructions instruct the agent to read and modify C:\Windows\System32\drivers\etc\hosts (system‑wide), run nslookup/ping/ipconfig, and implicitly require Administrator privileges. The script does not back up the hosts file, its pattern matching/replacement is brittle (may fail or clobber unrelated lines), and parsing relies on locale-specific output (e.g., Chinese ping output matching '平均'). Those behaviors expand scope beyond a simple 'helper' and carry risk to network access.
Install Mechanism
Instruction-only skill with no install actions; nothing is written to disk by an installer. This is the lowest install risk.
Credentials
No environment variables, credentials, or external config paths are requested — appropriate for the stated purpose.
Persistence & Privilege
The skill asks the agent to modify the system hosts file, a persistent, system‑wide change that requires Administrator rights. While 'always' is false, the modification itself is high‑privilege and can affect all apps on the machine; the SKILL.md notes this but does not instruct creating a backup or a safe rollback.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install github-hosts-windows
  3. After installation, invoke the skill by name or use /github-hosts-windows
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of github-hosts-windows skill. - Automatically finds the fastest IP addresses for key GitHub domains on Windows. - Updates the hosts file to map GitHub domains to these IPs for improved access speed. - Provides a ready-to-use PowerShell script for the entire workflow: resolving IPs, measuring latency, updating hosts, and flushing DNS cache. - Triggers when users mention GitHub slowness or need to optimize/update GitHub-related hosts entries.
Metadata
Slug github-hosts-windows
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is github改hosts文件加速skill,仅针对windows?

Optimize GitHub access speed on Windows by finding the fastest IPs and updating the hosts file to reduce latency. It is an AI Agent Skill for Claude Code / OpenClaw, with 73 downloads so far.

How do I install github改hosts文件加速skill,仅针对windows?

Run "/install github-hosts-windows" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is github改hosts文件加速skill,仅针对windows free?

Yes, github改hosts文件加速skill,仅针对windows is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does github改hosts文件加速skill,仅针对windows support?

github改hosts文件加速skill,仅针对windows is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created github改hosts文件加速skill,仅针对windows?

It is built and maintained by qz (@vay-qz); the current version is v1.0.0.

💬 Comments