Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var protocol = require('minecraft-protocol').protocol;
var packetNames = require('./packet-names.js').packets;
var colors = require('colors');
var EventEmitter = require('events').EventEmitter;
console.log('Welcome to mincraft-sniffer, the protocol inspector');
console.log('Start your server on port 25565, and connect your client to 25566');
console.log('NOTE: this does not work with encryption. Therefore, offline mode must be enabled.');
console.log('server packets are blue'.blue + ', ' + 'client packets are green'.green);
console.log('');
var proxy = require('./proxy.js').start({
proxyPort : 25566,
serviceHost : 'localhost',
servicePort : 25565
});
var mc = require('minecraft-protocol');
var states = mc.protocol.states;
var options = {
motd: 'Bushido Studios',
'max-players': 127,
port: 25565,
'online-mode': true,
};
var server = mc.createServer(options);
server.on('login', function(client) {
broadcast(client.username+' joined the game.');
var addr = client.socket.remoteAddress + ':' + client.socket.remotePort;
console.log(client.username+' connected', '('+addr+')');
client.on('end', function() {