Comparing version 0.0.1 to 0.0.2
@@ -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 | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
5501
38
75