
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
The kill-port npm package is a utility that allows you to kill processes running on specific ports. This can be particularly useful for developers who need to free up ports that are being used by other applications or processes.
Kill a specific port
This feature allows you to kill a process running on a specific port. In this example, the process running on port 3000 is terminated.
const kill = require('kill-port');
kill(3000)
.then(() => {
console.log('Port 3000 killed');
})
.catch((err) => {
console.error('Error killing port 3000:', err);
});
Kill a port with a specific protocol
This feature allows you to specify the protocol (TCP or UDP) when killing a port. In this example, the TCP process running on port 3000 is terminated.
const kill = require('kill-port');
kill(3000, 'tcp')
.then(() => {
console.log('TCP process on port 3000 killed');
})
.catch((err) => {
console.error('Error killing TCP process on port 3000:', err);
});
Kill multiple ports
This feature allows you to kill multiple ports simultaneously. In this example, the processes running on ports 3000 and 4000 are terminated.
const kill = require('kill-port');
Promise.all([kill(3000), kill(4000)])
.then(() => {
console.log('Ports 3000 and 4000 killed');
})
.catch((err) => {
console.error('Error killing ports:', err);
});
fkill is a package that allows you to kill processes by port, name, or PID. It provides a more versatile approach compared to kill-port, which is focused solely on killing ports.
kill-process-by-port is another package that specifically targets processes running on a given port. It is similar to kill-port but may have different implementation details and options.
port-killer is a utility for killing processes running on specific ports. It offers similar functionality to kill-port but may have different command-line options and usage patterns.
$ npm install --save kill-port
# OR
$ yarn add kill-port
const kill = require('kill-port')
const http = require('http')
const port = 8080
const server = http.createServer((req, res) => {
res.writeHead(200, {
'Content-Type': 'text/plain'
})
res.end('Hi!')
})
server.listen(port, () => {
setTimeout(() => {
kill(port)
.then(console.log)
.catch(console.log)
}, 1000)
})
The module exports a single function that takes a port number as argument. It returns a promise.
$ npm install --global kill-port
# OR
$ yarn global add kill-port
Then:
$ kill-port --port 8080
# OR
$ kill-port 9000
You can also kill multiple ports:
$ kill-port --port 8080,5000,3000
# OR
$ kill-port 9000 3000 5000
Contributions are welcome. Please open up an issue or create PR if you would like to help out.
Licensed under the MIT License.
FAQs
Kill process running on given port
The npm package kill-port receives a total of 126,534 weekly downloads. As such, kill-port popularity was classified as popular.
We found that kill-port 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.