Thread: ALLSTARSCAPE ANTI-NULL/ANTI-SYI (flood detector) V2

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 ALLSTARSCAPE ANTI-NULL/ANTI-SYI (flood detector) V2 
    Registered Member
    Join Date
    Aug 2011
    Posts
    13
    Thanks given
    0
    Thanks received
    2
    Rep Power
    16
    NOTE: I ripped this off of DeltaScape! I give full accreditation to Delta I DO TAKE ANY CREDITS

    Description: Anti-Crash from mass players logging in from one ip as "nulls".

    Assumed Knowledge: How to read.

    Tested Server: Anybase thats allstarscape (which was called project czar - and before that it was called whitescape)

    Files Modified: server.java

    Difficulty: Noob Friendly (easy)

    NOTE:if you have 1 connection per ip "ConnectedList.java" Delete it, but if you don't delete it correctly sense its being called in on the server.java and client.java then just download a regular allstarscape clean version so you won't get errors.
    Before you start flaming "this is allstarscape this sucks why not PI?" I like shitty old 2006 servers ok? Allstar was very popular in the year 06 as the original allstarscape server had 100+ players on it.

    ]IM WEEDDAMN

    This is way better than the ALLSTAR ANTI NULL thread that i had before, the code methods were horrid. This is a little cleaner, there's no dead code.

    Step 1: // First off, Open your server.java, add this to Imports at the top As we are going to make an arraylist.

    Code:
    import java.util.ArrayList;

    Step 2: //still in server.java, find
    Code:
    public static
    under one of those add


    Code:
    	public static ArrayList<String> connections = new ArrayList<String>();
    	public static ArrayList<String> banned = new ArrayList<String>();
    	public static ArrayList<Integer> bannedUid = new ArrayList<Integer>();
    	public static int delay = 50;
    	public static long delayUpdate = 0, lastRunite = 0;

    Step 3: //Now look for your
    Code:
    public void run() {
    replace that chunk of code til the last bracket; now replace it with this
    Code:
    	
    public void run() {
    		// setup the listener
    		try {
    			shutdownClientHandler = false;
    			clientListener = new java.net.ServerSocket(serverlistenerPort, 1, null);
    			misc.println("- Project Czar -");
    			misc.println(" ..  Online!");
    			while(true) {
    				java.net.Socket s = acceptSocketSafe(clientListener);
    				s.setTcpNoDelay(true);
    				String connectingHost = s.getInetAddress().getHostName();
    				if(/*connectingHost.startsWith("localhost") || connectingHost.equals("127.0.0.1")*/true) {
    					if (connectingHost.startsWith("computing") || connectingHost.startsWith("server2")) {
    						misc.println(connectingHost+": Checking if server still is online...");
    					} else {
    						int Found = -1;
    						for (int i = 0; i < MaxConnections; i++) {
    							if (Connections[i] == connectingHost) {
    								Found = ConnectionCount[i];
    								break;
    							}
    						}
    							if (checkHost(connectingHost)) {
    							connections.add(connectingHost);
    							misc.println("Connection accepted from "+connectingHost+": "+s.getPort()+".");
    							playerHandler.newPlayerClient(s, connectingHost);
    						} else {
    							misc.println("ClientHandler: Rejected "+connectingHost+":"+s.getPort());
    							s.close();
    						}
    					}
    				} else {
    					misc.println("ClientHandler: Rejected "+connectingHost+":"+s.getPort());
    					s.close();
    				}
    
    			if ((delayUpdate > 0 && System.currentTimeMillis() > delayUpdate)) {
    			delay = 50;
    		    delayUpdate = 0;
    					}
    					Thread.sleep(100);
    				}
    				} catch (Exception e) {
    					logError(e.getMessage());
    				}
    			}

    Step 4: //Apply these public voids and booleans under
    Code:
    public static void calcTime() {
    look for the last bracket } and add:

    Code:
    	public int getConnections(String host) {
    		int count = 0;
    		for (Player p : PlayerHandler.players) {
    			if ((p != null) && !p.disconnected
    					&& p.connectedFrom.equalsIgnoreCase(host)) {
    				count++;
    			}
    		}
    		return count;
    	}
    
    	public void banHost(String host, int num) {
    		if (false) {
    			banned.add(host);
    		} else {
    			try {
    				misc.println("BANNING HOST " + host + " (flooding)");
    				banned.add(host);
    				delay = 2000;
    				delayUpdate = System.currentTimeMillis() + 60000;
    			} catch (Exception e) {
    				e.printStackTrace();
    			}
    		}
    
    	}
    
    	public boolean checkHost(String host) {
    		for (String h : banned) {
    			if (h.equals(host))
    				return false;
    		}
    		int num = 0;
    		for (String h : connections) {
    			if (host.equals(h)) {
    				num++;
    			}
    		}
    		if (num > 2) {
    			banHost(host, num);
    			return false;
    		}
    
    		if (checkLog("ipbans", host)) {
    			System.out.println("They are in ip ban list!");
    			return false; // ip ban added by bakatool
    		}
    		return true;
    	}
    
    	public boolean checkLog(String file, String playerName) {
    		// check ipbans -bakatool
    		try {
    			BufferedReader in = new BufferedReader(new FileReader("data//" + file + ".txt"));
    			String data = null;
    			while ((data = in.readLine()) != null) {
    				if (playerName.equalsIgnoreCase(data)) {
    					return true;
    				}
    			}
    		} catch (IOException e) {
    			System.out.println("Critical error while checking for data!");
    			System.out.println(file + ":" + playerName);
    			e.printStackTrace();
    		}
    		return false;
    	}
    Step 5: Save, compile, run.

    And again i take 0% credits as all i did was rip this from delta and convert the
    Code:
    public void run {
    to make it run on allstar

    NOTE: You don't have to do anything to the
    Code:
    super.destruct
    in client.java
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Apr 2012
    Age
    24
    Posts
    2,948
    Thanks given
    1,126
    Thanks received
    1,081
    Rep Power
    0
    Stopped Reading After:

    Quote Originally Posted by weedvillage View Post
    NOTE: I ripped this off of DeltaScape! I give full accreditation to Delta I DO TAKE ANY CREDITS
    Reply With Quote  
     

  3. #3  
    Registered Member
    Enjoi's Avatar
    Join Date
    Sep 2008
    Posts
    2,454
    Thanks given
    565
    Thanks received
    281
    Rep Power
    1325
    You can use Graham's thread-per-client removal tutorial to stop SYI.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Aug 2011
    Posts
    13
    Thanks given
    0
    Thanks received
    2
    Rep Power
    16
    Quote Originally Posted by Enjoi View Post
    You can use Graham's thread-per-client removal tutorial to stop SYI.
    I already did and it compiled fine, but when i ran my server it got all bugged out (player dies when you login, can't walk without dcing, weird cmd prompt errors, etc.


    Plus Graham's tutorial is too long and and it would take tripple the time on top of that just to fix these bugs. I even put the correct loadgame functions in the IOClient.java but still weird "thread-1" errors coming up on my server.run


    @ochriod

    What the fuck did you expect "NOTE: I TAKE ALL CREDITS THIS IS ALL MINE 150% ALL DAY"

    No, exactly, as far as i know i can post someone elses work aslong as i accredit them for their work. As stated in my topic. So no need to be ignorant.
    Reply With Quote  
     

  5. #5  
    Registered Member I pk3r I's Avatar
    Join Date
    Nov 2008
    Posts
    300
    Thanks given
    4
    Thanks received
    5
    Rep Power
    3
    people still use allstar? xD
    Reply With Quote  
     

  6. #6  
    Registered Member ZeroCoder's Avatar
    Join Date
    Mar 2012
    Posts
    86
    Thanks given
    0
    Thanks received
    2
    Rep Power
    53
    Glad to see People still use allstar
    Reply With Quote  
     

  7. #7  
    محمد

    Jamili's Avatar
    Join Date
    Jun 2010
    Posts
    406
    Thanks given
    93
    Thanks received
    247
    Rep Power
    307
    Rep + for you. Thank you for the contribution.
    [Only registered and activated users can see links. ]
    Spoiler for Honorable mentions:

    Quote Originally Posted by JRFisher View Post
    Dude, learn yourself, it took me 17 months of continuous research to learn how to import a project.
    Quote Originally Posted by Pollution View Post
    When? And Idiot, I'm using a oldschool, it's not easy to get the command for an oldschool, retard c u.
    Quote Originally Posted by Waj_Assif View Post
    I sayin u dont contribute never aall u do is finna tryin attack ppl and always finna start fights .......
    Quote Originally Posted by Kris View Post
    You must be one of those slower breeds.
    Quote Originally Posted by Gandalf View Post
    Just piss off ploter hacker fella dumb fuck. Your a donor to a rsps community, I'm a Mainowner to a Private Server thats 7+ Years old. Lmfao kid, get a life. Don't let my name come out of your mouth again. Or it wont end nicely for you. Understand me big boy?
    Quote Originally Posted by Tojad View Post
    What do you know about Public Void and int without this [] is only 1 integer, why?
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Dec 2008
    Posts
    1,010
    Thanks given
    0
    Thanks received
    1
    Rep Power
    271
    lol are you serious its 2012
    In absence of a real father figure I looked to Dr House for guidance through my turbulent teenaged years.
    Reply With Quote  
     

  9. #9  
    Registered Member Pentiun's Avatar
    Join Date
    Jun 2010
    Posts
    167
    Thanks given
    5
    Thanks received
    9
    Rep Power
    0
    I do say - I miss allstar :/

    Proud ZaZuScape Founder
    We are back... We are not forgotten... We are ZaZuScape.


    ZaZuScape is Back, and we are trying to Find a Client Developer for Renamed - Do you wish to be apart? Pm Me
    Reply With Quote  
     

  10. #10  
    RuneAdventure - The Epic Adventure

    Thock321's Avatar
    Join Date
    Jul 2011
    Posts
    1,809
    Thanks given
    706
    Thanks received
    363
    Rep Power
    416
    A lot of you guys say you all love allstar but you use PI.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Anti-Flood,Null,SYI [HashMap's]
    By Neekage in forum Tutorials
    Replies: 31
    Last Post: 08-02-2011, 02:50 AM
  2. Anti-Null/Flood[SP]
    By Rag3 in forum Requests
    Replies: 0
    Last Post: 06-29-2011, 05:58 PM
  3. anti null, flood ect
    By sexyrussian in forum Help
    Replies: 6
    Last Post: 06-23-2010, 08:02 PM
  4. Anti-Flood,Null,SYI [HashMap's]
    By Neekage in forum Tutorials
    Replies: 2
    Last Post: 05-01-2010, 07:15 AM
  5. Anti-DDoS/Anti-Connection Flood.
    By I Justin I in forum Tutorials
    Replies: 6
    Last Post: 01-10-2008, 11:41 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •