Initial commit.
This commit is contained in:
48
index.js
Normal file
48
index.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
const net = require('net');
|
||||||
|
|
||||||
|
var request = [];
|
||||||
|
var requestSize = 0;
|
||||||
|
|
||||||
|
const server = new net.createServer(function(c) {
|
||||||
|
//console.log('Server Connected');
|
||||||
|
c.on('end', function() {
|
||||||
|
//console.log('Server Disconnected');
|
||||||
|
request.slice(0);
|
||||||
|
requestSize = 0;
|
||||||
|
});
|
||||||
|
c.on('data', function(data) {
|
||||||
|
console.log(data.toString());
|
||||||
|
if(data.toString().startsWith('OPTIONS')) {
|
||||||
|
console.log('Sending options ...');
|
||||||
|
c.write(`ICAP/1.0 200 OK\r\nMethods: REQMOD, RESPMOD\r\nOptions-TTL: 3600\r\nEncapsulated: null-body=0\r\nMax-Connections: 400\r\nPreview: 1024\r\nService: McAfee Web Gateway 7.8.0 build 24353\r\nISTag: "00000951-14.42.54-00008767"\r\nAllow: 204\r\n\r\n`);
|
||||||
|
c.end();
|
||||||
|
}
|
||||||
|
if(data.length > requestSize) {
|
||||||
|
console.log('tu smo');
|
||||||
|
request = data;
|
||||||
|
requestSize = data.length;
|
||||||
|
}
|
||||||
|
if(data.toString().endsWith('0\r\n\r\n')) {
|
||||||
|
console.log('Request Complete!');
|
||||||
|
var lines = request.toString().split('\r\n');
|
||||||
|
lines.forEach((line, index) => {
|
||||||
|
console.log(index.toString() + ': ' + line);
|
||||||
|
});
|
||||||
|
if(lines[0].startsWith('RESPMOD')) {
|
||||||
|
console.log('Sending response');
|
||||||
|
c.write(`ICAP/1.0 204\r\nICAP/1.0 204 No Content\r\nServer: Deep Discovery Analyzer 6.8 Build 1165\r\nISTag: "12.300.1011"\r\nX-Response-Desc: URL: No risk rating from WRS; FILE: No risk rating from VA\r\nDate: Thu, 16 Apr 2020 07:32:30 GMT\r\n\r\n`);
|
||||||
|
c.end();
|
||||||
|
}
|
||||||
|
//c.end();
|
||||||
|
} else {
|
||||||
|
console.log('Request not yet complete');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
c.on('error', function(error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(1344, function() {
|
||||||
|
console.log('Server Bound');
|
||||||
|
});
|
12
package.json
Normal file
12
package.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "avscan",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node index.js"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
Reference in New Issue
Block a user