
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Enables a loopback server in a specific port (49152 by default) to send and receive data between standalone processes. As in the King of the Hill game, all processes can opt to be the king –thus acting as the server. If the king's socket dies, it will try to takeover the hill again (but, hey, others can try it too).
npm install koth
let options = {};
require('koth').play(options);
A game is created using require('koth').play(options). A game has these methods:
on(eventName, eventHandler): used to register listenersstart(): used to start the game (if it's stopped or autoStart is set to false)stop(): stops the game if already startedbroadcast(data): sends data| Parameter | Default | Description |
|---|---|---|
handshake | \u2AF7 (Buffer) | Handshake character (String or Buffer). |
eob | \u0017 (Buffer) | EOB character (String or Buffer). |
port | 49152 | KOTH port. Can be a port number or a UNIX Socket Port (where available!). |
maxRetries | 4 | Number of retries before giving up. |
autoStart | true | KOTH game is started instantly! |
drainQueue | false | Resend all messages automatically if connection is lost. |
encode | null (Function) | Encode function to be used when sending a message. |
decode | null (Function) | Decode function to be used when receiving a message. |
| Event | Description |
|---|---|
connection | KOTH received a new connection. |
listening | KOTH is now listening for incoming connections. |
koth_error | Emitted when an error occurs. |
koth_close | Emitted once the server is fully closed. |
| Event | Description |
|---|---|
connect | Emitted when a socket connection is successfully established. |
error | Emitted when an error occurs. |
close | Emitted once the socket is fully closed. |
data | Emitted when data is received, decoded using the encoder function (if provided). |
let koth = require('..');
let options = {
port: 49152,
maxRetries: 2
}
let game = koth.play();
let hear = function(d) {
var data = d.toString();
console.log('Received data: ', data);
}
let shout = function() {
let ran = Math.random().toString();
game.broadcast(ran);
console.log('Sent data: ', ran);
}
// Be heard, shout every second!
game.on('data', hear);
setInterval(shout, 1000);
Go check /examples for more!
The MIT License (MIT) Copyright (c) 2016 Manuel de la Higuera
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Keeps processes synced using a local TCP server
We found that koth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.