|
OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
|
Functions | |
| make_key () | |
| _der_key (priv) | |
| _openssl (args, priv, data=b'') | |
| public_key (priv) | |
| plus_id (pk) | |
| signed_text (challenge, adr) | |
| _der_int (der, i) | |
| sign (priv, challenge, adr) | |
| _private (ip) | |
| address_accepted (signed_ip, from_ip, public, net_ip='', signed_port=28960, net_port=28960, public_port=None, local_ips=()) | |
| id_keys (pk_hex, ps_hex, adr) | |
| connect_with_id (port, priv, adr=None, name='plusid', protocol=115, plus=123) | |
| status_rows (port) | |
| status_extra (port, name) | |
| status (port) | |
| seen_file (path) | |
| launch (binary, game_dir, home, port, map_name, log_path, extra=()) | |
| make_home (home) | |
| stop (server) | |
| check_shared_seen_file (args, check) | |
| check_address_rule (check) | |
| run_cases (port, protocol, log_path, game_log, seen_path, check) | |
| parse_time (text) | |
| read_bans (path) | |
| run_ban_cases (port, protocol, log_path, game_log, bans_path, check) | |
| check_lists (args, check) | |
| main () | |
Variables | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| str | RCON = 'plusid_rcon' |
| int | N = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551 |
| str | NOTICE = 'This server requires a Plus ID' |
| str | GAMETYPE |
Checks the Plus ID: the connect key pair proof (docs/architecture/plus-id.md).
python3 scripts/plusid_test.py /path/to/CoD2 [--binary bin/cod2rev_lnxded] [--protocol 118]
Minimal clients sign the connect challenge with keys made by the openssl CLI
and the server's verdict is read back with rcon plusIdStatus. The folder must
hold only the stock iwds. Exits with 0 when every check passes. The helpers
(make_key, sign, connect_with_id...) are for the other Plus ID tests.
|
protected |
|
protected |
priv as an SEC1 ECPrivateKey on prime256v1, which openssl reads.
|
protected |
|
protected |
PlusId_IsPrivate: RFC 1918, loopback and link-local only (not the host's own /24, which Sys_IsLANAddress also takes).
| plusid_test.address_accepted | ( | signed_ip, | |
| from_ip, | |||
| public, | |||
| net_ip = '', | |||
| signed_port = 28960, | |||
| net_port = 28960, | |||
| public_port = None, | |||
| local_ips = () ) |
The server's rule (PlusId_AddressAccepted) for the address the client signed, branch for branch: a private address only from a private source, even when it is net_ip; the public address with the port it names (else net_port); net_ip with net_port; then, with net_port, a private address of this host: 127/8 or one of its own IPs.
| plusid_test.check_address_rule | ( | check | ) |
| plusid_test.check_lists | ( | args, | |
| check ) |
Shared ban lists served by a local HTTP server, refreshed every minute: five lists checked at the same refresh, then a restart with the HTTP server down.
| plusid_test.check_shared_seen_file | ( | args, | |
| check ) |
Two servers with one seen file and the same ID connected 5 s to each.
| plusid_test.connect_with_id | ( | port, | |
| priv, | |||
| adr = None, | |||
| name = 'plusid', | |||
| protocol = 115, | |||
| plus = 123 ) |
Connects a client that signs adr (by default 127.0.0.1:port) with priv; returns (client, None or the server's reply). The caller closes the client.
| plusid_test.id_keys | ( | pk_hex, | |
| ps_hex, | |||
| adr ) |
| plusid_test.launch | ( | binary, | |
| game_dir, | |||
| home, | |||
| port, | |||
| map_name, | |||
| log_path, | |||
| extra = () ) |
Starts a dedicated server with the test gametype; returns the process.
| plusid_test.main | ( | ) |
| plusid_test.make_home | ( | home | ) |
| plusid_test.make_key | ( | ) |
A random private key, 32 bytes big-endian.
| plusid_test.parse_time | ( | text | ) |
| plusid_test.plus_id | ( | pk | ) |
P- and the base32 of the first 10 bytes of SHA-256(pk), in groups of 4.
| plusid_test.public_key | ( | priv | ) |
The compressed public point, 33 bytes.
| plusid_test.read_bans | ( | path | ) |
| plusid_test.run_ban_cases | ( | port, | |
| protocol, | |||
| log_path, | |||
| game_log, | |||
| bans_path, | |||
| check ) |
| plusid_test.run_cases | ( | port, | |
| protocol, | |||
| log_path, | |||
| game_log, | |||
| seen_path, | |||
| check ) |
| plusid_test.seen_file | ( | path | ) |
{id: (first_seen, seconds)} of a seen file.
| plusid_test.sign | ( | priv, | |
| challenge, | |||
| adr ) |
(pk hex, ps hex): the public key and the raw r||s signature of the signed text.
| plusid_test.signed_text | ( | challenge, | |
| adr ) |
| plusid_test.status | ( | port | ) |
{name: id} from rcon plusIdStatus.
| plusid_test.status_extra | ( | port, | |
| name ) |
(client number, flags) of a player in rcon plusIdStatus; flags is "-" for none.
| plusid_test.status_rows | ( | port | ) |
{name: (id, playtime, first_seen_ago)} from rcon plusIdStatus, whose lines are
"num name id playtime first_seen_ago flags".
| plusid_test.stop | ( | server | ) |
| str plusid_test.GAMETYPE |
| int plusid_test.N = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551 |
| str plusid_test.NOTICE = 'This server requires a Plus ID' |
| str plusid_test.RCON = 'plusid_rcon' |
| plusid_test.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |