Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kill-9

Package Overview
Dependencies
Maintainers
6
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kill-9

A way for kill node server from client navigator

  • 0.4.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

kill-9

a way to kill node process from client navigator. Something like http://yoursite.kom/kill-9

extending npm-version downloads linux windows coverage dependencies

language: English also available in: Spanish

Install

$ npm install kill-9

Use it in the client navigator

use kill-9 as a url in the navigator

API

var express = require('express');
var app = express();

var kill9 = require('kill-9');

var server = app.listen(3000, function() {
    console.log('Listening on port %d', server.address().port);
});

app.use(kill9({log:true}));

// complete example:
function site_up(req,res){
    var kill_url='kill-9?pid='+process.pid;
    res.send("<h1>kill-9 demo</h1><p>site up<p>try <a href="+kill_url+">"+kill_url+"</a>");
}

app.get('/index.html',site_up);
app.get('/',site_up);

kill9([options])

Returns a function middleware to use with express.use. Once installed you can kill the process typing "kill sentence" in the navigator.

Example:

http://thesite.kom/kill-9?pid=12345
optiontypedefault valuedetails
statementtext"kill-9"The statement that you must type in the url.
pidintegerprocess.pidThe pid value that you must pass in the pid parameter. By default kill-9 uses the real pid obteined from pid property of process object: process.pid
logbooleanfalseIf log is set kill-9 show a console.log when it is installed. You can send true or a message.
statusKilledinteger200The status sent in the response for the case of success.
locationurlThe location for a redirect. This is mandatory if statusKilled between 300 and 303.
messageKilledtext"kill -9 success"The message to display in successful kills.
statusBadinteger404The status sent when the pid doesn't match.
locationBadurlThe location for a redirect. This is mandatory if statusKilled between 300 and 303.
messageBadtext"kill -9 unknown"The message to display when when the pid doesn't match.
processobjectprocessThe process option is for test purpose. You can pass a mock object.
app.use(kill9({log:"remember to delete in production"}));

// Supose that exists getMode(). This is better
if(getMode()=='develop'){
    app.use(kill9({log:true}));
}
app.use(kill9({statusKilled:301, location:'other_site.kom'}));
app.use(kill9({messageKilled: "I'll be back"}));
app.use(kill9({messageBad: "Not foud"}));
function ProcessMock(){
    this.pid=444;
    this.codeRecived=null;
    this.exit=function(code){
        this.codeRecived=code;
    }
}

var pm=new ProcessMock();
test_app.use(
    kill9({process:pm})
).get(
    'kill-9?pid=444'
).then(function(){
    assert.equal(mp.codeRecived, 444);
});

Notes

  • This is not secure in production servers. Use it only in developer servers. Kill-9 lacks of password or validate user or any way for confirm legal use.
  • Actually options.pid can be a text, but I don't know if this will change in the future.

License

GPL-2.0

FAQs

Package last updated on 17 Oct 2018

Did you know?

Socket

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.

Install

Related posts

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