Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
find-free-port-sync
Advanced tools
Find free port synchronously, useful when you need to get the port directly without callback.
Like config webpack-dev-server with port automatically.
module.exports = {
...
output: '...',
devServer: {
...
port: "a free port"
}
};
npm install find-free-port-sync --save-dev
type: number | default: 1
Start of range to find, should be greater than 0
type: number | default: 65534
End of range to find, should be less than 65535
type: number | default: 1
Number of ports to find, relates to the return value
num === 1
, return a free random port
if found, null
if notnum > 1
, return an array of free [port]
orderly if found, empty array []
if nottype: string | default: 0.0.0.0|127.0.0.1
It will scan local adress by default, specify an ip here
type: number | default: null
If port is defined, it will return whether the port is free around start
end
ip
option
Find a free port for local address
let findFreePort = require('find-free-port-sync');
let port = findFreePort();
Find 10 free ports between 10000 and 30000 for 192.168.1.1
let findFreePort = require('find-free-port-sync');
let port = findFreePort({
start: 10000,
end: 30000,
num: 10,
ip: '192.168.1.1'
});
Check if a port is free
let findFreePort = require('find-free-port-sync');
let portIsOk = findFreePort({
port: 12345
});
FAQs
Find free port synchronously without callback
We found that find-free-port-sync 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.