Thread: [PI] UUID Banning

Page 1 of 21 12311 ... LastLast
Results 1 to 10 of 207
  1. #1 [PI] UUID Banning 
    Get On My Level

    ItsGoml's Avatar
    Join Date
    Dec 2010
    Posts
    643
    Thanks given
    11
    Thanks received
    79
    Rep Power
    391
    So a few people have been asking me to release this:
    UUID Banning [Very Secure Ban] so here it is!

    Difficulty: 3/10 (just copy and paste, brain needed!)

    THIS CURRENTLY ONLY WORKS ON WINDOWS. JUST FINISHING IT UP TO WORK ON MAC!

    IF YOU DID THIS BEFORE PAGE 3 PLEASE ADD THE PLAYER SAVING PART IN THIS TUTORIAL!!

    Lets start off with the client stuff!

    ****Client****

    Ok so first add this java class:
    CreateUID.java

    Once you got that open up client.java and look for
    Code:
    private void login(String s, String s1, boolean flag)
    now in that method look for:

    Code:
    stream.writeDWord(signlink.uid);
    or if you don't have that look for:

    Code:
    stream.writeDWord(/*signlink.uid*/999999);
    now under that add:
    Code:
    stream.writeString(CreateUID.generateUID());
    now look for:

    Code:
    if(k == 21)
    			{
    				for(int k1 = socketStream.read(); k1 >= 0; k1--)
    				{
    					loginMessage1 = "You have only just left another world";
    					loginMessage2 = "Your profile will be transferred in: " + k1 + " seconds";
    					drawLoginScreen(true);
    					try
    					{
    						Thread.sleep(1000L);
    					}
    					catch(Exception _ex) { }
    				}
    
    				login(s, s1, flag);
    				return;
    			}
    and under that add:

    Code:
    if(k == 22) {
    				loginMessage1 = "Your computer has been UUID banned.";
    				loginMessage2 = "Please appeal on the forums.";
    				return;
    			}
    Great now you're done with the client sided part.

    Onto server.

    ****Server****

    Open up Connection.java

    and near the top you should see:
    Code:
    public static Collection<String> bannedIps = new ArrayList<String> ();
    or something similar. Under those add this:

    Code:
    public static Collection<String> bannedUid = new ArrayList<String> ();
    A few lines under you should see:
    Code:
    public static void initialize() {
    somewhere in that method add:
    Code:
    banUid();
    Then add this:

    Code:
    public static void unUidBanUser(String name) {
    		bannedUid.remove(name);
    		deleteFromFile("./Data/bans/UUIDBans.txt", name);	
    	}
    add this method too:

    Code:
    static String uidForUser = null;
    	public static void getUidForUser(Client c, String name) {
    		  File file = new File("./Data/characters/" + name + ".txt");
    	        StringBuffer contents = new StringBuffer();
    	        BufferedReader reader = null;
    	        boolean error = false;
    	        try {
    	            reader = new BufferedReader(new FileReader(file));
    	            String text = null;
    	            int line = 0;
    	            int done = 0;
    	            // repeat until all lines is read
    	            while ((text = reader.readLine()) != null && done == 0) {
    	            	text = text.trim();
    	            	line += 1;
    	            	if(line >= 6) {
    	            		text = text.trim();
    	            		int spot = text.indexOf("=");
    	            		String token = text.substring(0, spot);
    	            		token = token.trim();
    	            		String token2 = text.substring(spot + 1);
    	            		token2 = token2.trim();
    	            			if(token.equalsIgnoreCase("UUID")) {
    	            				uidForUser = token2;
    	            				done = 1;
    	            			}
    	        			}
    	            }
    	        } catch (FileNotFoundException e) {
    	            e.printStackTrace();
    	            error = true;
    	            c.sendMessage("Could not find the character file "+name+".txt");
    	        } catch (IOException e) {
    	            e.printStackTrace();
    	            error = true;
    	            c.sendMessage("A problem occured while trying to read the character file for "+name+".");
    	        } finally {
    	            try {
    	                if (reader != null) {
    	                    reader.close();
    	                }
    	            } catch (IOException e) {
    	                e.printStackTrace();
    	            }
    	        }
    	        //System.out.println(macForUser);
    	        if(!error) {
    	        bannedUid.remove(uidForUser);
    			deleteFromFile("./Data/bans/UUIDBans.txt", uidForUser);
    			c.sendMessage("@red@Un-UUID banned user "+name+" with the UUID address of "+uidForUser+".");
    	        }
    	}
    Then this:

    Code:
    public static void addUidToBanList(String UUID) {
    		bannedUid.add(UUID);
    	}
    then this:

    Code:
    public static boolean isUidBanned(String UUID) {
    		return bannedUid.contains(UUID);
    	}
    then this:

    Code:
    public static void removeUidFromBanList(String UUID) {
    		bannedUid.remove(UUID);
    		deleteFromFile("./Data/bans/UUIDBans.txt", UUID);	
    	}
    next add this method (it reads all the banned UUIDS on server startup):

    Code:
    public static void banUid() {
    		try {
    			BufferedReader in = new BufferedReader(new FileReader("./Data/bans/UUIDBans.txt"));
    			String data;
    			try {
    				while ((data = in.readLine()) != null) {
    					addUidToBanList(data);
    					System.out.println(data);
    				}
    			} finally {
    				in.close();
    			}
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    after add this (writes uuids to text file):
    Code:
    public static void addUidToFile(String UUID) {
    		try {
    			BufferedWriter out = new BufferedWriter(new FileWriter("./Data/bans/UUIDBans.txt", true));
    		    try {
    				out.newLine();
    				out.write(UUID);
    		    } finally {
    				out.close();
    		    }
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    Great now save and close.

    Now open up RS2LoginProtocolDecoder.java.

    Once in there add this:

    Code:
    public static String UUID;
    next search for:

    Code:
    if(uid !=
    or something similar. Then under that if statement you should add:

    Code:
    UUID = readRS2String(rsaBuffer);
    if you don't use RSA encryption then add:

    Code:
    UUID = readRS2String(in);
    next search for:

    Code:
    load(session, uid, name, pass, inC, outC, version);
    and change that to:

    Code:
    load(session, uid, name, pass, inC, outC, version, UUID);
    After that look for:
    Code:
    private synchronized void load(final IoSession session, final int uid, String name, String pass, final ISAACRandomGen inC, ISAACRandomGen outC, int version) {
    and change that to:
    Code:
    private synchronized void load(final IoSession session, final int uid, String name, String pass, final ISAACRandomGen inC, ISAACRandomGen outC, int version, String UUID) {
    now in that same method (synchronized void load) look for:
    Code:
    if(Connection.isNamedBanned(cl.playerName)) {
    under that if statement add this:

    Code:
    if(Connection.isUidBanned(UUID)) {
    			returnCode = 22;
    		}
    Good now you're done with that.
    Now lets open commands.java!

    add this command:
    Code:
     if (playerCommand.startsWith("uidban")) {
                    try {
                        String playerToBan = playerCommand.substring(7);
                        for (int i = 0; i < PlayerHandler.players.length; i++) {
                            if (PlayerHandler.players[i] != null) {
                                if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan) && PlayerHandler.players[i].playerRights != 3) {
                                    Connection.addUidToBanList(PlayerHandler.players[i].UUID);
                                    Connection.addUidToFile(PlayerHandler.players[i].UUID);
                                    if (c.playerRights == 3) {
                                        c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been UUID Banned with the UUID: " + PlayerHandler.players[i].UUID);
                                    } else {
                                        c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been UUID Banned.");
                                    }
                                  PlayerHandler.players[i].disconnected = true;
                                }
                            }
                        }
                    } catch (Exception ignored) {
                    }
                }
    and then add this one to unban:

    Code:
     if(playerCommand.startsWith("unuidban")) {
                	 String player = playerCommand.substring(9);
                	 Connection.getUidForUser(c, player);
                }
    you also might have to add this import:
    Code:
    import server.Connection;
    Ok now onto saving their UUID to their char file.
    Open Player.java and add:

    Code:
    public String UUID = "";
    now open Playersave.java and look for:
    Code:
    characterfile.write("character-rights = ", 0, 19);
    			characterfile.write(Integer.toString(p.playerRights), 0, Integer.toString(p.playerRights).length());
    			characterfile.newLine();
    and right under that add:
    Code:
    characterfile.write("UUID = ", 0, 7);
    			characterfile.write(p.UUID, 0, p.UUID.length());
    			characterfile.newLine();
    Now for the last part. Open up client.java and look for "void initialize" then in that method add:
    Code:
    UUID = RS2LoginProtocolDecoder.UUID;
    Thats all!

    If you use this please thank me! Have a nice day .

    Spoiler for FIX!!:

    If you get this error:
    Code:
    unreported exception Exception; must be caught or dec
    lared to be thrown
    then search for (in the same method where that error is):
    Code:
    catch(IOException _ex)
    		{
    			loginMessage1 = "";
    and under that add:
    Code:
    } catch (Exception e) {
    			System.out.println("Error while generating uid. Skipping step.");
    			e.printStackTrace();
    		}
    Spoiler for My Vouches:

    Quote Originally Posted by Randon View Post
    huge vouch for this guy! 100% legit
    Quote Originally Posted by xGenesis R View Post
    Friendly bump + vouch, reliable.



    Reply With Quote  
     


  2. #2  
    Extreme Donator [PI] UUID Banning Market Banned



    Join Date
    Dec 2010
    Age
    25
    Posts
    6,060
    Thanks given
    1,692
    Thanks received
    1,238
    Rep Power
    1765
    Good work
    Reply With Quote  
     

  3. #3  
    Respected Member

    Revil's Avatar
    Join Date
    Nov 2010
    Age
    30
    Posts
    4,860
    Thanks given
    3,715
    Thanks received
    2,228
    Rep Power
    5000
    Will use this later, thanks goml. subbed to the thread.
    Reply With Quote  
     

  4. #4  
    Super Donator
    Haskell Curry's Avatar
    Join Date
    Nov 2009
    Posts
    850
    Thanks given
    602
    Thanks received
    247
    Rep Power
    0
    Quote Originally Posted by ItsGoml View Post
    So a few people have been asking me to release this:
    UUID Banning [Very Secure Ban] so here it is!

    Difficulty: 3/10 (just copy and paste, brain needed!)

    THIS CURRENTLY ONLY WORKS ON WINDOWS. JUST FINISHING IT UP TO WORK ON MAC!

    Lets start off with the client stuff!

    ****Client****

    Ok so first add this java class:
    CreateUID.java

    Once you got that open up client.java and look for
    Code:
    private void login(String s, String s1, boolean flag)
    now in that method look for:

    Code:
    stream.writeDWord(signlink.uid);
    or if you don't have that look for:

    Code:
    stream.writeDWord(/*signlink.uid*/999999);
    now under that add:
    Code:
    stream.writeString(CreateUID.generateUID());
    now look for:

    Code:
    if(k == 21)
                {
                    for(int k1 = socketStream.read(); k1 >= 0; k1--)
                    {
                        loginMessage1 = "You have only just left another world";
                        loginMessage2 = "Your profile will be transferred in: " + k1 + " seconds";
                        drawLoginScreen(true);
                        try
                        {
                            Thread.sleep(1000L);
                        }
                        catch(Exception _ex) { }
                    }
    
                    login(s, s1, flag);
                    return;
                }
    and under that add:

    Code:
    if(k == 22) {
                    loginMessage1 = "Your computer has been UUID banned.";
                    loginMessage2 = "Please appeal on the forums.";
                    return;
                }
    Great now you're done with the client sided part.

    Onto server.

    ****Server****

    Open up Connection.java

    and near the top you should see:
    Code:
    public static Collection<String> bannedIps = new ArrayList<String> ();
    or something similar. Under those add this:

    Code:
    public static Collection<String> bannedUid = new ArrayList<String> ();
    A few lines under you should see:
    Code:
    public static void initialize() {
    somewhere in that method add:
    Code:
    banUid();
    Then add this:

    Code:
    public static void unUidBanUser(String name) {
            bannedUid.remove(name);
            deleteFromFile("./Data/bans/UUIDBans.txt", name);    
        }
    add this method too:

    Code:
    static String uidForUser = null;
        public static void getUidForUser(Client c, String name) {
              File file = new File("./Data/characters/" + name + ".txt");
                StringBuffer contents = new StringBuffer();
                BufferedReader reader = null;
                boolean error = false;
                try {
                    reader = new BufferedReader(new FileReader(file));
                    String text = null;
                    int line = 0;
                    int done = 0;
                    // repeat until all lines is read
                    while ((text = reader.readLine()) != null && done == 0) {
                        text = text.trim();
                        line += 1;
                        if(line >= 6) {
                            text = text.trim();
                            int spot = text.indexOf("=");
                            String token = text.substring(0, spot);
                            token = token.trim();
                            String token2 = text.substring(spot + 1);
                            token2 = token2.trim();
                                if(token.equalsIgnoreCase("UUID")) {
                                    uidForUser = token2;
                                    done = 1;
                                }
                            }
                    }
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                    error = true;
                    c.sendMessage("Could not find the character file "+name+".txt");
                } catch (IOException e) {
                    e.printStackTrace();
                    error = true;
                    c.sendMessage("A problem occured while trying to read the character file for "+name+".");
                } finally {
                    try {
                        if (reader != null) {
                            reader.close();
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                //System.out.println(macForUser);
                if(!error) {
                bannedUid.remove(uidForUser);
                deleteFromFile("./Data/bans/UUIDBans.txt", uidForUser);
                c.sendMessage("@red@Un-UUID banned user "+name+" with the UUID address of "+uidForUser+".");
                }
        }
    Then this:

    Code:
    public static void addUidToBanList(String UUID) {
            bannedUid.add(UUID);
        }
    then this:

    Code:
    public static boolean isUidBanned(String UUID) {
            return bannedUid.contains(UUID);
        }
    then this:

    Code:
    public static void removeUidFromBanList(String UUID) {
            bannedUid.remove(UUID);
            deleteFromFile("./Data/bans/UUIDBans.txt", UUID);    
        }
    next add this method (it reads all the banned UUIDS on server startup):

    Code:
    public static void banUid() {
            try {
                BufferedReader in = new BufferedReader(new FileReader("./Data/bans/UUIDBans.txt"));
                String data;
                try {
                    while ((data = in.readLine()) != null) {
                        addUidToBanList(data);
                        System.out.println(data);
                    }
                } finally {
                    in.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    after add this (writes uuids to text file):
    Code:
    public static void addUidToFile(String UUID) {
            try {
                BufferedWriter out = new BufferedWriter(new FileWriter("./Data/bans/UUIDBans.txt", true));
                try {
                    out.newLine();
                    out.write(UUID);
                } finally {
                    out.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    Great now save and close.

    Now open up RS2LoginProtocolDecoder.java.

    Once in there add this:

    Code:
    public static String UUID;
    next search for:

    Code:
    if(uid !=
    or something similar. Then under that if statement you should add:

    Code:
    UUID = readRS2String(rsaBuffer);
    if you don't use RSA encryption then add:

    Code:
    UUID = readRS2String(in);
    next search for:

    Code:
    load(session, uid, name, pass, inC, outC, version);
    and change that to:

    Code:
    load(session, uid, name, pass, inC, outC, version, UUID);
    After that look for:
    Code:
    private synchronized void load(final IoSession session, final int uid, String name, String pass, final ISAACRandomGen inC, ISAACRandomGen outC, int version) {
    and change that to:
    Code:
    private synchronized void load(final IoSession session, final int uid, String name, String pass, final ISAACRandomGen inC, ISAACRandomGen outC, int version, String UUID) {
    now in that same method (synchronized void load) look for:
    Code:
    if(Connection.isNamedBanned(cl.playerName)) {
    under that if statement add this:

    Code:
    if(Connection.isUidBanned(UUID)) {
                returnCode = 22;
            }
    Good now you're done with that.
    Now lets open commands.java!

    add this command:
    Code:
     if (playerCommand.startsWith("uidban")) {
                    try {
                        String playerToBan = playerCommand.substring(7);
                        for (int i = 0; i < PlayerHandler.players.length; i++) {
                            if (PlayerHandler.players[i] != null) {
                                if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan) && PlayerHandler.players[i].playerRights != 3) {
                                    Connection.addUidToBanList(PlayerHandler.players[i].UUID);
                                    Connection.addUidToFile(PlayerHandler.players[i].UUID);
                                    if (c.playerRights == 3) {
                                        c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been UUID Banned with the UUID: " + PlayerHandler.players[i].UUID);
                                    } else {
                                        c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been UUID Banned.");
                                    }
                                  PlayerHandler.players[i].disconnected = true;
                                }
                            }
                        }
                    } catch (Exception ignored) {
                    }
                }
    and then add this one to unban:

    Code:
     if(playerCommand.startsWith("unuidban")) {
                     String player = playerCommand.substring(9);
                     Connection.getUidForUser(c, player);
                }
    you also might have to add this import:
    Code:
    import server.Connection;
    Thats all!

    If you use this please thank me! Have a nice day .
    Good work, I'm going to convert this to Shards and use it.
    Repped.
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Apr 2012
    Age
    27
    Posts
    2,936
    Thanks given
    1,126
    Thanks received
    1,081
    Rep Power
    0
    Spoiler for You never know:
    Quote Originally Posted by ItsGoml View Post
    So a few people have been asking me to release this:
    UUID Banning [Very Secure Ban] so here it is!

    Difficulty: 3/10 (just copy and paste, brain needed!)

    THIS CURRENTLY ONLY WORKS ON WINDOWS. JUST FINISHING IT UP TO WORK ON MAC!

    Lets start off with the client stuff!

    ****Client****

    Ok so first add this java class:
    CreateUID.java

    Once you got that open up client.java and look for
    Code:
    private void login(String s, String s1, boolean flag)
    now in that method look for:

    Code:
    stream.writeDWord(signlink.uid);
    or if you don't have that look for:

    Code:
    stream.writeDWord(/*signlink.uid*/999999);
    now under that add:
    Code:
    stream.writeString(CreateUID.generateUID());
    now look for:

    Code:
    if(k == 21)
    			{
    				for(int k1 = socketStream.read(); k1 >= 0; k1--)
    				{
    					loginMessage1 = "You have only just left another world";
    					loginMessage2 = "Your profile will be transferred in: " + k1 + " seconds";
    					drawLoginScreen(true);
    					try
    					{
    						Thread.sleep(1000L);
    					}
    					catch(Exception _ex) { }
    				}
    
    				login(s, s1, flag);
    				return;
    			}
    and under that add:

    Code:
    if(k == 22) {
    				loginMessage1 = "Your computer has been UUID banned.";
    				loginMessage2 = "Please appeal on the forums.";
    				return;
    			}
    Great now you're done with the client sided part.

    Onto server.

    ****Server****

    Open up Connection.java

    and near the top you should see:
    Code:
    public static Collection<String> bannedIps = new ArrayList<String> ();
    or something similar. Under those add this:

    Code:
    public static Collection<String> bannedUid = new ArrayList<String> ();
    A few lines under you should see:
    Code:
    public static void initialize() {
    somewhere in that method add:
    Code:
    banUid();
    Then add this:

    Code:
    public static void unUidBanUser(String name) {
    		bannedUid.remove(name);
    		deleteFromFile("./Data/bans/UUIDBans.txt", name);	
    	}
    add this method too:

    Code:
    static String uidForUser = null;
    	public static void getUidForUser(Client c, String name) {
    		  File file = new File("./Data/characters/" + name + ".txt");
    	        StringBuffer contents = new StringBuffer();
    	        BufferedReader reader = null;
    	        boolean error = false;
    	        try {
    	            reader = new BufferedReader(new FileReader(file));
    	            String text = null;
    	            int line = 0;
    	            int done = 0;
    	            // repeat until all lines is read
    	            while ((text = reader.readLine()) != null && done == 0) {
    	            	text = text.trim();
    	            	line += 1;
    	            	if(line >= 6) {
    	            		text = text.trim();
    	            		int spot = text.indexOf("=");
    	            		String token = text.substring(0, spot);
    	            		token = token.trim();
    	            		String token2 = text.substring(spot + 1);
    	            		token2 = token2.trim();
    	            			if(token.equalsIgnoreCase("UUID")) {
    	            				uidForUser = token2;
    	            				done = 1;
    	            			}
    	        			}
    	            }
    	        } catch (FileNotFoundException e) {
    	            e.printStackTrace();
    	            error = true;
    	            c.sendMessage("Could not find the character file "+name+".txt");
    	        } catch (IOException e) {
    	            e.printStackTrace();
    	            error = true;
    	            c.sendMessage("A problem occured while trying to read the character file for "+name+".");
    	        } finally {
    	            try {
    	                if (reader != null) {
    	                    reader.close();
    	                }
    	            } catch (IOException e) {
    	                e.printStackTrace();
    	            }
    	        }
    	        //System.out.println(macForUser);
    	        if(!error) {
    	        bannedUid.remove(uidForUser);
    			deleteFromFile("./Data/bans/UUIDBans.txt", uidForUser);
    			c.sendMessage("@red@Un-UUID banned user "+name+" with the UUID address of "+uidForUser+".");
    	        }
    	}
    Then this:

    Code:
    public static void addUidToBanList(String UUID) {
    		bannedUid.add(UUID);
    	}
    then this:

    Code:
    public static boolean isUidBanned(String UUID) {
    		return bannedUid.contains(UUID);
    	}
    then this:

    Code:
    public static void removeUidFromBanList(String UUID) {
    		bannedUid.remove(UUID);
    		deleteFromFile("./Data/bans/UUIDBans.txt", UUID);	
    	}
    next add this method (it reads all the banned UUIDS on server startup):

    Code:
    public static void banUid() {
    		try {
    			BufferedReader in = new BufferedReader(new FileReader("./Data/bans/UUIDBans.txt"));
    			String data;
    			try {
    				while ((data = in.readLine()) != null) {
    					addUidToBanList(data);
    					System.out.println(data);
    				}
    			} finally {
    				in.close();
    			}
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    after add this (writes uuids to text file):
    Code:
    public static void addUidToFile(String UUID) {
    		try {
    			BufferedWriter out = new BufferedWriter(new FileWriter("./Data/bans/UUIDBans.txt", true));
    		    try {
    				out.newLine();
    				out.write(UUID);
    		    } finally {
    				out.close();
    		    }
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    Great now save and close.

    Now open up RS2LoginProtocolDecoder.java.

    Once in there add this:

    Code:
    public static String UUID;
    next search for:

    Code:
    if(uid !=
    or something similar. Then under that if statement you should add:

    Code:
    UUID = readRS2String(rsaBuffer);
    if you don't use RSA encryption then add:

    Code:
    UUID = readRS2String(in);
    next search for:

    Code:
    load(session, uid, name, pass, inC, outC, version);
    and change that to:

    Code:
    load(session, uid, name, pass, inC, outC, version, UUID);
    After that look for:
    Code:
    private synchronized void load(final IoSession session, final int uid, String name, String pass, final ISAACRandomGen inC, ISAACRandomGen outC, int version) {
    and change that to:
    Code:
    private synchronized void load(final IoSession session, final int uid, String name, String pass, final ISAACRandomGen inC, ISAACRandomGen outC, int version, String UUID) {
    now in that same method (synchronized void load) look for:
    Code:
    if(Connection.isNamedBanned(cl.playerName)) {
    under that if statement add this:

    Code:
    if(Connection.isUidBanned(UUID)) {
    			returnCode = 22;
    		}
    Good now you're done with that.
    Now lets open commands.java!

    add this command:
    Code:
     if (playerCommand.startsWith("uidban")) {
                    try {
                        String playerToBan = playerCommand.substring(7);
                        for (int i = 0; i < PlayerHandler.players.length; i++) {
                            if (PlayerHandler.players[i] != null) {
                                if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan) && PlayerHandler.players[i].playerRights != 3) {
                                    Connection.addUidToBanList(PlayerHandler.players[i].UUID);
                                    Connection.addUidToFile(PlayerHandler.players[i].UUID);
                                    if (c.playerRights == 3) {
                                        c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been UUID Banned with the UUID: " + PlayerHandler.players[i].UUID);
                                    } else {
                                        c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been UUID Banned.");
                                    }
                                  PlayerHandler.players[i].disconnected = true;
                                }
                            }
                        }
                    } catch (Exception ignored) {
                    }
                }
    and then add this one to unban:

    Code:
     if(playerCommand.startsWith("unuidban")) {
                	 String player = playerCommand.substring(9);
                	 Connection.getUidForUser(c, player);
                }
    you also might have to add this import:
    Code:
    import server.Connection;
    Thats all!

    If you use this please thank me! Have a nice day .


    Spoiler for The Class:
    Code:
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.InputStreamReader;
    
    
    public class CreateUID {
    
    	public static String getWMIValue(String wmiQueryStr, String wmiCommaSeparatedFieldName) throws Exception
    	{
    		String vbScript = getVBScript(wmiQueryStr, wmiCommaSeparatedFieldName);
    		String tmpDirName = getEnvVar("TEMP").trim();
    		String tmpFileName = tmpDirName + File.separator + "jwmi.vbs";
    		writeStrToFile(tmpFileName, vbScript);
    		String output = execute(new String[] {"cmd.exe", "/C", "cscript.exe", tmpFileName});
    		new File(tmpFileName).delete();
    				
    		return output.trim();
    	}
    	private static final String CRLF = "\r\n";
    	
    	private static String getVBScript(String wmiQueryStr, String wmiCommaSeparatedFieldName)
    	{
    		String vbs = "Dim oWMI : Set oWMI = GetObject(\"winmgmts:\")"+CRLF;
    		vbs += "Dim classComponent : Set classComponent = oWMI.ExecQuery(\""+wmiQueryStr+"\")"+CRLF;
    		vbs += "Dim obj, strData"+CRLF;
    		vbs += "For Each obj in classComponent"+CRLF;
    		String[] wmiFieldNameArray = wmiCommaSeparatedFieldName.split(",");
    		for(int i = 0; i < wmiFieldNameArray.length; i++)
    		{
    			vbs += "  strData = strData & obj."+wmiFieldNameArray[i]+" & VBCrLf"+CRLF;
    		}
    		vbs += "Next"+CRLF;
    		vbs += "wscript.echo strData"+CRLF;
    		return vbs;
    	}
    	
    	private static String getEnvVar(String envVarName) throws Exception
    	{
    		String varName = "%"+envVarName+"%";
    		String envVarValue = execute(new String[] {"cmd.exe", "/C", "echo "+varName});
    		if(envVarValue.equals(varName))
    		{
    			throw new Exception("Environment variable '"+envVarName+"' does not exist!");
    		}
    		return envVarValue;
    	}
    	
    	private static void writeStrToFile(String filename, String data) throws Exception
    	{
    		FileWriter output = new FileWriter(filename);
    		output.write(data);
    		output.flush();
    		output.close();
    		output = null;
    	}
    	
    	private static String execute(String[] cmdArray) throws Exception
    	{
    		Process process = Runtime.getRuntime().exec(cmdArray);
    		BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
    		String output = "";
    		String line = "";
    		while((line = input.readLine()) != null)
    		{
    			//need to filter out lines that don't contain our desired output
    			if(!line.contains("Microsoft") && !line.equals(""))
    			{
    				output += line +CRLF;
    			}
    		}
    		process.destroy();
    		process = null;
    		return output.trim();
    	}
    
    	
    	public static String generateUID() throws Exception {
    		String serial = getWMIValue("SELECT SerialNumber FROM Win32_BIOS", "SerialNumber");
    		//serial = serial.replaceAll("[^\\d]", "");
    		String idate = getWMIValue("Select InstallDate from Win32_OperatingSystem", "InstallDate");
    		//idate = idate.replaceAll("[^\\d]", "");
    		return (serial.concat(idate));
    		
    	}
    	
    	public static final String CLASS_Win32_BIOS = "Win32_BIOS";
    	public static final String CLASS_Win32_OperatingSystem = "Win32_OperatingSystem";
    }


    Amazing Contribution.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Ninja assassin's Avatar
    Join Date
    Oct 2008
    Posts
    1,961
    Thanks given
    217
    Thanks received
    115
    Rep Power
    77
    This is realy good
    Btc: 1tpWTbAznzWYh6YpoUJeQ3MDVK56GGJ
    Reply With Quote  
     

  7. #7  
    Registered Member Kovu's Avatar
    Join Date
    May 2011
    Posts
    80
    Thanks given
    11
    Thanks received
    14
    Rep Power
    23
    Just wondering.. what's stopping the user from editing the client to send a fake uuid that isn't banned?
    Reply With Quote  
     

  8. #8  
    Banned
    Join Date
    Apr 2012
    Posts
    50
    Thanks given
    1
    Thanks received
    6
    Rep Power
    0
    Glad to see you released this. Thank you very much.
    Reply With Quote  
     

  9. #9  
    Get On My Level

    ItsGoml's Avatar
    Join Date
    Dec 2010
    Posts
    643
    Thanks given
    11
    Thanks received
    79
    Rep Power
    391
    Quote Originally Posted by noobplayer1 View Post
    Just wondering.. what's stopping the user from editing the client to send a fake uuid that isn't banned?
    If you obfuscate it then their knowledge of java would. And if you use RSA encryption then they wouldn't be able to falsify the packet.

    And thank you everyone who likes it
    Spoiler for My Vouches:

    Quote Originally Posted by Randon View Post
    huge vouch for this guy! 100% legit
    Quote Originally Posted by xGenesis R View Post
    Friendly bump + vouch, reliable.



    Reply With Quote  
     

  10. #10  
    Registered Member Kovu's Avatar
    Join Date
    May 2011
    Posts
    80
    Thanks given
    11
    Thanks received
    14
    Rep Power
    23
    Quote Originally Posted by ItsGoml View Post
    If you obfuscate it then their knowledge of java would. And if you use RSA encryption then they wouldn't be able to falsify the packet.

    And thank you everyone who likes it
    I do, but 95% of the community doesn't(even though they should). I see what your getting at though, you should tell them they have to enable rsa first before they do this.

    P.S. Good Job
    Reply With Quote  
     

Page 1 of 21 12311 ... 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. UUID Banning [Very Secure Ban]
    By ItsGoml in forum Show-off
    Replies: 60
    Last Post: 11-29-2012, 04:46 PM
  2. Replies: 9
    Last Post: 07-12-2011, 10:15 PM
  3. ip banning
    By mrprostat in forum Help
    Replies: 1
    Last Post: 02-04-2009, 07:51 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
  •