vbGore Free Online RPG Engine

Revolutionizing Visual Basic ORPG Development
It is currently Sat May 25, 2013 12:03 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: IP Banning GM Command Addon
PostPosted: Sat Jul 14, 2007 8:49 am 
Source Code Swashbuckler

Joined: Wed Aug 02, 2006 4:00 pm
Posts: 30
Maybe instead of adding the IP yourself, you could add it so it automaticaly gets the users IP Address and bans it for you, instead of you providing it, make that as /ipban <user> <reason> for users IP to ban and make /banip <ip> <reason> for an IP of your choice.

Maybe?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 14, 2007 9:59 am 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
I thought I added something like this long ago, but guess not. Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 14, 2007 12:48 pm 
Magic Eight Ball

Joined: Fri Jul 13, 2007 5:08 pm
Posts: 8
Spodi did add one, read the wiki

IP Banning

Command: "/banip <ip> <reason>"

Bans IP <ip> for reason <reason>. The reason must be specified. The IP must follow the format of x.x.x.x, where x is any number between 0 and 255.

IP Unbanning

Command: "/unbanip <ip>"

Removes the IP ban from IP <ip>. The IP must follow the format of x.x.x.x, where x is any number between 0 and 255.

Ban List

Command: "/banlist"

Displays a list of every IP and and the reason for the ban. Warning - with a lot of bans, this routine can become very slow and may even cause a crash!

IP Info

Command "/ipinfo <ip>"

Returns a list of every user who has logged in with the IP <ip> within their last 10 unique IPs they have logged in from.


Last edited by Braiton on Sat Jul 14, 2007 12:51 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 14, 2007 12:50 pm 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
He wants one that uses the user's name, not the IP.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 14, 2007 1:05 pm 
Magic Eight Ball

Joined: Fri Jul 13, 2007 5:08 pm
Posts: 8
ima bit blind : D didnt see that part :|


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 15, 2007 12:51 pm 
Source Code Swashbuckler

Joined: Wed Aug 02, 2006 4:00 pm
Posts: 30
Yes, so when you enter users name, it then grabs there ip for you and just bans them and there ip.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 15, 2007 12:53 pm 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
Well theres no "account banning" in so that wouldn't be included, but it'd be pretty easy to grab the last 10 IPs they used and ban all of those.


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sat Dec 20, 2008 1:25 pm 
Carmack's Pimple

Joined: Tue Oct 10, 2006 9:39 am
Posts: 54
Location: Sedro-Woolley
Will this work?

Code:
Open SQLyog and open vbgore database and rename "banned_ips" to "banned_names"

Open table of "banned_name" by using "Alter Table" and change "ip" to "name" and change the data settings to as follow:

Datatype:   varchar
Len      255
Collation   latin1_swedish_ci
PK?      checked
Not Null?   checked
Comment      Name


General.bas

Find

Sub Data_GM_BanIP(ByRef rBuf As DataBuffer, ByVal UserIndex As Integer)
'*****************************************************************
'GM bans an IP
'<IP(S)><Reason(S)>
'More info: http://www.vbgore.com/GameServer.TCP.Data_GM_BanIP
'*****************************************************************
Dim TempS() As String
Dim IP As String
Dim Reason As String
Dim i As Long

    Log "Call Data_GM_BanIP([" & ByteArrayToStr(rBuf.Get_Buffer) & "]," & UserIndex & ")", CodeTracker '//\\LOGLINE//\\
   
    'Get the IP and reason
    IP = rBuf.Get_String
    Reason = rBuf.Get_String
   
    'Confirm that the user has a high enough GM level
    If UserList(UserIndex).Flags.GMLevel = 0 Then Exit Sub
   
    'Check for a reason and IP
    If LenB(Reason) = 0 Then Exit Sub
    If LenB(IP) = 0 Then Exit Sub
   
    'Check if the IP is in the database
    DB_RS.Open "SELECT ip FROM banned_ips WHERE `ip`='" & IP & "'", DB_Conn, adOpenStatic, adLockOptimistic
    If Not DB_RS.EOF Then
        'IP already exists
        DB_RS.Close
        Data_Send ToIndex, UserIndex, cMessage(98).Data
        Exit Sub
    End If
    DB_RS.Close
   
    'Split up the IP values
    TempS = Split(IP, ".")
    If UBound(TempS) <> 3 Then Exit Sub
   
    'Check for a valid value on each slot
    For i = 0 To 3
        If Val(TempS(i)) < 0 Or Val(TempS(i)) > 255 Then Exit Sub
    Next i
   
    'Add the IP and reason to the database
    DB_RS.Open "SELECT * FROM banned_ips WHERE 0=1", DB_Conn, adOpenStatic, adLockOptimistic
    DB_RS.AddNew
    DB_RS!IP = IP
    DB_RS!Reason = Reason
    DB_RS.Update
    DB_RS.Close
   
    'Send the success message
    Data_Send ToIndex, UserIndex, cMessage(99).Data
   
    'Check if anyone online is affected by the ban
    For i = 1 To LastUser
        If UserList(i).Flags.UserLogged Then
            If Server_IPisBanned(frmMain.GOREsock.Address(i), Reason) Then
                ConBuf.PreAllocate 3 + Len(Reason)
                ConBuf.Put_Byte DataCode.Server_Message
                ConBuf.Put_Byte 100
                ConBuf.Put_String Reason
                Data_Send ToIndex, UserIndex, ConBuf.Get_Buffer
                Data_Send_Buffer UserIndex
                Server_CloseSocket UserIndex
            End If
        End If
    Next i

End Sub

and replace it with this:

Sub Data_GM_BanIP(ByRef rBuf As DataBuffer, ByVal UserIndex As Integer)
'*****************************************************************
'GM bans an Name
'<IP(S)><Reason(S)>
'More info: http://www.vbgore.com/GameServer.TCP.Data_GM_BanName
'*****************************************************************
Dim TempS() As String
Dim Name As String
Dim Reason As String
Dim i As Long

    Log "Call Data_GM_BanName([" & ByteArrayToStr(rBuf.Get_Buffer) & "]," & UserIndex & ")", CodeTracker '//\\LOGLINE//\\
   
    'Get the IP and reason
    Name = rBuf.Get_String
    Reason = rBuf.Get_String
   
    'Confirm that the user has a high enough GM level
    If UserList(UserIndex).Flags.GMLevel = 0 Then Exit Sub
   
    'Check for a reason and Name
    If LenB(Reason) = 0 Then Exit Sub
    If LenB(Name) = 0 Then Exit Sub
   
    'Check if the name is in the database
    DB_RS.Open "SELECT Name FROM banned_names WHERE `name`='" & Name & "'", DB_Conn, adOpenStatic, adLockOptimistic
    If Not DB_RS.EOF Then
        'Name already exists
        DB_RS.Close
        Data_Send ToIndex, UserIndex, cMessage(98).Data
        Exit Sub
    End If
    DB_RS.Close
    'Add the Name and reason to the database
    DB_RS.Open "SELECT * FROM banned_names WHERE 0=1", DB_Conn, adOpenStatic, adLockOptimistic
    DB_RS.AddNew
    DB_RS!Name = Name
    DB_RS!Reason = Reason
    DB_RS.Update
    DB_RS.Close
   
    'Send the success message
    Data_Send ToIndex, UserIndex, cMessage(99).Data
   
    'Check if anyone online is affected by the ban
    For i = 1 To LastUser
        If UserList(i).Flags.UserLogged Then
            If Server_IPisBanned(frmMain.GOREsock.Address(i), Reason) Then
                ConBuf.PreAllocate 3 + Len(Reason)
                ConBuf.Put_Byte DataCode.Server_Message
                ConBuf.Put_Byte 100
                ConBuf.Put_String Reason
                Data_Send ToIndex, UserIndex, ConBuf.Get_Buffer
                Data_Send_Buffer UserIndex
                Server_CloseSocket UserIndex
            End If
        End If
    Next i

End Sub


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sat Dec 20, 2008 2:03 pm 
Slave to the BB

Joined: Tue Jul 31, 2007 8:45 am
Posts: 3273
Location: United Kingdom
Pretty sure there's already a banned_names thing?


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sun Dec 21, 2008 3:40 am 
=^.^= Kitty =^.^=

Joined: Wed Mar 21, 2007 6:50 am
Posts: 1002
Location: Belgium
Not sure, in SVO I think Drake added it :3


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sun Dec 21, 2008 5:14 am 
Slave to the BB

Joined: Tue Jul 31, 2007 8:45 am
Posts: 3273
Location: United Kingdom
Oh, right then. Nevermind :D


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sun Dec 21, 2008 7:57 am 
Carmack's Pimple

Joined: Tue Oct 10, 2006 9:39 am
Posts: 54
Location: Sedro-Woolley
I am working on the code of this:


If Server_IPisBanned(frmMain.GOREsock.Address(i), Reason) Then


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sun Dec 21, 2008 1:25 pm 
Wozzle Woozle Wozniak

Joined: Wed Nov 12, 2008 6:41 pm
Posts: 75
Location: Chicago Area
An IP ban is utterly pointless for anyone who has at least an 8th grade education. All you have to do is unplug your modem overnight and it'll change.

Simple knoledge of a background of it, and anyone can get back to tormenting your game.


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sun Dec 21, 2008 1:36 pm 
=^.^= Kitty =^.^=

Joined: Wed Mar 21, 2007 6:50 am
Posts: 1002
Location: Belgium
Overnight? I just unplug my router and plug it back in.

But account banning is useless aswell, since one can just remake an account.


Top
 Profile  
 
 Post subject: Re: IP Banning GM Command Addon
PostPosted: Sun Dec 21, 2008 1:45 pm 
baka

Joined: Tue Jul 08, 2008 12:17 am
Posts: 2304
Location: England, UK
Country-wide IP bans are the way to go :P


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group