#!/usr/bin/env node // Entfernt Spieler-IP-Adressen aus einem Minecraft-Log, damit es als Test-Fixture versioniert werden kann. // Aufruf: node tools/anonymize-log.mjs import { readFileSync, writeFileSync } from 'node:fs'; const [input, output] = process.argv.slice(2); if (!input || !output) { console.error('usage: node tools/anonymize-log.mjs '); process.exit(1); } const text = readFileSync(input, 'utf8') .replace(/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+/g, '/0.0.0.0:0') .replace(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g, '0.0.0.0') // login positions ("logged in with entity id … at (x, y, z)") would reveal where players build .replace(/ at \(-?[\d.]+, -?[\d.]+, -?[\d.]+\)/g, ' at (0.0, 0.0, 0.0)'); writeFileSync(output, text);