Skip to content

Latest commit

Β 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GhostVPN πŸ‘»

A rotating-IP VPN that routes your traffic through a pool of free SOCKS5 proxies and changes your public IP every N minutes. No paid APIs, no subscriptions.

Python Platform License Security

How it works

                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
Your browser ──▢ tun0 ──▢ β”‚ iptables REDIRECT        β”‚
      β”‚                   β”‚  TCP :80/443 β†’ :12345     β”‚
      β”‚                   β”‚  UDP :53    β†’ :5353       β”‚
      β”‚                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                                β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚  β”‚          TransProxy (:12345)                   β”‚
      β”‚  β”‚    TCP through SOCKS5 proxy pool               β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                                β”‚
      β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚  β”‚          DnsProxy (:5353)                     β”‚
      β”‚  β”‚    DNS over TCP through SOCKS5 β†’ 1.1.1.1      β”‚
      β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      └──────────────│ SOCKS5 proxy pool            β”‚
                     β”‚  (rotates every N s)         β”‚
                     β”‚  proxy1 ──▢ internet (IP 1)  β”‚
                     β”‚  proxy2 ──▢ internet (IP 2)  β”‚
                     β”‚  proxy3 ──▢ internet (IP 3)  β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Three modes:

  • TUN mode (Linux) β€” system-wide VPN using tun + iptables. All TCP traffic goes through the proxy automatically. DNS queries are forwarded through the proxy via a local DNS forwarder to prevent leaks.
  • Wintun mode (Windows) β€” system-wide VPN using Wintun TAP adapter. Routes all TCP traffic through the SOCKS5 proxy pool. DNS forwarded through the tunnel.
  • SOCKS mode (Linux, macOS, Windows) β€” local SOCKS5 proxy on 127.0.0.1:10800. Configure your apps or system proxy to use it.

Quick start

Linux (TUN mode β€” full system VPN)

cd GhostVPN
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Interactive menu (recommended)
sudo .venv/bin/python3 vpn.py

# CLI mode (for scripts)
sudo .venv/bin/python3 vpn.py --cli --interval 30

The interactive menu starts the VPN from option [1]. Configure settings via option [2].

macOS (SOCKS mode)

cd GhostVPN
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Interactive menu (no root needed)
python3 vpn.py

# Or use settings β†’ enable system proxy, or run directly:
python3 vpn.py --cli --mode socks --sys-proxy

Configure your browser to use SOCKS5 127.0.0.1:10800, or let GhostVPN set the system proxy automatically.

Windows (Wintun mode β€” full system VPN)

cd GhostVPN
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

# Interactive menu (no admin needed, Wintun auto-downloaded)
python vpn.py

# CLI mode
python vpn.py --cli --mode windows

Usage

Interactive menu (default)

Run python vpn.py to see:

   ________  ______  ____________    ______  _   __
  / ____/ / / / __ \/ ___/_  __/ |  / / __ \/ | / /
 / / __/ /_/ / / / /\__ \ / /  | | / / /_/ /  || /
/ /_/ / __  / /_/ /___/ // /   | |/ / ____/ /|  /
\____/_/ /_/\____//____//_/    |___/_/   /_/ |_/

              πŸ‘»  ROTATING IP VPN  πŸ‘»

  MAIN MENU

     [1] β–Ά  START VPN  (TUN (Linux) / Wintun (Windows))
          interval=180s  port=10800

     [2] Settings
     [3] About
     [4] Exit

  └─ Choice:
  • [1] β€” starts the VPN with current settings
  • [2] β€” configure mode, interval, port, proxy source, system proxy, kill switch
  • [3] β€” version, license, repo link
  • [4] β€” exit

CLI mode (--cli)

python vpn.py --cli [options]
Flag Default Description
--mode tun (Linux), windows (Win), socks (else) tun = system VPN (Linux), windows = Wintun VPN (Windows), socks = local proxy
--interval 180 Seconds between IP rotations
--proxies β€” Path to custom proxy list (host:port per line)
--proxy-port 10800 Local SOCKS proxy port (socks mode)
--sys-proxy off Automatically set system proxy (macOS/Windows)
--kill-switch off Drop connections if all proxies fail (no IP leak)
--verbose off Debug-level logs

Custom proxy lists

python vpn.py --cli --mode socks --proxies proxies.txt

Platform comparison

Feature Linux (TUN) macOS (SOCKS) Windows (Wintun)
System-wide routing βœ… Automatic ⚠️ Manual app config βœ… Automatic
Root required βœ… Yes ❌ No ❌ No
Proxy rotation βœ… βœ… βœ…
Kill switch βœ… --kill-switch βœ… βœ…
DNS leak protection βœ… Built-in ⚠️ Manual app config βœ… Built-in
Auto system proxy ❌ βœ… --sys-proxy ❌
UDP/ICMP ❌ Not supported ❌ Not supported ❌ Not supported

Verification

watch -n 10 curl -s ifconfig.me

Security

GhostVPN has the following security features enabled:

  • Private vulnerability reporting β€” report issues privately at https://github.com/20player11/GhostVPN/security/advisories
  • Dependabot alerts β€” automatic notifications for vulnerable dependencies
  • Dependabot security fixes β€” auto-generated PRs for patched dependencies
  • CodeQL code scanning β€” runs on every push/PR via GitHub Actions
  • SECURITY.md β€” disclosure policy with 24h/7d/30d response timeline

Known limitations

  • Encryption β€” GhostVPN does not encrypt traffic end-to-end. SOCKS5 proxies see plaintext data. Use HTTPS/TLS for sensitive traffic.
  • Privilege separation β€” The VPN runs in a single process. No sandboxing or seccomp is applied.
  • DNS β€” DNS queries are redirected through the VPN via the built-in DNS proxy (dns.py). No more DNS leaks.
  • IPv6 β€” IPv6 traffic is blocked in TUN mode to prevent leaks. SOCKS mode only handles IPv4.

Project structure

vpn/
β”œβ”€β”€ vpn.py            # CLI entry β€” interactive menu or --cli mode
β”œβ”€β”€ ui.py             # Rich terminal UI (menus, status display, about)
β”œβ”€β”€ windows_vpn.py    # Windows Wintun adapter, TCP forwarding, DNS tunnel
β”œβ”€β”€ wintun_dl.py      # Auto-downloads wintun.dll at runtime
β”œβ”€β”€ tun.py            # Linux TUN device, routing, iptables
β”œβ”€β”€ transproxy.py     # Linux transparent TCP β†’ SOCKS5 proxy
β”œβ”€β”€ local_proxy.py    # Cross-platform SOCKS5 proxy server
β”œβ”€β”€ proxy_pool.py     # Auto-fetch, health-check, rotation
β”œβ”€β”€ dns.py            # DNS forwarder (prevents DNS leaks in TUN mode)
β”œβ”€β”€ utils.py          # Logging, IP lookup, helpers
β”œβ”€β”€ requirements.txt  # PySocks, pyfiglet, rich, questionary
β”œβ”€β”€ LICENSE           # MIT
└── README.md

Troubleshooting

Linux: "Failed to create tun"

sudo modprobe tun

macOS: "networksetup" errors

Approve Terminal in System Settings β†’ Privacy & Security β†’ Accessibility.

No working proxies found

Proxy lists change. Try again later or use --proxies with your own list.

Internet stops after Ctrl+C (Linux)

sudo iptables -t nat -F OUTPUT
sudo ip rule del pref 20000 2>/dev/null
sudo ip rule del pref 1000 2>/dev/null
sudo ip link del tun0 2>/dev/null

Dependencies

  • PySocks β€” SOCKS5 client protocol
  • pyfiglet β€” ASCII art generation
  • rich β€” Terminal UI components
  • questionary β€” Interactive prompts

License

MIT

About

A system-wide rotating-IP VPN that routes TCP traffic through a pool of free SOCKS5 proxies. No paid APIs.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages