Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Effortless complex scripts with unlimited power. Ncx is a JavaScript library for writing complex scripts without complexity that can be used with Node.js
Here is a simple example of Ncx use
import { x } from 'ncx-js'
const myScripts = ['echo Hello World!', 'node scripts/hello.js', 'pnpm install', 'tsc']
await x(...myScripts)
ncx.x
The commands to be executed are determined by this function. It returns a object with stdout, stderr and error.
import { x } from 'ncx-js'
const data = await x('echo ncx is awesome!')
if (data.error) {
throw new Error(data.error)
}
ncx.consoleX
The commands to be executed are determined by this function. It returns a object with stdout, stderr and error and prints the output to the console.
import { cx } from 'ncx-js'
const data = await cx('echo ncx is awesome!')
if (data.error) {
throw new Error(data.error)
}
ncx.beforeAll
The argument function called before all the scripts and commands.
import { x, beforeAll } from 'ncx-js'
beforeAll(() => console.log('Running tests...'))
await x('node scripts/test.js')
ncx.before
The argument function called before scripts and commands.
import { x, before } from 'ncx-js'
before(() => console.log('Running command'))
await x('echo The commmand runned successfully')
ncx.use
The argument function called when scripts and commands executed
import { x, use } from 'ncx-js'
use((out) => {
if (out.toLowerCase() === 'the command runned successfully') {
console.log('All done with no errors')
}
// Return function handles the error
// stderr is optional
return (err, stderr) {
console.log('All done with error: ' + err)
}
})
await x('echo The commmand runned successfully')
ncx.after
The argument function called after scripts and commands executed
import { x, after } from 'ncx-js'
after(() => console.log('Runned command'))
await x('echo The commmand runned successfully')
ncx.afterAll
The argument function called after all scripts and commands.
import { x, afterAll } from 'ncx-js'
afterAll(() => console.log('All commands runned'))
await x('echo The commmand runned successfully')
Ncx uses globalThis
for communication with other functions.
import fs from 'fs'
import path from 'path'
import { x, use, beforeAll } from 'ncx-js'
console.clear()
beforeAll(() => console.log('Running tests...'))
const files = fs.readdirSync(path.join(process.cwd(), 'tests'))
files.forEach(async (file) => {
await x(`node ./tests/${file}`)
})
For example if we set beforeAll to a function the Ncx changes the globalThis.__ncx_before_all
to argument function. With that x
function can be use this.
MIT
FAQs
Effortless complex scripts with unlimited power
The npm package ncx-js receives a total of 0 weekly downloads. As such, ncx-js popularity was classified as not popular.
We found that ncx-js demonstrated a healthy version release cadence and project activity because the last version was released less than 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.