Stored Procedure to Block IP or IP Range in game

Results 1 to 9 of 9
  1. #1
    Enthusiast mundus is offline
    MemberRank
    Oct 2007 Join Date
    46Posts

    idea Stored Procedure to Block IP or IP Range in game

    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 by mundus; 17-01-13 at 11:43 PM. Reason: Nothing fancy, just corrected wrong spelling: "INTALLATION"


  2. #2
    Account Upgraded | Title Enabled! magraopb is offline
    MemberRank
    May 2007 Join Date
    BrazilLocation
    742Posts

    config Re: Stored Procedure to Block IP or IP Range in game

    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.

    In my case..
    I have Optical Fiber internet, ASA CISCO on my House, work fine

  3. #3
    Proficient Member walkernight88 is offline
    MemberRank
    Aug 2008 Join Date
    /etc/cabal/dataLocation
    192Posts

    Re: Stored Procedure to Block IP or IP Range in game

    My advice, use the MAC filter. Does a better job even for dynamic IPs.

  4. #4
    wWw.F403.OrG S37uP!Update is offline
    MemberRank
    Oct 2008 Join Date
    F403.ORGLocation
    1,304Posts

    Re: Stored Procedure to Block IP or IP Range in game

    Yeah that's right, can you tell us how we can filter it via MAC ADRESS?

  5. #5
    TheOne jaguar666 is offline
    MemberRank
    Aug 2012 Join Date
    Comfort RoomLocation
    407Posts

    Re: Stored Procedure to Block IP or IP Range in game

    Quote Originally Posted by S37uP!Update View Post
    Yeah that's right, can you tell us how we can filter it via MAC ADRESS?
    Waiting for Mundus to give us the script for blocking PC MAC address.

  6. #6
    Account Upgraded | Title Enabled! Alphakilo23 is offline
    MemberRank
    Jun 2010 Join Date
    Ze German ländLocation
    428Posts

    Re: Stored Procedure to Block IP or IP Range in game

    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

  7. #7
    wWw.F403.OrG S37uP!Update is offline
    MemberRank
    Oct 2008 Join Date
    F403.ORGLocation
    1,304Posts

    Re: Stored Procedure to Block IP or IP Range in game

    So , about the MAC ADRESS how do i found the MAC ADRESS of someone?

  8. #8
    Proficient Member walkernight88 is offline
    MemberRank
    Aug 2008 Join Date
    /etc/cabal/dataLocation
    192Posts

    Re: Stored Procedure to Block IP or IP Range in game

    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...

  9. #9
    Proficient Member Ken Ken Bueno is offline
    MemberRank
    Sep 2013 Join Date
    169Posts

    Re: Stored Procedure to Block IP or IP Range in game

    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



Advertisement