Open Arkadietz opened 8 years ago
Hello,
We have tried to rewrite your original dnsbl module to supporting multiple databases instead of one.
The script you can preview below. In the moment we faced the an error we do not know how to fix. Will be thankful for your support.
Error:
2016-08-14 22:01:27 - error: [Uncaught exception] TypeError: Property 'callback' of object # is not a function stack=TypeError: Property 'callback' of object # is not a function at /home/m00n/KiwiIRC/server_modules/dnsbl.js:68:17 at /home/m00n/KiwiIRC/server_modules/dnsbl.js:83:4 at asyncCallback (dns.js:68:16) at Object.onanswer as oncomplete m00n@Thor(~/KiwiIRC)$
_``` /
var dns = require('dns'), kiwiModules = require('../server/modules');
// The available DNS zones to check against //var bl_zones = { //dronebl: '.dnsbl.dronebl.org' //};
var bl_zones = [
'.dnsbl.dronebl.org', '.tor.dnsbl.sectoor.de', '.tor.kewlio.net.uk', '.socks.dnsbl.sorbs.net', '.dnsbl.dronebl.org', '.rbl.efnet.org', '.rbl.efnetrbl.org'
];
// The DNS zone we should use //var current_bl = 'dronebl';
var module = new kiwiModules.Module('DNSBL');
module.on('irc connecting', function (event, event_data) { event.wait = true;
var client_addr = event_data.connection.state.client.websocket.meta.real_address; //isBlacklisted(client_addr, function(is_blocked) { //if (is_blocked) { //var err = new Error('DNSBL blocked (' + client_addr + ')'); //err.code = 'Blacklisted'; //event_data.connection.emit('error', err); //event.preventDefault(); //event.callback(); //} else { //event.callback(); //} //}); //lets walk through our array - @ivo for(i = 0; i < bl_zones.length; i++) { var host_lookup = reverseIp(client_addr) + bl_zones[i]; checkBlacklist(bl_zones[i], host_lookup, function(state, ip, blacklist) { if(state) { var err = new Error('DNSBL blocked (' + client_addr + ') on (' + blacklist + ''); err.code = 'Blacklisted'; event_data.connection.emit('error', err); event.preventDefault(); event.callback(); } else event.callback(); }); }
});
//we will check foreach host with that - @ivo function checkBlacklist(blacklist, ip, callback) {
dns.resolve4(ip, function(err, domain) { if (err) { callback(false, ip, blacklist); } else { callback(true, ip, blacklist); } });
}
// The actual checking against the DNS blacklist //function isBlacklisted(ip, callback) { // var host_lookup = reverseIp(ip) + bl_zones[current_bl];
//dns.resolve4(host_lookup, function(err, domain) { //if (err) { // Not blacklisted //callback(false); //} else { // It is blacklisted //callback(true); //} //});
//}
function reverseIp(ip) { return ip.split('.').reverse().join('.'); }
Hello,
We have tried to rewrite your original dnsbl module to supporting multiple databases instead of one.
The script you can preview below. In the moment we faced the an error we do not know how to fix. Will be thankful for your support.
Error:
2016-08-14 22:01:27 - error: [Uncaught exception] TypeError: Property 'callback' of object #
dnsbl
_``` /
var dns = require('dns'), kiwiModules = require('../server/modules');
// The available DNS zones to check against //var bl_zones = { //dronebl: '.dnsbl.dronebl.org' //};
var bl_zones = [
];
// The DNS zone we should use //var current_bl = 'dronebl';
var module = new kiwiModules.Module('DNSBL');
module.on('irc connecting', function (event, event_data) { event.wait = true;
});
//we will check foreach host with that - @ivo function checkBlacklist(blacklist, ip, callback) {
}
// The actual checking against the DNS blacklist //function isBlacklisted(ip, callback) { // var host_lookup = reverseIp(ip) + bl_zones[current_bl];
//}
function reverseIp(ip) { return ip.split('.').reverse().join('.'); }