New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

regedit

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regedit - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

88

index.js

@@ -31,18 +31,25 @@ var util = require('util')

module.exports.list = function (keys, callback) {
executeCommand(prepareCommand('regList.wsf', keys, OS_ARCH_AGNOSTIC), callback)
module.exports.list = function (keys, architecture, callback) {
if (typeof architecture === 'function') {
callback = architecture
architecture = OS_ARCH_AGNOSTIC
}
var args = toCommandArgs('regList.wsf', architecture, keys)
execute(args, callback)
}
module.exports.createKey = function (keys, callback) {
executeCommand(prepareCommand('regCreateKey.wsf', keys, OS_ARCH_AGNOSTIC), callback)
var args = toCommandArgs('regCreateKey.wsf', OS_ARCH_AGNOSTIC, keys)
execute(args, callback)
}
module.exports.deleteKey = function (keys, callback) {
executeCommand(prepareCommand('regDeleteKey.wsf', keys, OS_ARCH_AGNOSTIC), callback)
var args = toCommandArgs('regDeleteKey.wsf', OS_ARCH_AGNOSTIC, keys)
execute(args, callback)
}
module.exports.putValue = function(map, callback) {
var args = baseCommand('regPutValue.wsf', OS_ARCH_AGNOSTIC)
var cmd = 'regPutValue.wsf ' + OS_ARCH_AGNOSTIC
for (var key in map) {

@@ -52,29 +59,27 @@ var values = map[key]

var entry = values[valueName]
var line = wrapDoubleQuotes(key) + ' ' + wrapDoubleQuotes(valueName) + ' '
+ wrapDoubleQuotes(renderValueByType(entry.value, entry.type)) + ' '
+ entry.type
cmd += ' ' + line
args.push(key)
args.push(valueName)
args.push(renderValueByType(entry.value, entry.type))
args.push(entry.type)
}
}
executeCommand(cmd, callback)
execute(args, callback)
}
module.exports.arch = {}
module.exports.arch.list = function(keys, callback) {
executeCommand(prepareCommand('regList.wsf', keys, OS_ARCH_SPECIFIC), callback)
module.exports.list(keys, OS_ARCH_SPECIFIC, callback)
}
module.exports.arch.list32 = function (keys, callback) {
executeCommand(prepareCommand('regList.wsf', keys, OS_ARCH_32BIT), callback)
module.exports.list(keys, OS_ARCH_32BIT, callback)
}
module.exports.arch.list64 = function (keys, callback) {
executeCommand(prepareCommand('regList.wsf', keys, OS_ARCH_64BIT), callback)
module.exports.list(keys, OS_ARCH_64BIT, callback)
}
function executeCommand(cmd, callback) {
function execute(args, callback) {

@@ -85,12 +90,6 @@ if (typeof callback !== 'function') {

execChildProcess(cmd, callback)
}
debug(args)
function execChildProcess(cmd, callback) {
cmd = 'cscript.exe //Nologo ' + path.join(__dirname, 'vbs', cmd)
debug(cmd)
child.execFile('cscript.exe', args, function (err, stdout, stderr) {
child.exec(cmd, function (err, stdout, stderr) {
if (err) {

@@ -115,3 +114,3 @@ if (stdout) {

debug(stdout, stderr)
debug(stdout)

@@ -150,36 +149,17 @@ var result

function prepareCommand(cmd, args, architecture) {
cmd += ' ' + architecture
if (typeof args === 'string') {
return cmd += ' ' + wrapDoubleQuotes(args)
} else if (util.isArray(args)) {
return cmd += ' ' + wrapItemsWithDoubleQuotes(args)
function toCommandArgs(cmd, arch, keys) {
var result = baseCommand(cmd, arch)
if (typeof keys === 'string') {
result.push(keys)
} else if (util.isArray(keys)) {
result = result.concat(keys)
} else {
return cmd
debug('creating command without using keys %s', keys)
}
}
function wrapItemsWithDoubleQuotes(arr) {
var result = ''
for (var i = 0; i < arr.length; i++) {
if (i > 0)
result += ' '
result += wrapDoubleQuotes(arr[i])
}
return result
}
/*
* conditionally wrap items with double quotes if they aren't wrapped already
*/
function wrapDoubleQuotes(item) {
if (item[0] !== '"' && item[item.length - 1] !== '"') {
return '"' + item + '"'
}
return item
function baseCommand(cmd, arch) {
return ['/Nologo', path.join(__dirname, 'vbs', cmd), arch]
}
{
"name": "regedit",
"version": "0.2.0",
"version": "0.3.0",
"description": "Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc