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.
Toolkit for building shining CLI programs in Node.js.
npm install ronin --global
Execute the following command to generate basic skeleton for your program:
ronin new hello-world
Ronin will create a hello-world directory (if it does not exists or empty) and put everything that's needed to start developing your CLI tool immediately:
Here's how to initialize CLI program using Ronin:
var ronin = require('ronin');
var program = ronin(__dirname); // root path, where commands folder is
program.run();
Next, to setup some commends, simply create folders and files. The structure you create, will be reflected in your program. For example, if you create such folders and files:
commands/
-- apps.js
-- apps/
-- add.js
-- remove.js
-- keys/
-- dump.js
In result, Ronin, will generate these commands for you automatically:
$ hello-world apps
$ hello-world apps add
$ hello-world apps remove
$ hello-world keys dump
Each folder is treated like a namespace and each file like a command, where file name is command name.
To actually create handlers for those commands, in each file, Command should be defined:
var Command = require('ronin').Command;
var AppsAddCommand = module.exports = Command.extend({
desc: 'This command adds application',
run: function (name) {
// create an app with name given in arguments
}
});
To run this command, execute:
$ hello-world apps add great-app
Whatever arguments passed to command after command name, will be passed to .run() method in the same order they were written.
Bonus: There's a quicker way to create commands:
$ ronin generate apps/add
You can specify options and their properties directly, using options object or .option() method. Their result is identical.
var AppsDestroyCommand = module.exports = Command.extend({
desc: 'This command removes application',
options: {
name: 'string'
},
configure: function () {
this.option('force', {
type: 'boolean',
alias: 'f'
});
},
run: function (name, force) {
if (!force) {
throw new Error('--force option is required to remove application');
}
// remove app
}
});
Note: Options will be passed to .run() method in the same order they were defined.
By default, Ronin generates help for each command and for whole program automatically. If you wish to customize the output, override .help() method in your command (program help can not be customized at the moment):
var HelloCommand = Command.extend({
help: function () {
return 'Usage: ' + this.programName + ' ' + this.name + ' [OPTIONS]';
},
desc: 'Hello world'
});
By default, Ronin separates sub-commands with a space. If you want to change that delimiter, just specify this option when initializing Ronin:
var program = ronin({
rootPath: __dirname,
delimiter: ':'
});
After that, apps create
command will become apps:create
.
The MIT License (MIT) Copyright © 2014 Vadim Demedes vdemedes@gmail.com
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
Access the RONIN data platform via TypeScript.
The npm package ronin receives a total of 1,115 weekly downloads. As such, ronin popularity was classified as popular.
We found that ronin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.