Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomePortalSearchLatest imagesRegisterLog in

 

 SYIPKPKER Blocker - By Kevin

Go down 
2 posters
AuthorMessage
Master
Newbie
Master


Posts : 2
Join date : 2007-09-14

SYIPKPKER Blocker - By Kevin Empty
PostSubject: SYIPKPKER Blocker - By Kevin   SYIPKPKER Blocker - By Kevin Icon_minitimeFri Sep 14, 2007 5:32 am

Please Note: This was made in a Project16 source.

Purpose: To block those pesky attackers

Time to complete: 1 minute 11 seconds

Classes Modified: BanManager.java and server.java

Credits: 100% Kevin, 0% Guthan

Procedure:

Create a new java file by the name of "BanManager".

Put this in it:



Code:
import java.util.ArrayList;

public class BanManager


 // Made by Kevin - Rune-Server.org

  public final static void Initialize()
  {
  AddName("SYIpkpker");
  AddName("SilabSoft");
  AddName("runescape");
  AddName("thorak");

  // AddAddress("127.0.0.1"); // Example :P
  }

  public final static void AddName(String Name)
  {
    Names.add(Name.toLowerCase());
  }

  public final static boolean BannedName(String _Name)
  {
  _Name = _Name.toLowerCase();

  for(String Name : Names)
    if(_Name.contains(Name))
      return true;

  for(Character c : _Name.toCharArray()) // <3 Silabsoft
    if(!Character.isLetterOrDigit(c))
    if(!Character.isSpaceChar(c))
      return true;

  return false;
  }

  public final static void AddAddress(String Address)
  {
    Addresses.add(Address.toLowerCase());
  }

  public final static boolean BannedAddress(String _Address)
  {
  _Address = _Address.toLowerCase();

  for(String Address : Addresses)
    if(Address.equals(_Address))
      return true;

  return false;
  }

  public static ArrayList<String> Names = new ArrayList<String>();
  public static ArrayList<String> Addresses = new ArrayList<String>();
}
de:
That will allow access once by the specified name in the Initialize method.

Now go close and save that class and go to server.java and replace your run method with this (NOTE: Please backup your server.java.):




Code:
public void run()
   {
   try
   {
      shutdownClientHandler = false;
      clientListener = new java.net.ServerSocket(serverlistenerPort, 1, null);
         misc.println("NAME OF SERVER HERE");
         
         while(true)
         {
         java.net.Socket s = clientListener.accept();
            s.setTcpNoDelay(true);
            
         String connectingAddress = s.getInetAddress().getHostAddress(); // Hostnames are too long, lets use ips :) - Kevin - Rune-Server.org
         
            if(clientListener != null)
            {
            if(!BanManager.BannedAddress(connectingAddress)) // Is ip banned? - Kevin - Rune-Server.org
            {
              misc.println("ClientHandler: Accepted from "+connectingAddress+":"+s.getPort());
               playerHandler.newPlayerClient(s, connectingAddress);
            }
            else
            {
               misc.println("ClientHandler: Rejected from "+connectingAddress+":"+s.getPort());
              s.close(); // Ip is banned, lets simply refuse the connection - Kevin - Rune-Server.org
            }
            }
         }
      } catch(java.io.IOException ioe) {
         if(!shutdownClientHandler) {
            misc.println("Error: Unable to startup listener on "+serverlistenerPort+" - port already in use?");
         } else {
            misc.println("ClientHandler was shut down.");
         }
      }
   }

While still in server.java, under this:



Code:
int waitFails = 0;
      long lastTicks = System.currentTimeMillis();
      long totalTimeSpentProcessing = 0;
      int cycle = 0;
Put this:



Code:
BanManager.Initialize(); // Initialize Kevin's BanManager - Rune-Server.org
Save and close server.java and go to client.java, under this:




Code:
playerName = inStream.readString();
                        playerName.toLowerCase();
         if(playerName == null || playerName.length() == 0)
                        disconnected = true;
Put this:




Code:
if(BanManager.BannedName(playerName)) // Is username illegal or banned? - Kevin - Rune-Server.org
      {
        BanManager.AddAddress(connectedFrom); // Ban the bad user - Kevin - Rune-Server.org
        disconnected = true;
        return;
      }

- By Kevin.
Back to top Go down
orange juice
Global Moderator
Global Moderator
orange juice


Posts : 25
Join date : 2007-09-10
Age : 32
Location : Planet X

SYIPKPKER Blocker - By Kevin Empty
PostSubject: Re: SYIPKPKER Blocker - By Kevin   SYIPKPKER Blocker - By Kevin Icon_minitimeFri Sep 14, 2007 6:03 am

looks like a copy and paste but this is helpful ive seen that syipker he is extremly anoying he logs onto like 100s of accounts on the server and logs them out so there nulls (lags the server)
Back to top Go down
https://scrapscape.forumotion.com
 
SYIPKPKER Blocker - By Kevin
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: RuneScape Development :: Tutorials-
Jump to: