prevnext   » MKW-ANA: Wiimms MKWii Network Analyzer » mkw-ana: Wiimms MKWii Network Analyzer » mkw-ana query

mkw-ana query

Send a SQL query to a gamespy server. All parameters are concatenated to one SQL WHERE clause, but parameters beginning with '@' have special meanings. '@-' enables a verbose test mode and disables the connection to the server.

In the post processing of the completed where-clause, multiple blanks are elimated and friend codes in format '@FC' are replaced by the related profile id.

Contents

1.   Syntax

mkw-ana QUERY where...

2.   Options

Options
Option Param Description
--server addr[:port] Define an address (IP or DNS name) and optional a port of the server, where the query is send to. It also disables the '+' default for option --select. The default server is ms.gs.wiimmfi.de.
--wiimmfi Set the server to ms.gs.wiimmfi.de and enables the '+' default for option --select. This option is the default server setting.
--twiimmfi Set the server to ms.gs.test.wiimmfi.de and enables the '+' default for option --select.
--nintendo Set the server to mariokartwii.ms19.gs.nintendowifi.net. It also disables the '+' default for option --select.
--port num Define a default port. It is only used, if no port is defined by the --server option. The default port is 28910.
--game name The case insensitive game name. The default is 'mariokartwii'.

A special mode is entered, if 2 or more games separated by commas or spaces are defined. In this case, options »--select, --limit« and --group-by are inored and a user count for each game is printed.

--account name The case insensitive account for the query. The default account is the game name specified by option --game, if that game is known or a key is set. Otherwise 'gslive' is used as fall back. The internal database contains 3013 users with their associated keys.

The old option name --user is also accepted.

--secret secret The secret with usually 6 characters is used for decoding answers of server MS. Only the 3 lower bits of each character are relevant for the secret (e.g. characters '19AIQYai' and more are identical). If not set, a lookup into an internal database is done. If the lookup fails, 123456 (almost invalid) is used.

The old option name --key is also accepted.

--select list Define a list of keywords for the SELECT part of the SQL query. Commas, slashes and backslashes are accepted as separator. A single plus sign ('+') means: Reply all columns known by the server. This feature is only supported by the Wiimmfi servers.

If one the options --wiimmfi or --twiimmfi is set, the plus sign '+' is the default. Otherwise the default is a list with all known and supported names (internal database).

--limit num Define a response limit for the SQL query. Values between -2 and 255 are allowed. 0 (the default) means unlimited. The special value -1 forces counting instead of printing each record and the special value -2 sends only an IP detection record.

The parameter '@num' is an alternative way to enter the limit.

--group-by list Ignore options --select and --limit and print counters for all different values of the named fields. --gby is a shortcut.
--simport file Read a text file and scan it for internal game names and secrets. Override existing entries with the same game name.

Use this option multiple times to load more than 1 file. If the filename is '0', the internal list is cleared and auto loading (see below) is disabled. For syntax and semantic see option --sexport.

At program start one of /usr/local/share/mkw-ana/secret.txt or /usr/share/mkw-ana/secret.txt is loaded. In a second step, share/mkw-ana.secret,txt or mkw-ana.secret.txt relative to the program path is loaded. In a third step, ~/.mkw-ana/secret.txt is loaded.

--sexport file Write the internal secret list with game name, secret and description to an external file after all --simport options are processed. The new file contains also a comment section about the syntax and semantic.

If --brief is set, this comment is suppresses. If --brief is set twice, the output is printed in C as support for the internal secret list. If --long is set, select strings are also exported. If --long is set twice, an extra empty line is added behind each select rxport.

-b --brief Suppress output of local address and of the hex value of the public address.
-q --quiet Ignore all previous --verbose and print only error messages and results. If set twice, print only error messages. If set three times, suppress also error messages.
-v --verbose Ignore all previous --quiet and print the query too. If set twice or more times, print progress messages with different verbosity.

3.   Description

Mario Kart Wii sends database queries to the gamespy server mariokartwii.ms19.gs.nintendowifi.net at port 28910 to get information about other online players and to meet them for online gaming.

The command QUERY send the samequeries and prints the information in a human readable table layout. There are also some other special functionalities.

4.   Basic Usage

The command QUERY works like an SQL SELECT command. It sends a request to the gamespy data server and the server sends back the response.

In request contains several data:

4.1   Where clause

The command QUERY conatenates all parameters without special meanings (all excluding options and their paramaters, and normal paramaters beginning with an '@') to a where clause. So the user can write the where clause without quoting. But be carfull if using special characters like < or >, becuase the are interpeted by the shell.

All commands in the wollowing table do the same:

mkw-ana query "ev > 300 and ev < 5000"
mkw-ana query ev ">" 300 and ev "<" 5000
mkw-ana query ev \> 300 and ev \< 5000
A result looks like this:
# Response for 123.45.67.89:6500 with 160 entries and 3 text parameters.
#
#-----------------------------------------------------------------------
#                          local address:port              rk        eb
#F  extern address:port                          id/hex         ev
#-----------------------------------------------------------------------
7e     179.52.6.57:15783        10.0.0.7:60820 b3340639    vs 4974 5000
7e  174.126.178.49:57299    192.168.0.16:57299 ae7eb231    vs 3575 4894
7e  74.190.246.135:57573    192.168.1.69:57573 469fb202  vs_1 4914 5000
7e   108.223.69.88:59818   192.168.1.152:59818 4b1400cd    vs 4955 5143
7e     99.92.97.34:58054    192.168.1.77:58054 0c7a9781    bt 4811 4646
...
In this example the option »--select rk,ev,eb« was set to keep the output table small.

With an empty where-clause nor records are filtered.

4.2   --select list

Define a list of keywords for the SELECT part of the SQL query. Commas, slashes and backslashes are accepted as separator. A single plus sign ('+') means: Reply all columns known by the server. This feature is only supported by the Wiimmfi servers. If one the options --wiimmfi or --twiimmfi is set, the plus sign '+' is the default. Otherwise the default is a list with all known and supported names (internal database).
The gamespy returns always the externap IP and port, the Wii IP and port and an identifier as binary data. The client can ...

???

4.3   --limit num

Define a response limit for the SQL query. Values between -2 and 255 are allowed. 0 (the default) means unlimited. The special value -1 forces counting instead of printing each record and the special value -2 sends only an IP detection record. The parameter '@num' is an alternative way to enter the limit.
???

4.4   --server addr[:port]

Define an address (IP or DNS name) and optional a port of the server, where the query is send to. It also disables the '+' default for option --select. The default server is ms.gs.wiimmfi.de.
???

4.5   --port num

Define a default port. It is only used, if no port is defined by the --server option. The default port is 28910.
???

4.6   --

???

4.7   --game name

The case insensitive game name. The default is 'mariokartwii'. A special mode is entered, if 2 or more games separated by commas or spaces are defined. In this case, options »--select, --limit« and --group-by are inored and a user count for each game is printed.
???

4.8   --

???

4.9   --group-by list

Ignore options --select and --limit and print counters for all different values of the named fields. --gby is a shortcut.
???

5.   Special Statistics

???

5.1   Count records

If the limit is set to -1, the records are only counted and not printed.
mkw-ana query --limit -1
1935
or
mkw-ana query @-1 dwc_hoststate=2
244

5.2   Count groups

The option group-by divide all results into groups and print out the group with a count of records.
mkw-ana query --gby dwc_hoststate

#---------------
#           rk
# count
#---------------
   876*
    82*     bt
   649*     vs
    27*   bt_1
    18*   bt_2
    64*   vs_0
   106*   vs_1
    97*   vs_2
    27*  vs_40
#---------------
or
mkw-ana query --gby rk,dwc_hoststate

#-------------------------
#           rk
# count        hoststate
#-------------------------
   216*
   440*        0
   108*        1
    91*        2
     4*     bt 0
    70*     bt 1
    13*     bt 2
    21*     vs 0
   551*     vs 1
    91*     vs 2
...

5.3   Count users of games

If you use the option --game to define multple games, a summary count for each game is printed:
mkw-ana query --game mariokartwii,mariokartds,acrossingwii,acrossingds
  1938*  mariokartwii = Mario Kart Wii
     5*  mariokartds  = Mario Kart
    53*  acrossingwii = Animal Crossing Wii
     7*  acrossingds  = Animal Crossing
This can aslo be combined with a where-clause:
mkw-ana query --game mariokartwii,mariokartds,acrossingwii,acrossingds dwc_hoststate=2
   244*  mariokartwii = Mario Kart Wii
     0*  mariokartds  = Mario Kart
    36*  acrossingwii = Animal Crossing Wii
     0*  acrossingds  = Animal Crossing