Ejemplo n.º 1
0
                           small_image="nn",
                           small_text=MAINID,
                           large_image=title_id.lower())

        else:
            print("Unknown notification type %i (from %s)" %
                  (event.type, name))

    def process_presence_change_event(self, context, event):
        self.process_nintendo_notification_event(context, event)


nnas = nnas.NNASClient()
nnas.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION)
nnas.set_locale(REGION, COUNTRY, LANGUAGE)
nnas.set_title(Friends.TITLE_ID_EUR, Friends.LATEST_VERSION)
nnas.login(USERNAME, PASSWORD)

nex_token = nnas.get_nex_token(Friends.GAME_SERVER_ID)
backend = backend.BackEndClient("friends.cfg")
backend.configure(Friends.ACCESS_KEY, Friends.NEX_VERSION)
backend.connect(nex_token.host, nex_token.port)

login_data = authentication.NintendoLoginData()
login_data.token = nex_token.token
backend.login(nex_token.username, nex_token.password, None, login_data)
backend.secure_client.register_server(NotificationServer())

input("Press enter to disconnect and exit\n")
backend.close()
Ejemplo n.º 2
0
response = baas.login(BAAS_USER_ID, BAAS_PASSWORD, app_token)

user_id = int(response["user"]["id"], 16)
id_token = response["idToken"]

# Connect to game server
backend = backend.BackEndClient("switch.cfg")
backend.configure(SMM2.ACCESS_KEY, SMM2.NEX_VERSION, SMM2.CLIENT_VERSION)
backend.connect(HOST, PORT)

# Log in on game server
auth_info = authentication.AuthenticationInfo()
auth_info.token = id_token
auth_info.ngs_version = 4  #Switch
auth_info.token_type = 2
backend.login(str(user_id), auth_info=auth_info)

# Search for ninji courses
store = datastore.DataStoreClientSMM2(backend.secure_client)

param = datastore.SearchCoursesEventParam()
courses = store.search_courses_event(param)
print("Found %i ninji courses.\n" % len(courses))

# Print information about the most recent ninji course
course = courses[0]
print("Name:", course.name)
print("Description:", course.description)
print("Start time:", course.upload_time)
print("End time:", course.end_time)
print()
Ejemplo n.º 3
0
api = AccountAPI()
api.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION, COUNTRY)
api.set_title(MK8.TITLE_ID_EUR, MK8.LATEST_VERSION)
api.login(USERNAME, PASSWORD)

my_pid = api.get_pid(USERNAME)
friend_pid = api.get_pid(FRIEND_NAME)

mii_name = api.get_mii(my_pid).name

# Connect to game server
nex_token = api.get_nex_token(MK8.GAME_SERVER_ID)
backend = backend.BackEndClient(MK8.ACCESS_KEY, MK8.NEX_VERSION)
backend.connect(nex_token.host, nex_token.port)
backend.login(
    nex_token.username, nex_token.password,
    authentication.AuthenticationInfo(nex_token.token, MK8.SERVER_VERSION))

matchmake_ext = matchmaking.MatchmakeExtensionClient(backend)

# Find friend room
playing_sessions = matchmake_ext.get_playing_session([friend_pid])
if not playing_sessions:
    raise RuntimeError("Couldn't find friend room for %s" % FRIEND_NAME)

gathering = playing_sessions[0].gathering

# Request session key (for p2p)
session_key = matchmake_ext.join_matchmake_session(gathering.id,
                                                   "This is NintendoClients")
Ejemplo n.º 4
0
PASSWORD = "******"  #Nintendo network password

api = account.AccountAPI()
api.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION,
               COUNTRY)  #Can't login without this
api.set_title(DKCTF.TITLE_ID_EUR, DKCTF.LATEST_VERSION
              )  #This is necessary to request a token for the game server
api.login(USERNAME, PASSWORD)

#Each game server has its own game server id and access token
nex_token = api.get_nex_token(DKCTF.GAME_SERVER_ID)

backend = backend.BackEndClient()
backend.configure(DKCTF.ACCESS_KEY, DKCTF.NEX_VERSION)
backend.connect(nex_token.host, nex_token.port)
backend.login(nex_token.username, nex_token.password)

order_param = ranking.RankingOrderParam()
order_param.offset = 0  #Start with the world record
order_param.count = 20  #Download 20 highscores

ranking_client = ranking.RankingClient(backend.secure_client)
rankings = ranking_client.get_ranking(
    ranking.RankingMode.GLOBAL,  #Get the global leaderboard
    0x893EB726,  #Category, this is 3-A (Magrove Cove)
    order_param,
    0,
    0)

print("Total:", rankings.total)
print("Rankings:")
api = account.AccountAPI()
api.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION, COUNTRY)
api.set_title(friends.FriendsTitle.TITLE_ID_EUR,
              friends.FriendsTitle.LATEST_VERSION)
api.login(USERNAME, PASSWORD)

pid = api.get_pid(USERNAME)
mii = api.get_mii(pid)

nex_token = api.get_nex_token(friends.FriendsTitle.GAME_SERVER_ID)
backend = backend.BackEndClient(friends.FriendsTitle.ACCESS_KEY,
                                friends.FriendsTitle.NEX_VERSION,
                                backend.Settings("friends.cfg"))
backend.connect(nex_token.host, nex_token.port)
backend.login(nex_token.username, nex_token.password, None,
              authentication.NintendoLoginData(nex_token.token))

#Even though you're sending your username and pid to the server, you can't
#requests friend information of other people. You'll always get your own data
client = friends.FriendsClient(backend)
principal_preference, comment, friends, requests_sent, requests_received, \
  blacklist, unk1, notifications, unk2 = client.get_all_information(
    friends.NNAInfo(
        friends.PrincipalBasicInfo(
   pid, USERNAME, #Pid and nnid
   #If you change mii name or data here it will also be changed on Nintendo's servers
   friends.MiiV2(mii.name, 0, 0, mii.data, common.DateTime(0)),
   2
        ),
        0x5E, 0x0B
    ),
Ejemplo n.º 6
0
    bits_dec[k] = nintendo_base64_decode(bits[k])
host, port = bits_dec['locator'].decode().split(':')
port = int(port)

pid = str(identity['user_id'])
password = identity['password']
my_friendseed = identity['lfcs']

backend = backend.BackEndClient(friends.FriendsTitle.ACCESS_KEY,
                                friends.FriendsTitle.NEX_VERSION,
                                backend.Settings("friends.cfg"))
backend.connect(host, port)
backend.login(
    pid,
    password,
    auth_info=None,
    login_data=authentication.AccountExtraInfo(168823937, 2134704128, 0,
                                               bits['token']),
)

client = friends.Friends3DSClient(backend)
status = 'Seedbot - up for {}.\nGot {} FCs.'
fc_count = 0

#print(db.execute("select pid from friends").fetchall())

all = client.get_all_friends()
print(len(all), "friends")
print(all)

start_time = datetime.utcnow()
Ejemplo n.º 7
0
nex_account_details = nasc.login(NASC_REQUEST)

backend = backend.BackEndClient(
	'd6f08b40', # ACNL Nex Access Key
	31017, # Nex Version
	# backend.Settings("dream.cfg")
)
backend.connect(nex_account_details['host'], nex_account_details['port'])

login_info = authentication.AuthenticationInfo()
login_info.token = nex_account_details['token']
login_info.ngs_version = 3
login_info.token_type = 0
login_info.server_version = 2006

backend.login(PRINCIPAL_ID, NEX_PASSWORD, auth_info=login_info)

store = datastore.DataStoreClient(backend.secure_client)

get_param = datastore.DataStorePrepareGetParam()
get_param.data_id = 1206006	#This is dream Address 5D00-0012-66F6; 00001266F6 converted to decimal is 1206006; 5D is just a client side checksum(?) and not needed for downloads
get_param.lock_id = 0
get_param.persistence_target.owner_id = 0
get_param.persistence_target.persistence_id = 65535
get_param.access_password = 0
get_param.extra_data = ["CTR", str(2), "EUR", str(82), "IE", ""] #82 is decimal country code of IE

req_info = store.prepare_get_object(get_param)
headers = {header.key: header.value for header in req_info.headers}
dream_data = requests.get("http://" + req_info.url, headers=headers).content