Permalink
Browse files

beta 0.1 push, fix socket.io

  • Loading branch information...
1 parent d114d81 commit 9727878ffdcabe5334b77e80153c479395fe3533 @contra contra committed Jul 31, 2011
Showing with 9 additions and 12 deletions.
  1. +7 −10 lib/socketio.js
  2. +2 −2 package.json
View
@@ -15,8 +15,8 @@ socketio.listen = function (server) {
console.log('[FUSKER] Creating Socket.IO server');
var sio = require('socket.io');
var io = sio.listen(server);
+
io.sockets.on('connection', function (socket) {
- socket.fuskers = new Array(); //List of events fusker is wrapping on the socket
socket.remoteAddress = socket.handshake.address.address; //I'm lazy and don't feel like grabbing the handshake IP each time.
//Check our blacklist againts client
@@ -37,23 +37,20 @@ socketio.listen = function (server) {
//Any time a listener is added to a socket, remove it, wrap it with fusker, and re-add
socket.on('newListener', function (evt, listener) {
- //If we already wrapped the event, dont wrap it again. This prevents recursion
- if (socket.fuskers.indexOf(evt) < 0) {
- socket.fuskers.push(evt);
- socket.removeListener(evt, listener);
- socket.on(evt, function (msg) {
+ //console.log("Wrapping fusker for " + evt);
+ socket.listeners(evt).push(function (msg) {
if (config.verbose) {
console.log('[FUSKER] SocketIO: ' + socket.remoteAddress + ' -> ' + evt);
}
for (var i = socketio.detectives.length - 1; i >= 0; --i) {
var module = require('./socket-detectives/' + socketio.detectives[i]);
module.check(socket, sys.inspect(msg));
}
- listener(msg); //Calls our original listener
- });
- }
+ //listener('fusked! ' + msg); //Calls our original listener
+ });
});
});
+
return io;
};
@@ -82,4 +79,4 @@ socketio.handleAttack = function (module, socket, msg) {
}
};
-module.exports = socketio;
+module.exports = socketio;
View
@@ -1,7 +1,7 @@
{
"name": "fusker",
"description": "Detect, prevent, and fight back against hackers in the lulziest ways possible",
- "version": "0.0.9",
+ "version": "0.1.0",
"homepage": "http://github.com/wearefractal/fusker",
"keywords": ["fusker", "hack", "protect", "csrf", "lfi", "xss", "sqli", "injection", "attack", "blacklist"],
"author": "Contra <contra@australia.edu> (http://wearefractal.com)",
@@ -31,4 +31,4 @@
"type": "MIT",
"url": "http://github.com/wearefractal/fusker/raw/master/LICENSE"
}]
-}
+}

0 comments on commit 9727878

Please sign in to comment.