Skip to content

Instantly share code, notes, and snippets.

@zaknesler
Last active April 11, 2024 06:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zaknesler/e9836cae78456f50f7399b2ebd094923 to your computer and use it in GitHub Desktop.
Save zaknesler/e9836cae78456f50f7399b2ebd094923 to your computer and use it in GitHub Desktop.
Mojang VPN bypass
import os, ctypes, sys, socket
# Windows only.
# Mojang rightfully blocks banned IP addresses from authenticating. Most IP addresses on most VPN providers are banned.
# Running this file will route known Mojang IP addresses to the default gateway, bypassing any VPNs.
hosts = [
'sessionserver.mojang.com',
'authserver.mojang.com',
'mcoapi.minecraft.net',
'minecraft.net',
'mojang.com',
]
gateway = '192.168.0.1'
try:
if ctypes.windll.shell32.IsUserAnAdmin():
for host in hosts:
address = socket.gethostbyname(host)
print(f'Resolved { host} as { address }')
os.system(f'route add { address } { gateway }')
print()
else:
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
except:
print('Yeah that didn\'t work.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment