Homebrew Save Nintendo WiFi - A project to save online servers for DS (and Wii) games

Shicky256

Well-Known Member
Member
Joined
Oct 13, 2013
Messages
140
Trophies
0
Age
34
XP
192
Country
United States
I tried using that with Mario Kart Wii, but I wasn't able to login. The program always told be "Invalid password". Do you have any clue why? What password does the tool want to have?
I'm pretty sure that the tool is only for Nintendo DS games, as Wii games use a different service that is SSL only.
 

leseratte

Wiimmfi Team
Member
Joined
Jun 2, 2012
Messages
453
Trophies
1
XP
1,859
Country
Germany
With a few modifications the login now works, but after logging in (just after the SQL query "UPDATE users SET firstname = qwertzuiop WHERE profileid = 1") the Wii sends a large command with its friend list:

Code:
[Sun Apr  6 15:09:01 2014] RESPONSE: \addbuddy\\sesskey\981482095\newprofileid\302594991\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\324078642\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\450197498\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\368031897\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\447214276\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\304111337\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\469604577\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\453830866\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\420030955\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\369478991\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\444241868\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\460250854\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\354860031\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\193178453\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\239675261\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\349855648\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\456284963\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\394609454\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\362755626\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\301273266\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\461622261\reason\\final\\addbuddy\\sesskey\981482095\newprofileid\449615791\reason\\final\\addbudd
 
Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 88, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 73, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in doRead
    return self._dataReceived(data)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 221, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/basic.py", line 588, in dataReceived
    why = self.rawDataReceived(data)
  File "./gamespy_server.py", line 51, in rawDataReceived
    commands = gs_query.parse_gamespy_message(data)
  File "/home/florian/mkw-ana/serverabschaltung/n_dwc_emu/gamespy/gs_query.py", line 14, in parse_gamespy_message
    keyEnd = msg[1:].index('\\') + 1
exceptions.ValueError: substring not found

But the script tells me any "substring" wasn't found. Is this because the list is too long an cut off at the end ("\addbudd")?
 

leseratte

Wiimmfi Team
Member
Joined
Jun 2, 2012
Messages
453
Trophies
1
XP
1,859
Country
Germany
It works not very good yet. When it works better, I'll upload the changed version here.
But maybe I broke the login for other games with that modification.

I now tried logging in with a friendlist that fits in one packet, but then the Wii logs off immediately after sending this list:

Code:
{'status': '1', '__cmd_val__': '1', 'statstring': '/SCM/1/SCN/0/VER/90', '__cmd__': 'status', 'sesskey': '465432385', 'locstring': ''}
{'updatepro': '', 'firstname': 'Wii:0241451532206033@RMCP', '__cmd_val__': '', '__cmd__': 'updatepro', 'sesskey': '465432385', 'partnerid': '11'}
UPDATE users SET firstname = Wii:0241451532206033@RMCP WHERE profileid = 466547024
[Sun Apr  6 15:26:45 2014] RESPONSE: \addbuddy\\sesskey\465432385\newprofileid\193178453\reason\\final\
 
{'addbuddy': '', '__cmd_val__': '', 'reason': '', '__cmd__': 'addbuddy', 'sesskey': '465432385', 'newprofileid': '193178453'}
[Sun Apr  6 15:26:45 2014] RESPONSE: \logout\\sesskey\465432385\final\
 
{'sesskey': '465432385', 'logout': '', '__cmd__': 'logout', '__cmd_val__': ''}
Session 465432385 has logged off

Do you have a Wii for testing this? You'll need Homebrew on your Wii because you have to patch MKWii to use the nas instead of naswii server: http://forum.wii-homebrew.com/board...lish/51192-dev-net-ssl/index2.html#post584499

Then you can use the modified version of your script here. The names of the variables might not fit to their contents, but it seems to work.

At the moment you have to edit the database manually and correct the profile ID (if you don't create a new profile) - it must be the same than the profile id used by the Wii.
 

Attachments

  • n_dwc_emu.zip
    122 KB · Views: 209

leseratte

Wiimmfi Team
Member
Joined
Jun 2, 2012
Messages
453
Trophies
1
XP
1,859
Country
Germany
Whether if I have somebody in my friend list or not, the wii disconnects shortly after the status packet. That happens if using a new profile, too.
 

leseratte

Wiimmfi Team
Member
Joined
Jun 2, 2012
Messages
453
Trophies
1
XP
1,859
Country
Germany
The sake server is only important for leaderboards - it can be ignored for now.

Thanks for the tip, I forgot the gsps. When forwarding the gsps to the original server, it works (but only with those where all the "addbuddy" fits in one packet").

You should ask Wiimm about that - he knows the whole protocol of gsps and I think he has a working one, too.
 

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
Hey Nagato, managed to set up the server on my end, but I'm running into this problem when trying to connect:

Code:
[Sun Apr  6 13:10:48 2014] SENDING: '\lc\1\challenge\1Ud2wlIK\id\1\final\'...
 
[Sun Apr  6 13:10:48 2014] RESPONSE: \login\\challenge\ZSDDDGfeiJmFMnsyyPdNM99Ysde0AFAH\authtoken\NDSdXNlcmlkXDY1NDc2NjExNDQxMDh8cGFzc3dkXDk4OXxnYW1lY2RcQU1IRXxkZXZuYW1lXFQAbwBhAGQAIABLAGkAbgBnAHxpbmdhbWVzblxUAG8AYQBkACAASwBpAG4AZwB8Y2hhbGxlbmdlXEtMSXVhaE9M\response\9ecdc71bba2f2b08beee818628333184\firewall\1\port\0\productid\10671\gamename\mprimeds\namespaceid\0\id\1\final\
 
{'authtoken': 'NDSdXNlcmlkXDY1NDc2NjExNDQxMDh8cGFzc3dkXDk4OXxnYW1lY2RcQU1IRXxkZXZuYW1lXFQAbwBhAGQAIABLAGkAbgBnAHxpbmdhbWVzblxUAG8AYQBkACAASwBpAG4AZwB8Y2hhbGxlbmdlXEtMSXVhaE9M', 'gamename': 'mprimeds', 'firewall': '1', 'namespaceid': '0', 'challenge': 'ZSDDDGfeiJmFMnsyyPdNM99Ysde0AFAH', '__cmd_val__': '', 'port': '0', '__cmd__': 'login', 'id': '1', 'login': '', 'response': '9ecdc71bba2f2b08beee818628333184', 'productid': '10671'}
{'gamecd': 'AMHE', 'passwd': '989', 'challenge': 'KLIuahOL', 'devname': 'T\x00o\x00a\x00d\x00 \x00K\x00i\x00n\x00g\x00', 'userid': '6547661144108', 'ingamesn': 'T\x00o\x00a\x00d\x00 \x00K\x00i\x00n\x00g\x00'}
Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 88, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 73, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in doRead
    return self._dataReceived(data)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 221, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/basic.py", line 578, in dataReceived
    why = self.rawDataReceived(data)
  File "gamespy_server.py", line 57, in rawDataReceived
    self.perform_login(data_parsed)
  File "gamespy_server.py", line 85, in perform_login
    uniquenick = utils.base32_encode(int(userid)) + authtoken_parsed['gsbrcd']
exceptions.KeyError: 'gsbrcd'

This is on reset Wi-Fi settings. It's happening in both Tetris DS and Metroid Prime Hunters. Any idea what's up?

EDIT: nas.nintendowifi.net log shows this:
Code:
POST:
action = YWNjdGNyZWF0ZQ** (acctcreate)
sdkver = MDAxMDAw (001000)
userid = NjU0NzY2MTE0NDEwOA** (6547661144108)
passwd = OTg5 (989)
bssid = MDA5Yzg1OTliYzZm (009c8599bc6f)
apinfo = MDA6MDAwMDAwMC0wMA** (00:0000000-00)
gamecd = QU1IRQ** (AMHE)
makercd = MDE* (01)
unitcd = MA** (0)
macadr = NDBmNDA3ZjZjZTk5 (40f407f6ce99)
lang = MDE* (01)
birth = MDUwYg** (050b)
devtime = MTQwNDA2MTMyMDAz (140406132003)
devname = VABvAGEAZAAgAEsAaQBuAGcA (T^@o^@a^@d^@ ^@K^@i^@n^@g^@)

GET:



POST:
action = YWNjdGNyZWF0ZQ** (acctcreate)
sdkver = MDAxMDAw (001000)
userid = NjU0NzY2MTE0NDEwOA** (6547661144108)
passwd = OTg5 (989)
bssid = MDA5Yzg1OTliYzZm (009c8599bc6f)
apinfo = MDA6MDAwMDAwMC0wMA** (00:0000000-00)
gamecd = QU1IRQ** (AMHE)
makercd = MDE* (01)
unitcd = MA** (0)
macadr = NDBmNDA3ZjZjZTk5 (40f407f6ce99)
lang = MDE* (01)
birth = MDUwYg** (050b)
devtime = MTQwNDA2MTMyMDA0 (140406132004)
devname = VABvAGEAZAAgAEsAaQBuAGcA (T^@o^@a^@d^@ ^@K^@i^@n^@g^@)
ingamesn = VABvAGEAZAAgAEsAaQBuAGcA (T^@o^@a^@d^@ ^@K^@i^@n^@g^@)

GET:
 

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
Yeah, it looks like it creates your console unique ID, so when I reset my Wi-Fi data it recreates it. Here's the back-and-forth on connection test:

Code:
Send:
action=YWNjdGNyZWF0ZQ**&sdkver=MDAxMDAw&userid=NTYxOTk0ODIwODE3Mg**&passwd=NzY0&bssid=MDA5Yzg1OTliYzZm&apinfo=MDA6MDAwMDAwMC0wMA**&gamecd=QU1IRQ**&makercd=MDE*&unitcd=MA**&macadr=NDBmNDA3ZjZjZTk5&lang=MDE*&birth=MDUwYg**&devtime=MTQwNDA2MTQwMjM0&devname=VABvAGEAZAAgAEsAaQBuAGcA
 
Receive:
retry=MA**&returncd=MDAy&datetime=MjAxNDA0MDYxODAzMDU*

Looks like the actual creation is done console-side and the server just confirms that it received it. There's probably errors it returns if they user info already exists, but I can't really test that.
 

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
Yeah that seems to work for now.

Metroid Prime Hunters is aborting on connection with 60000 Miscellaneous error. I'll try looking into that.
 

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
Hmm, I found out why it was happening. If you initially connect to the official servers and register with those, but then switch over to the custom servers, that causes the 60000 error. The only difference in the packet dumps I can find is after the \lc\ response, the DS then sends a \status\1\ request and then immediately sends a \logout\ request. Does the same thing if you switch from custom server to official server.
 

Charles n Cheese

New Member
Newbie
Joined
Apr 6, 2014
Messages
3
Trophies
0
Age
29
XP
52
Country
United States
I recently used Wiim's capture guide to get Professor Layton and was not sure if it was received but I want to help out with other things is there anything you guys need help with?
 

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
I recently used Wiim's capture guide to get Professor Layton and was not sure if it was received but I want to help out with other things is there anything you guys need help with?
In the PL games you need to patch the ROM to remove SSL from the network connections, because the majority of the online functionality of those games is downloading new puzzles, which all go through Nintendo's encrypted download server. If you can dump the ROM and patch it using Nagato's tool and us it in combination with my SSL tunnel then we can get plaintext dumps of the stuff being downloaded.

This could be automated on a PC but most of the development work is going into online gameplay instead of the download server. I might whip up something later for manually "browsing" the download server. From what I saw of it in Brawl, it's API isn't very complicated.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: It can act as a swap drive but that isn't more RAM, it's slooow.