Implement rudimentary multi-console support

This commit is contained in:
Logan 2024-09-07 23:27:39 -06:00 committed by GitHub
parent ca11632340
commit 06e2b05a6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 55 additions and 28 deletions

View File

@ -2,26 +2,47 @@
# This is my private file, but with all of the dangerous stuff removed
# You can use it as a template for yours
SERIAL_NUMBER:str = "" # Serial number on console minus the last digit
MAC_ADDRESS:str = "" # Console MAC address (see WiFi settings), all lowercase with no colons
DEVICE_CERT:bytes = bytes.fromhex("") # Unique console certificate. Get from sniffing traffic or from the LocalSeedFriendCode file
DEVICE_NAME:str = "" # Doesn't matter
###### NINTENDO INFO ##########
NINTENDO_SERIAL_NUMBER:str = "" # Serial number on console minus the last digit
NINTENDO_MAC_ADDRESS:str = "" # Console MAC address (see WiFi settings), all lowercase with no colons
NINTENDO_DEVICE_CERT:bytes = bytes.fromhex("") # Unique console certificate. Get from sniffing traffic or from LocalSeedFriendCode
NINTENDO_DEVICE_NAME:str = "" # Doesn't matter
# 3DS does NOT send NEX credentials over NASC
# They are generated once when the account is created and stored on the device
# Homebrew like https://github.com/Stary2001/nex-dissector/tree/master/get_3ds_pid_password
# can be used to dump the PID and password
# You must redump these keys for each network.
# You must dump the nex keys for each network.
NINTENDO_PID:int = 0
NINTENDO_NEX_PASSWORD:str = ""
NINTENDO_NEX_PASSWORD:str = ''
NINTENDO_PID_HMAC:str = "" # Sniff console traffic or dump from friends title save (bytes 66-84)
NINTENDO_REGION:int = 1 # USA
NINTENDO_LANGUAGE:int = 1 # English
##### PRETENDO INFO #######
PRETENDO_SERIAL_NUMBER:str = "" # Serial number on console minus the last digit
PRETENDO_MAC_ADDRESS:str = "" # Console MAC address (see WiFi settings), all lowercase with no colons
PRETENDO_DEVICE_CERT:bytes = bytes.fromhex("") # Unique console certificate. Get from sniffing traffic or from LocalSeedFriendCode
PRETENDO_DEVICE_NAME:str = "" # Doesn't matter
# 3DS does NOT send NEX credentials over NASC
# They are generated once when the account is created and stored on the device
# Homebrew like https://github.com/Stary2001/nex-dissector/tree/master/get_3ds_pid_password
# can be used to dump the PID and password
# You must dump the nex keys for each network.
PRETENDO_PID:int = 0
PRETENDO_NEX_PASSWORD:str = ""
PRETENDO_NEX_PASSWORD:str = ''
PID_HMAC:str = "" # Sniff console traffic or dump from friends title save (bytes 66-84) somewhere im the file
PRETENDO_PID_HMAC:str = "" # Sniff console traffic or dump from friends title save (bytes 66-84)
REGION:int = 1 # USA
LANGUAGE:int = 1 # English
PRETENDO_REGION:int = 1 # USA
PRETENDO_LANGUAGE:int = 1 # English
#########################
# Now, Discord secrets! #

View File

@ -11,7 +11,7 @@ import anyio, sys, argparse
from database import start_db_time, get_db_url, Friend, DiscordFriends
sys.path.append('../')
from api.private import SERIAL_NUMBER, MAC_ADDRESS, DEVICE_CERT, DEVICE_NAME, REGION, LANGUAGE, NINTENDO_PID, PRETENDO_PID, PID_HMAC, NINTENDO_NEX_PASSWORD, PRETENDO_NEX_PASSWORD
from api.private import NINTENDO_NEX_PASSWORD, NINTENDO_SERIAL_NUMBER, NINTENDO_MAC_ADDRESS, NINTENDO_DEVICE_CERT, NINTENDO_DEVICE_NAME, NINTENDO_REGION, NINTENDO_LANGUAGE, PRETENDO_NEX_PASSWORD, NINTENDO_PID, NINTENDO_PID_HMAC, PRETENDO_SERIAL_NUMBER, PRETENDO_MAC_ADDRESS, PRETENDO_DEVICE_CERT, PRETENDO_DEVICE_NAME, PRETENDO_REGION, PRETENDO_LANGUAGE, PRETENDO_PID, PRETENDO_PID_HMAC
from api import *
from api.love2 import *
from api.networks import NetworkType, InvalidNetworkError
@ -52,24 +52,30 @@ async def main():
# TODO: This should be separate between networks.
# E.g. if the friend code was is banned on one network,
# you'd still be able to keep the friend code for the other network.
client.set_title(0x0004013000003202, 20)
client.set_locale(REGION, LANGUAGE)
match network:
case NetworkType.NINTENDO:
client.set_locale(NINTENDO_REGION, NINTENDO_LANGUAGE)
client.set_url("nasc.nintendowifi.net")
PID = NINTENDO_PID
NEX_PASSWORD = NINTENDO_NEX_PASSWORD
client.set_device(NINTENDO_SERIAL_NUMBER, NINTENDO_MAC_ADDRESS, NINTENDO_DEVICE_CERT, NINTENDO_DEVICE_NAME)
client.set_user(PID, NINTENDO_PID_HMAC)
case NetworkType.PRETENDO:
client.set_locale(PRETENDO_REGION, PRETENDO_LANGUAGE)
if network == NetworkType.NINTENDO:
client.set_url("nasc.nintendowifi.net")
PID = NINTENDO_PID
NEX_PASSWORD = NINTENDO_NEX_PASSWORD
elif network == NetworkType.PRETENDO:
client.set_url("nasc.pretendo.cc")
client.context.set_authority(None)
PID = PRETENDO_PID
NEX_PASSWORD = PRETENDO_NEX_PASSWORD
else:
raise InvalidNetworkError(f"Network type {network} is not configured for querying")
client.set_device(SERIAL_NUMBER, MAC_ADDRESS, DEVICE_CERT, DEVICE_NAME)
client.set_user(PID, PID_HMAC)
client.set_url("nasc.pretendo.cc")
client.context.set_authority(None)
PID = PRETENDO_PID
NEX_PASSWORD = PRETENDO_NEX_PASSWORD
client.set_device(PRETENDO_SERIAL_NUMBER, PRETENDO_MAC_ADDRESS, PRETENDO_DEVICE_CERT, PRETENDO_DEVICE_NAME)
client.set_user(PID, PRETENDO_PID_HMAC)
case _:
raise InvalidNetworkError(f"Network type {network} is not configured for querying")
client.set_title(0x0004013000003202, 20)
response = await client.login(0x3200)
s = settings.load('friends')