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

404project

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

404project - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

130

lib/404project.js

@@ -15,79 +15,63 @@ /*

*/
var https = require('https');
function formatYmd(ts) {
var year = ts.getUTCFullYear();
var month = ts.getUTCMonth() + 1;
var day = ts.getUTCDate();
return year + "-" + month + "-" + day;
}
function formatHms(ts) {
var hour = ts.getUTCHours();
var minute = ts.getUTCMinutes() + 1;
var second = ts.getUTCSeconds();
return hour + ":" + minute + ":" + second;
}
function Reporter(userID, key) {
this.userID = userID;
this.key = key;
}
Reporter.prototype.report404 = function() {
var url;
var ip;
var ua;
var ts;
if (arguments.length == 1) {
url = request.url;
ip = request.connection.remoteAddress;
ua = request.headers['user-agent'];
ts = new Date();
/*jshint devel:true, node:true, indent:2, maxerr:50 */
(function () {
"use strict";
var https = require("https");
function formatYmd(ts) {
var year = ts.getUTCFullYear();
var month = ts.getUTCMonth() + 1;
var day = ts.getUTCDate();
return year + "-" + month + "-" + day;
}
else {
url = arguments[0];
ip = arguments[1];
ua = arguments[2];
ts = arguments[3] || new Date();
function formatHms(ts) {
var hour = ts.getUTCHours();
var minute = ts.getUTCMinutes() + 1;
var second = ts.getUTCSeconds();
return hour + ":" + minute + ":" + second;
}
var req = https.request({
host: 'isc.sans.edu',
port: 443,
path: '/weblogs/404project.html?id=' + this.userID + '&version=2',
method: 'POST',
headers: {
'Content-Type' : 'application/x-www-form-urlencoded'
function Reporter(userID, key) {
this.userID = userID;
this.key = key;
}
Reporter.prototype.report404 = function () {
var url;
var ip;
var ua;
var ts;
if (arguments.length === 1) {
var request = arguments[0];
url = request.url;
ip = request.connection.remoteAddress;
ua = request.headers["user-agent"];
ts = new Date();
} else {
url = arguments[0];
ip = arguments[1];
ua = arguments[2];
ts = arguments[3] || new Date();
}
}, function(res) {
// console.log('STATUS: ' + res.statusCode);
// console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
//console.log('BODY: ' + chunk);
var req = https.request({
host: "isc.sans.edu",
port: 443,
path: "/weblogs/404project.html?id=" + this.userID + "&version=2",
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
}, function (res) {
res.setEncoding("utf8");
res.on("data", function (chunk) {
// console.log(chunk);
});
});
});
req.on('error', function(e) {
// console.log('problem with request: ' + e.message);
});
var data = this.userID + '\0' + this.key + '\0' + url + '\0' + ip + '\0' + ua + '\0' + formatYmd(ts) + '\0' + formatHms(ts);
var buf = new Buffer(data);
var payload = buf.toString('base64');
// console.log("data=%s", data);
// console.log("paylaod=%s", payload);
req.write('DATA=' + payload);
req.end();
};
module.exports.create = function(userID, key) {
var data = this.userID + "\x00" + this.key + "\x00" + url + "\x00" + ip +
"\x00" + ua + "\x00" + formatYmd(ts) + "\x00" + formatHms(ts);
var buf = new Buffer(data);
var payload = buf.toString("base64");
req.write("DATA=" + payload);
req.end();
};
module.exports.create = function (userID, key) {
return new Reporter(userID, key);
};
};
})();
{
"name": "404project",
"version": "0.0.1",
"version": "0.0.2",
"description": "Report 404 errors to http://www.dshield.org/tools/404project.html",

@@ -5,0 +5,0 @@ "keywords": ["connect", "security"],

@@ -33,1 +33,7 @@ node-404project

```
There is also a command-line tool:
```
bin/404reporter 636742678 aaaaaaaaaaaabbcccccccccccceeeeeeeeffffff "http://www.jolira.com/__phpamdin" 125.64.23.180 jakarta
```
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