Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Stored Procedure to Block IP or IP Range in game

Joined
Oct 18, 2007
Messages
48
Reaction score
59
Hello RZ,

Below is a simple stored procedure to block IP or Ip range from the game.

Code:
/****** Object:  Stored Procedure dbo.cabal_blockip    Script by Mundus - cabalhelix.com | helixnetwork.net ******/

CREATE PROCEDURE [dbo].[cabal_blockip] (@fromIP VARCHAR(15), @toIP VARCHAR(15) = @fromIP) AS
BEGIN
    DECLARE @IP1 VARCHAR(15), @IP2 VARCHAR(15)

    SET @IP1 = 
        (
          CAST( PARSENAME( @fromIP, 4 ) AS BIGINT ) * 16777216 +
          CAST( PARSENAME( @fromIP, 3 ) AS BIGINT ) * 65536 +
          CAST( PARSENAME( @fromIP, 2 ) AS BIGINT ) * 256 +
          CAST( PARSENAME( @fromIP, 1 ) AS BIGINT )
        ) 

    SET @IP2 = 
        (
          CAST( PARSENAME( @toIP, 4 ) AS BIGINT ) * 16777216 +
          CAST( PARSENAME( @toIP, 3 ) AS BIGINT ) * 65536 +
          CAST( PARSENAME( @toIP, 2 ) AS BIGINT ) * 256 +
          CAST( PARSENAME( @toIP, 1 ) AS BIGINT )
        ) 

    IF @IP1 = @IP2
        BEGIN
        INSERT INTO cabal_blockip_list (fromip, toip, id) VALUES (@IP1, @IP2, @fromIP)
        END
    ELSE IF @IP1 <> @IP2
        BEGIN
        INSERT INTO cabal_blockip_list (fromip, toip, id) VALUES (@IP1, @IP2, (@fromIP + '-' + @toIP))
        END
END
SET NOCOUNT OFF
GO

INSTALLATION:
(1) Run your SQL Analyzer.
(2) Type: USE ACCOUNT;
(3) Copy-paste my script above then press F5.

USAGE:
To block 1 IP, just type:
EXEC cabal_blockip '<ip>'
example: EXEC cabal_blockip '192.168.1.111'
To block IP range, just type:
EXEC cabal_blockip '<ip1>,<ip2>'
example: EXEC cabal_blockip '192.168.1.111','192.168.1.200'​

As always, if for some reason I made mistakes, feel free to correct me.

And please 'LIKE' if you think this post is useful :p


_
 
Last edited:
Joined
May 24, 2007
Messages
721
Reaction score
71
useful but... just reset modem and..TADAA, user will be able to login again, most people have Random IP and won't work fine.

Linux side is better to block an IP, BUT... Hardware Firewall side is MORE better yet. :elefant:

In my case..
I have Optical Fiber internet, ASA CISCO on my House, work fine
 
Joined
Jun 27, 2010
Messages
411
Reaction score
240
I don't think it's possible to block MAC addresses on the DB tier.
Use your firewall, e.g. iptables:
Code:
iptables -A INPUT -m mac --mac-source <mac address> -j DROP

Example:
Code:
iptables -A INPUT -m mac --mac-source 00:00:00:00:00:00 -j DROP

Will drop all incoming traffic from the mac address 00:00:00:00:00:00
 
Junior Spellweaver
Joined
Aug 31, 2008
Messages
191
Reaction score
28
Hah... leeet me cry, how can you find it :(( It's almost impossible. But wait, you can use a TCP viewer, or your Windows Comander, or your router frimware...
 
Junior Spellweaver
Joined
Sep 29, 2013
Messages
169
Reaction score
31
how to i unblock IP?

I've tried to block my IP using Bega tools but when i tried to relase cabal IP it doesn't work :(

pls help me, TY
 
Back
Top