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

autopsy

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autopsy - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

28

lib/connect.js

@@ -1,16 +0,26 @@

var client = require('scp2')
var ScpClient = require('scp2').Client
var connect = require('ssh-connect-prompt')
var debug = require('debug')('autopsy:connect')
var addr = {
host: 'localhost',
username: 'root',
password: 'root',
path: '/root',
port: 2222
function scp() {
return new ScpClient({
host: 'localhost',
username: 'root',
password: 'root',
port: 2222
})
}
function cp(path, cb) {
function cp(path, cb, progress) {
debug('scp copying ' + path + ' into vm at /root')
client.scp(path, addr, cb)
var client = scp()
client.upload(path, '/root', function (err) {
progress(path, cp[path], cp[path])
cp[path] = null
cb(err)
})
client.on('transfer', function (buffer, uploaded, total) {
if (!cp[path]) { cp[path] = total }
progress(path, uploaded, total)
})
}

@@ -17,0 +27,0 @@

@@ -8,4 +8,6 @@ var fs = require('fs')

var through = require('through2')
var prettyBytes = require('pretty-bytes')
var connect = require('./connect')
var debug = require('debug')('autopsy:mdb')
var log = require('single-line-log').stdout
var banner = fs.readFileSync(path.join(__dirname, '../banner.txt'))

@@ -25,3 +27,3 @@

}
if (args.length < 2) {

@@ -37,9 +39,5 @@ if (os.platform() !== 'linux') {

debug('setting stdio to raw mode')
process.stdin.setRawMode(true)
ssh.on('ready', function() {
debug('ssh is ready')
var dots = Array.apply(null, {length: 20}).map(function () { return '.' })
keypress(process.stdin)

@@ -61,2 +59,6 @@ debug('cleaning up previous files')

debug('entering mdb shell')
process.stdin.setRawMode(true)
keypress(process.stdin)
stream.write('mdb ' + args.join(' ') + ' # run mdb in tty\n')

@@ -82,3 +84,3 @@ debug('loading v8 mdb debug module')

check.count += 1
if (dots.length && check.count < check.max) {
if (check.count < check.max) {
return setTimeout(check, 100, cb)

@@ -124,13 +126,38 @@ }

debug('copying ' + f)
connect.cp(f, function (err) {
connect.cp(f, function (err) {
if (err) { throw err }
debug(f + ' was copied into vm')
c -= 1
if (!c) { cb(err, args.map(basename)) }
})
if (!c) {
process.stdout.write('\u001b[' + args.length +'A') //move cursor up to first progress bar
process.stdout.write('\u001b[J') // erase everything beneath
console.log()
cb(err, args.map(basename))
}
}, progress)
})
}
function progress(file, uploaded, total) {
file = basename(file)
progress[file] = render(file, uploaded, total)
var output = Object.keys(progress)
.map(function (k) { return progress[k] })
.join('\n')
log(output)
}
function render (file, uploaded, total) {
var output = ''
var pct = (uploaded / total) * 100
var bar = Array(Math.floor(42 * pct / 100)).join('=') + '>'
while (bar.length < 42) bar += ' '
output += file + ' [' + bar + '] ' + pct.toFixed(1) + '%' + ' ' + total + ' / ' + uploaded
if (total) output += ' of ' + prettyBytes(total)
return output
}
function relative(f) { return path.relative(process.cwd(), f) }
function basename(f) { return path.basename(f) }
{
"name": "autopsy",
"version": "0.5.1",
"version": "0.5.2",
"description": "dissect dead node service core dumps with mdb via a smart os vm",

@@ -23,5 +23,7 @@ "preferGlobal": true,

"keypress": "^0.2.1",
"pretty-bytes": "^2.0.1",
"proc-cpuinfo": "^1.0.0",
"progress-stream": "^1.1.1",
"scp2": "^0.2.2",
"single-line-log": "^1.0.1",
"split": "^1.0.0",

@@ -28,0 +30,0 @@ "ssh-connect-prompt": "0.0.2",

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