Skip to content

Instantly share code, notes, and snippets.

View cetteup's full-sized avatar

cetteup

View GitHub Profile
@cetteup
cetteup / count_player_name_special_characters.py
Created October 22, 2026 13:21
Special characters used in Battlefield 2 player names
#!/usr/bin/env python3
"""Count special characters in unique Registry player names."""
from __future__ import annotations
import argparse
import json
from collections import Counter
from pathlib import Path
from typing import Any, Iterator
@cetteup
cetteup / chatlogger.py
Created October 4, 2026 10:11
Simple in-game chat logger for Battlefield 2 servers (built using Copilot)
""""
Vanilla BF2 admin chat logger (Python 2.3 compatible)
Setup
- add to standard_admin as admin/standard_admin/chatlogger.py
- in admin/standard_admin/__init__.py, add two lines:
import chatlogger
chatlogger.init()
"""
@cetteup
cetteup / mm_verifier.py
Created February 11, 2026 21:10
Battlefield 2 ModManager module to handle player verification
"""
Player verification module
======================
Verify player's accounts as players join.
===== Config =====
# Add a bypass IP address
# You can let players bypass verification based on their IP address.
# If your server uses "idle bots", make sure to add bypass using their IP address, else they will get banned.
@cetteup
cetteup / mm_controlpointmanager.py
Last active August 20, 2025 17:37
Battlefield 2 ModManager module to modify control points at runtime
"""
ControlPointManager module
======================
Modify control point settings without modifying map files.
===== Config =====
# Add a condition
# You can use any server setting/single-value-returning RCON command as a condition for enabling control point modifications
mm_controlpointmanager.addCondition "<setting (including sv. prefix) or other RCON command>" "<value>"
@cetteup
cetteup / main.go
Created June 10, 2025 20:10
Go-based parser example for GameSettings.bin used by Battlefield: Bad Company 2
package main
import (
"bytes"
"encoding/binary"
"io"
"log"
"os"
"path/filepath"
@cetteup
cetteup / HttpClient.py
Last active August 14, 2025 05:35
BF2Hub stats Python ("decompiled" source code)
# uncompyle6 version 3.9.3.dev0
# Python bytecode version base 2.3 (62011)
# Decompiled from: Python 3.8.10 (default, Jul 29 2024, 17:02:10)
# [GCC 9.4.0]
# Embedded file name: /tmp/bf2c/bf2hub/HttpClient.py
# Compiled at: 2014-09-03 19:41:22
import socket, string
from urlparse import urlparse
class HttpClient:
@cetteup
cetteup / main.go
Last active September 4, 2024 20:53
GameSpy login flow
package main
import (
"fmt"
"net"
"os"
"time"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
@cetteup
cetteup / mutate.ts
Last active May 7, 2024 16:10
Mutating combination function (zero changes to array length)
function combine(strings: string[], length: number): string[] {
// Init results array of required length, filled with empty strings
const combinations = Array(strings.length**length).fill('')
for (let i = length; i > 0; i--) {
for (let j = 0; j < combinations.length; j++) {
combinations[j] += strings[Math.floor(j/(strings.length**(i-1)))%strings.length]
}
}
return combinations
@cetteup
cetteup / bf2mld_gui.py
Created April 16, 2024 16:36
BF2mld - Battlefield 2 mapload-delayer 0.8.2 ("decompiled" source code)
# 2024.04.16 16:32:56 UTC
# Embedded file name: bf2mld_gui.py
import wx
import wx.html
import sys
import time
from _winreg import *
import psutil
import threading
import ConfigParser
@cetteup
cetteup / fesl-add-login-persona.py
Created October 20, 2023 07:26
FESL add and login as persona
import logging
from urllib.parse import quote
from pybfbc2stats import Platform, FeslClient, SecureConnection, TheaterClient
from pybfbc2stats.constants import FeslTransmissionType
from pybfbc2stats.packet import FeslPacket
def main():
client = FeslClient('', '', Platform.pc, track_steps=False)