Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite and TypeScript migration #26

Draft
wants to merge 67 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
87336c6
chore: begin rewrite and TS migration
jonbarrow Apr 22, 2024
d23ca8e
chore: add TODO comment about merging folders in windows folder
jonbarrow Jun 7, 2024
e744130
fix: emit PRUDP packets in session
jonbarrow Jun 8, 2024
b53a6ca
chore: add packet serializing and better type defs/checks
jonbarrow Jun 8, 2024
2a18975
chore(types): update type imports for Packet type def
jonbarrow Jun 8, 2024
662e217
chore(lint): add browser globals to eslint config
jonbarrow Jun 8, 2024
c9a9b98
chore: add browserify command for building
jonbarrow Jun 8, 2024
a5e4303
refactor(rmc): update serialized RMC message data
jonbarrow Jun 8, 2024
336c02d
refactor(prudp): update serialized PRUDPPacket/PRUDPPacketV1 data
jonbarrow Jun 8, 2024
6826034
chore(types): add serialized packet type def
jonbarrow Jun 8, 2024
769b9d2
fix(rmc): rename _error to error on serialized RMC message data
jonbarrow Jun 8, 2024
8a4e758
fix(protocols): assert that RMC parameters exist in method handlers
jonbarrow Jun 8, 2024
4b8b597
chore(rmc): add serialized RMC message type def
jonbarrow Jun 8, 2024
694bc16
refactor: make toJSON methods return serialized types
jonbarrow Jun 8, 2024
6f6ca4a
fix(nex): fix PCAPNGParser import in session.ts
jonbarrow Jun 9, 2024
ccfebcf
refactor: add global settings
jonbarrow Jun 9, 2024
70ae4bc
chore: remove console log in settings.ts
jonbarrow Jun 9, 2024
65ddd7e
chore: update settings types
jonbarrow Jun 9, 2024
a68f1bb
refactor(nex): use new account settings to lookup NEX accounts
jonbarrow Jun 9, 2024
686d9d1
chore(nex): remove debug print in connection.ts
jonbarrow Jun 9, 2024
af544f7
fix(nex): QResult codes are uint32 not int32
jonbarrow Jun 9, 2024
8ecbbb1
fix(nex): fix how error responses find their request messages
jonbarrow Jun 9, 2024
298bf85
chore(nex): add serialized Connection data
jonbarrow Jun 9, 2024
4e70ae2
fix: fix "seconds" type in PCAPNG parser
jonbarrow Jun 9, 2024
225876c
feat: add "time" value to packets
jonbarrow Jun 16, 2024
2655d0f
fix(nex): filter DNS packets by port
jonbarrow Jun 16, 2024
f8bc323
fix(types): add "time" value to SerializedPRUDPPacket
jonbarrow Jun 16, 2024
98d80b2
feat(nex): add stack traces to serialized packets
jonbarrow Jun 17, 2024
a4574fa
refactor(nex): pass Buffer data as array values
jonbarrow Jun 17, 2024
dfd9d40
refactor: add window menu and update Settings
jonbarrow Jun 17, 2024
de8f16f
fix(types): update SerializedPacket Buffer types
jonbarrow Jun 17, 2024
f0b696a
fix: revert Recent Files dialog. Caused issues
jonbarrow Jun 17, 2024
f6ad9ae
fix(nex): fix raw RMC packet serializing
jonbarrow Jun 17, 2024
26b1eb6
feat: add the start of UI
jonbarrow Jun 17, 2024
4ee87dd
refactor: condense protocol method classes into one folder
jonbarrow Jul 15, 2024
05fbd8d
feat: implement all of SecureConnection
jonbarrow Jul 15, 2024
191a1b9
feat: add NintendoLoginData/AccountExtraInfo types
jonbarrow Jul 15, 2024
39f409b
feat: implement all of NAT Traversal
jonbarrow Jul 15, 2024
2293de5
refactor: replace RMCMessage with type import in RMC methods
jonbarrow Jul 15, 2024
f6d3dfd
refactor: strongly type RMCs
jonbarrow Jul 15, 2024
af610ee
fix: fix pSourceKey value check in connection
jonbarrow Jul 15, 2024
a3a8fb5
chore: remove incorrect comments from SecureConnection and NAT Traversal
jonbarrow Jul 15, 2024
92f3d2c
feat: implement all of NotificationEvents
jonbarrow Jul 15, 2024
c26cc68
feat: display packet JSON in UI when selected
jonbarrow Jul 15, 2024
c6ebc8f
feat: start implementing MatchMaking
jonbarrow Jul 15, 2024
8a910e9
feat: add basic search to packet list
jonbarrow Jul 15, 2024
331beca
feat: start implementing MatchMakingExt
jonbarrow Jul 15, 2024
dd0276a
feat: start implementing MatchmakeExtension
jonbarrow Jul 16, 2024
00e5044
chore: update account settings structure in README
jonbarrow Jul 16, 2024
291efad
feat: add MatchmakeExtension::FindOfficialCommunity
jonbarrow Aug 8, 2024
0d5d5ef
feat: add FindOfficialCommunity RMC types
jonbarrow Aug 8, 2024
4be2ccd
fix: add p2p packet filtering checks
jonbarrow Aug 8, 2024
827d3d9
fix: update PIA magic check
jonbarrow Aug 8, 2024
933c66c
chore: improve PRUDP packet filtering
jonbarrow Aug 9, 2024
6b49d49
feat: Add AutoMatchmakeWithSearchCriteria_Postpone
ashquarky Jan 7, 2025
d54ad6e
chore: update PRUDPPacketV1 code styles
jonbarrow Jan 8, 2025
9661560
feat: add Charles dump support and Switch packet support
jonbarrow Jan 8, 2025
80a89d6
feat: complete TicketGranting protocol
jonbarrow Jan 8, 2025
301421c
feat: complete MatchMakingExt protocol
jonbarrow Jan 8, 2025
9ab8acb
chore: remove dangling comma in MatchMakingExt
jonbarrow Jan 8, 2025
26d5954
chore: npm audit fix
jonbarrow Jan 8, 2025
babaf61
feat: complete MatchMaking protocol
jonbarrow Jan 8, 2025
6b1140b
feat: complete MatchmakeExtension protocol
jonbarrow Jan 8, 2025
e55f767
feat: complete MatchmakeReferee protocol
jonbarrow Jan 8, 2025
d6530a0
feat: complete Ranking protocol
jonbarrow Jan 8, 2025
07241a0
chore: update method IDs in MatchmakeReferee protocol
jonbarrow Jan 8, 2025
cb7406c
fix: Account for NEX versions in JoinMatchmakeSessionParam
ashquarky Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 0 additions & 42 deletions .eslintrc.json

This file was deleted.

7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ typings/
.env

# custom
nex-keys.txt
*.pcapng
t.js
builds
dist
*.pcap
*.pcapng
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

63 changes: 19 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,30 @@
# NEX Viewer
### Utility for parsing and (eventually) viewing NEX connections from PCAP(NG) network dumps
### Utility for viewing PRUDP connections and NEX/Rendez-Vous sessions.

## TODO:
### This tool is still VERY early in development, so nearly nothing is finished
- [x] PRUDP v0 packet parsing
- [x] PRUDP v1 packet parsing
- [ ] Fragmented payloads
- [ ] SMM DataStore method 50 (0x32) (`DataStoreSMM::GetCustomRankingByDataId`) is completely busted
- [ ] NEX Protocols (there is mixed support, some protocols are partially implemented)
- [ ] CLI Display
## Settings / Accounts
> [!WARNING]
> Older versions of NEX Viewer precomputed the Kerberos keys for each password. These precomputed keys are NOT usable in newer versions of NEX Viewer. Password files must now always contain the raw game server password for each PID

In order to decrypt PRUDP packet payloads for the games secure server(s) your game server account credentials must be known by NEX Viewer. To add an account to the settings open one of the following JSON files:

## Installation
```
npm i https://github.com/PretendoNetwork/nex-viewer
```

## Example usage
```js
const NEXParser = require('../..');
const parser = new NEXParser();

parser.on('packet', packet => {
// DO SOMETHING
console.log(packet);
});

parser.parse(__dirname + '/smm.pcapng');
```

## NEX keys
PRUDP packet payloads get encrypted using a key which is encrypted using a key which is derived from your NEX account PID and password. In order to read packets, `nex-viewer` requires a `nex-keys.txt` file to be placed in any of these locations:

- `src` folder of this repo
- Root folder of this repo
- `%AppData%/Wireshark/nex-keys.txt` (Windows)
- `~/.config/wireshark/nex-keys.txt` (Linux/MacOS)
- `%AppData%/NEXViewer/settings.json` (Windows)
- `~/.config/nex-viewer/settings.json` (Linux/MacOS)

`nex-viewer` will check the local repo first then look elsewhere for the file depending on your operating system. `nex-keys.txt` must be in the following format:
From here add an account entry to the `accounts` array. An account entry takes the following form:

```ts
{
platform: string; // The platform the account is for (W ii U, 3DS, PC, etc.). Unused currently
username: string; // Account username. For NEX accounts this is your account PID as a string
pid: number; // Account unique PID
password: string; // Account password. Must not be hashed. Used to generate the below hashes, and those for non-NEX game servers
password_hash_old: string; // Pre-computed Kerberos key using the old key derivation method
password_hash_new: string; // Pre-computed Kerberos key using the new key derivation method
}
```
NEX_PID:NEX_PASSWORD
NEX_PID:NEX_PASSWORD
NEX_PID:NEX_PASSWORD
NEX_PID:NEX_PASSWORD
```

With each NEX account details on a new line. Each time `nex-viewer` runs it will derive the correct crypto key from each PID:PASSWORD and write it back to `nex-keys.txt`. This way your NEX password does not stay in plain-text on disk

## WARNING!
DO NOT SHARE YOUR NEX PID AND PASSWORD WITH ANYBODY UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING OR YOU DO NOT CARE ABOUT THE ACCOUNT. THIS PID/PASSWORD COMBINATION IS WHAT THE CONSOLE USES TO VERIFY YOU WHEN PLAYING ONLINE, NOT YOUR NNID USERNAME/PASSWORD. SHARING THESE DETAILS CAN ALLOW ANYONE TO LOGIN TO ANY GAME UNDER YOUR ACCOUNT
> [!CAUTION]
DO NOT SHARE YOUR NEX PID AND PASSWORD WITH ANYBODY UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING OR YOU DO NOT CARE ABOUT THE ACCOUNT. THIS PID/PASSWORD COMBINATION IS WHAT THE CONSOLE USES TO AUTHENTICATE YOU WHEN PLAYING ONLINE, NOT YOUR NNID USERNAME/PASSWORD. SHARING THESE DETAILS CAN ALLOW ANYONE TO LOGIN TO ANY GAME UNDER YOUR ACCOUNT.

## Obtaining NEX account details
NEX accounts are _**not**_ the same thing as NNIDs. How you obtain your NEX account details depends on your system. See below for details
Expand Down
62 changes: 0 additions & 62 deletions access.txt

This file was deleted.

41 changes: 0 additions & 41 deletions app/.eslintrc.json

This file was deleted.

15 changes: 0 additions & 15 deletions app/assets/css/connections-list-section.css

This file was deleted.

73 changes: 0 additions & 73 deletions app/assets/css/main.css

This file was deleted.

33 changes: 0 additions & 33 deletions app/assets/js/ipc.js

This file was deleted.

Loading
Loading