mirror of https://github.com/calzoneman/sync.git
Allow range IP bans
This commit is contained in:
parent
4b0e920dc6
commit
e315407a48
|
@ -114,7 +114,10 @@ exports.checkGlobalBan = function(ip) {
|
|||
db.closeSync();
|
||||
gbanTime = new Date().getTime();
|
||||
}
|
||||
return (ip in gbans);
|
||||
var parts = ip.split(".");
|
||||
var slash16 = parts[0] + "." + parts[1];
|
||||
var slash24 = slash16 + "." + parts[2];
|
||||
return (ip in gbans || slash16 in gbans || slash24 in gbans);
|
||||
}
|
||||
|
||||
exports.loadChannel = function(chan) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "1.4.4",
|
||||
"version": "1.4.5",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
|
@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
const VERSION = "1.4.4";
|
||||
const VERSION = "1.4.5";
|
||||
|
||||
var fs = require("fs");
|
||||
var Logger = require("./logger.js");
|
||||
|
@ -80,6 +80,7 @@ fs.exists("chanlogs", function(exists) {
|
|||
exports.io.sockets.on("connection", function(socket) {
|
||||
var ip = socket.handshake.address.address;
|
||||
if(Database.checkGlobalBan(ip)) {
|
||||
Logger.syslog.log("Disconnecting " + ip + " - bant");
|
||||
socket.emit("kick", {
|
||||
reason: "You're globally banned!"
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue