Thread: [718] Mac Adress Banning

Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1 [718] Mac Adress Banning 
    Banned
    Join Date
    Feb 2014
    Posts
    84
    Thanks given
    15
    Thanks received
    16
    Rep Power
    0
    So I have someone who was fucking w/ me on my 718 and booting players, so I made this to keep him away, and it seems to be working! (I am not that great at coding, and I just learned Arrays so... Please don't flame.)

    CLIENT SIDED
    ----------------------------------------------------------
    Class460.java under
    Code:
    Class10.method322(stream, (byte) 1);
    ---------------------
    Code:
                                                                            //MAC adress
    									InetAddress inet;
    									inet = InetAddress.getLocalHost();
    									NetworkInterface network = NetworkInterface
    											.getByInetAddress(inet);
    									int mac = ByteBuffer.wrap(network.getHardwareAddress())
    											.getInt();
    									stream.writeString(String.valueOf(mac), -1);
    ---------------------------------------------------------

    SERVER SIDED
    --------------------------------------------------------
    In LoginPacketsDecoder.java
    search for
    Code:
    public void decodeWorldLogin(InputStream stream) {
    and then
    Code:
    stream.skip(24);
    and below it add
    Code:
    MACAdress = stream.readString();
    ------------------------
    In LoginPacketsDecoder.java
    search for "banned" and below that if statement add
    Code:
    if(MacBanL.isMACBanned()) {
    	return;
    }
    and then search for "player.init"
    and above it add
    Code:
    player.setMacAdress(MACAdress);
    ----------------------
    Make a new Class called MacBanL.java
    Code:
    package com.rs.utils;
     
    import java.io.File;
    import java.util.concurrent.CopyOnWriteArrayList;
     
    import com.rs.game.player.Player;
     
    public final class MacBanL {
     
            public static CopyOnWriteArrayList<String> macList;
     
            private static final String PATH = "data/bannedMACIPS.ser";
            private static boolean edited;
     
            @SuppressWarnings("unchecked")
            public static void init() {
                    File file = new File(PATH);
                    if (file.exists())
                            try {
                                    macList = (CopyOnWriteArrayList<String>) SerializableFilesManager.loadSerializedFile(file);
                                    return;
                            } catch (Throwable e) {
                                    Logger.handle(e);
                            }
                    macList = new CopyOnWriteArrayList<String>();
            }
     
            public static final void save() {
                    if (!edited)
                            return;
                    try {
                            SerializableFilesManager.storeSerializableClass(macList, new File(PATH));
                            edited = false;
                    } catch (Throwable e) {
                            Logger.handle(e);
                    }
            }
     
            public static boolean isMacBanned(Player player) {
                    return macList.contains(player.getMACAdress());
            }
     
            public static void ban(Player player, boolean loggedIn) {
                    player.setPermBanned(true);
                    if (loggedIn) {
                            macList.add(player.getMACAdress());
                            player.getSession().getChannel().disconnect();
                    } else {
                            macList.add(player.getMACAdress());
                            SerializableFilesManager.savePlayer(player);
                    }
                    edited = true;
            }
     
            public static void unban(Player player) {
                    macList.remove(player.getMACAdress());
                    edited = true;
                    save();
            }
     
            public static void checkCurrent() {
                    for (String list : macList) {
                            System.out.println(list);
                    }
            }
     
            public static CopyOnWriteArrayList<String> getList() {
                    return macList;
            }
     
    }
    ----------------------
    Where your main starting method is add
    Code:
    MacBanL.init();
    ----------------------
    In Player.java

    Code:
    public String MACAdress;
    	public String getMACAdress() {
    		return MACAdress;
    	}
    
     public void setMacAdress(String macAdress) {
                    if(macAdress != null) {
                    this.MACAdress = macAdress;
                    }
            }
    -----------------------
    in where-ever your commands are

    Code:
    		if (cmd[0].equals("macban")) {
    			name = "";
    
    			for (int i = 1; i < cmd.length; i++)
    				name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
    
    			target = World.findPlayer(name);
    
    			if (target.isOwner()) {
    				return true;
    			}
    
    			loggedIn = World.isOnline(name);
    			
    			MacBanL.ban(target, loggedIn);
    
    			player.getPackets().sendGameMessage("You've permanently mac banned " + (loggedIn ? target.getDisplayName() : name) + ".");
    			return true;
    		}
    Feel free to give constructive criticism, Leave a Thanks if I helped you or you used this


    Credits to Hellman2741 for the process of receiving the address...................
    Creds to Taylor Moon for releasing the class460 to rip out the MACAdress shit




    EDIT: REDID THE HANDLING
    Reply With Quote  
     

  2. #2  
    Donator
    JTlr Frost's Avatar
    Join Date
    Oct 2014
    Posts
    649
    Thanks given
    69
    Thanks received
    254
    Rep Power
    34
    Looks good bud. ;d

    Speed Test
    Spoiler for The Hatred Group:


    Spoiler for Dapoosie:

    Attached image
    Attached image

    Attached image
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Feb 2014
    Posts
    84
    Thanks given
    15
    Thanks received
    16
    Rep Power
    0
    Quote Originally Posted by Pea2nuts View Post
    This is easy to get around
    Well, this is just meant to keep them fake people away but thanks for the feedback
    Reply With Quote  
     

  4. #4  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    Decent; always have null checks (with regards to your command) and don't store the array list within the player class... Store it separately and initialise it when you start up the server
    Reply With Quote  
     

  5. #5  
    Registered Member
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    26
    Posts
    5,103
    Thanks given
    1,819
    Thanks received
    1,767
    Rep Power
    2438
    every player will have the Bannedmacaddresses list now because you stored it in the player class which is serializable. this will end up giving you issues. save it in a file
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Spoiler for skrrrrr:

    Attached image
    Reply With Quote  
     

  6. #6  
    WVWVWVWVWVWVWVW

    _jordan's Avatar
    Join Date
    Nov 2012
    Posts
    3,046
    Thanks given
    111
    Thanks received
    1,848
    Rep Power
    5000
    Quote Originally Posted by Tyluur View Post
    every player will have the Bannedmacaddresses list now because you stored it in the player class which is serializable. this will end up giving you issues. save it in a file
    Don't use serialization for saving to begin with :L
    Attached image
    Attached image
    Reply With Quote  
     

  7. #7  
    Registered Member
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    26
    Posts
    5,103
    Thanks given
    1,819
    Thanks received
    1,767
    Rep Power
    2438
    Quote Originally Posted by _jordan View Post
    Don't use serialization for saving to begin with :L
    this is for matrix so i doubt op changed his player saving
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Spoiler for skrrrrr:

    Attached image
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Oct 2010
    Posts
    15
    Thanks given
    1
    Thanks received
    5
    Rep Power
    1
    Quote Originally Posted by Pea2nuts View Post
    This is easy to get around
    Yep, but it can stop some people.
    Reply With Quote  
     

  9. #9  
    Banned
    Join Date
    Feb 2014
    Posts
    84
    Thanks given
    15
    Thanks received
    16
    Rep Power
    0
    Quote Originally Posted by rayts5 View Post
    Yep, but it can stop some people.
    Thanks what I was going for lel


    And for the player shit I realized it saves it in the player file after i went back over it but it does it work? Yes, all my players are fine, and I've used it. I am making it better and will update the thread as soon as I'm done

    Quote Originally Posted by hc747 View Post
    Decent; always have null checks (with regards to your command) and don't store the array list within the player class... Store it separately and initialise it when you start up the server
    Ya I realized that, thanks for the feedback







    EDIT: REDID ALL HANDLING
    Reply With Quote  
     

  10. #10  
    Banned
    Join Date
    Feb 2014
    Posts
    84
    Thanks given
    15
    Thanks received
    16
    Rep Power
    0
    Quote Originally Posted by Tyluur View Post
    this is for matrix so i doubt op changed his player saving
    I use JSON saving ;l I don't use the normal serializable
    Reply With Quote  
     

Page 1 of 3 123 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. Replies: 7
    Last Post: 02-11-2015, 12:14 PM
  2. Matrix 718 DUPE/ Help with MAC Address Ban.
    By Belphegor in forum Help
    Replies: 7
    Last Post: 03-14-2014, 05:11 AM
  3. [Buying] 718 Mac Adress Ban
    By bobismyname in forum Buying
    Replies: 6
    Last Post: 11-01-2013, 04:46 PM
  4. 718 ip range ban and mac ban
    By helpMe in forum Requests
    Replies: 31
    Last Post: 08-12-2013, 07:36 PM
  5. mac adress ban help
    By unrealscape in forum Help
    Replies: 0
    Last Post: 01-27-2013, 08:22 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
  •