[Wii Hack] Tiny DNS Server in Python

3 min read

Deviation Actions

WindyPower's avatar
By
Published:
5.2K Views
I've recently stumbled upon a video featuring the Wii Shop Channel being used as a web browser.
The trick is here is to get your Wii to use a custom DNS server which returns, on purpose, an invalid IP for the Wii Shop website. As a result, the Wii Shop Channel, which is in fact a stripped-down version of the Wii Browser, goes on that site instead of the normal Wii Shop.

As you might expect, the temptation was too great; I had to fiddle with this myself. After failed attempts at getting some DNS server software running on my computer, I decided to make my own. I taught myself Python and, within about 3 hours, had a custom little DNS server running on my machine.
Here's the code:
import socket
import sys

def getip(domain):
if domain[-12:]=='shop.wii.com':
return '71.18.85.26'
# Some elif's could be added here in order to remap other IPs.
else:
return socket.gethostbyname(domain)
def char(x):
return chr(int(x,10))
print 'DNS server launched'
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.bind(('',53))
try:
while 1:
data,addr=sock.recvfrom(1024)
index=12
domain=''
curcode=ord(data[index])
while curcode!=0:
domain+=data[index+1:curcode+index+1]+'.'
index+=curcode+1
curcode=ord(data[index])
domain=domain[:-1]
ip=getip(domain)
print 'Domain requested: '+domain+', IP returned: '+ip+'.'
ret=data[:2]+'x81x80'+(data[4:6]*2)+('x00'*4)+data[12:]+'xc0x0c'+('x00x01'*2)+('x00'*3)+'x3cx00x04'+str.join('',map(char,ip.split('.' )))
sock.sendto(ret,addr)

except KeyboardInterrupt:
print 'Shutting down server'
sock.close()
Here's the colored and correctly tabbed code. (click me instead of having to suffer deviantArt's sucky support for code!)

Now what happened is that, occasionally, the Wii Shop showed a blank page, sometimes not. In either case, it showed an error message about the page having "timed out".
That's a problem I couldn't solve, despite changing the "fake" IP or giving the same IP for any host instead of just *.shop.wii.com.

Since I do have the full, official Wii Browser on my Wii, this might seem pointless. But as a geek and as it could be helpful to some people out there, I just had to try. So I'm launching this code just like a bottle in the sea. It's a project that you guys might want to catch, and if you do, thank you~
Anyone can also use this code if needed, it's a simple and very short DNS server.

Now, what if I, instead of tricking the Wii's DNS server settings, what about... The proxy settings? :plotting: Will look into those next weekend...
© 2008 - 2024 WindyPower
Comments2
Join the community to add your comment. Already a deviant? Log In
Simadons's avatar
Same here but for the PS3