[Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Account Upgraded | Title Enabled! SuperLol is offline
    MemberRank
    Jun 2010 Join Date
    801Posts

    [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    PHP Code:
        public void updateMacs(String macData) {
            
    boolean ban false;
            try {
                if (
    macs.isEmpty()) {
                    
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("SELECT macs FROM accounts WHERE id = ?");
                    
    ps.setInt(1accId);
                    
    ResultSet rs ps.executeQuery();
                    if (
    rs.next()) {
                        
    String s rs.getString("macs");
                        if (
    != null) {
                            for (
    String mac s.split(", ")) {
                                if (
    mac.length() != 0) {
                                    
    macs.add(mac);
                                }
                            }
                        }
                    }
                    
    rs.close();
                    
    ps.close();
                }
            } catch (
    SQLException se) {
            }
            
    macs.addAll(Arrays.asList(macData.split(", ")));
            
    StringBuilder newMacData = new StringBuilder(16);
            for (
    String s macs) {
                
    newMacData.append(s);
                if (
    s.equals("00-1C-C0-E8-AB-70")) { // troublesome mac, should be blacklisted everywhere. insert more here
                    
    ban true;
                }
                
    newMacData.append(", ");
            }
            
    newMacData.setLength(newMacData.length() - 2);
            try {
                
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("UPDATE accounts SET macs = ?, ip = ? WHERE id = ?");
                
    ps.setString(1newMacData.toString());
                
    ps.setString(2session.getRemoteAddress().toString().split(":")[0]);
                
    ps.setInt(3accId);
                
    ps.executeUpdate();
                
    ps.close();
            } catch (
    SQLException e) {
            }
            if (
    ban) {
                
    this.banPlayer("banned"true);
                
    this.disconnect();
            }
        } 
    PHP Code:
        public void banPlayer(String reasonboolean accban) {
            try {
                
    Connection con DatabaseConnection.getConnection();
                
    String ip session.getRemoteAddress().toString().split(":")[0];
                
    PreparedStatement ps con.prepareStatement("SELECT ip FROM ipbans WHERE ip = ?");
                
    ps.setString(1ip);
                
    ResultSet rs ps.executeQuery();
                if (!
    rs.next()) {
                    if (!
    ip.startsWith("/220.255")) { // sg ip
                        
    ps con.prepareStatement("INSERT INTO ipbans VALUES (DEFAULT, ?)");
                        
    ps.setString(1ip);
                        
    ps.executeUpdate();
                        
    ps.close();
                    }
                }
                
    rs.close();
                
    ps.close();
                if (!
    accban) {
                    return;
                }
                
    ps con.prepareStatement("UPDATE accounts SET banned = 1, banreason = ? WHERE id = ?");
                
    ps.setString(1reason);
                
    ps.setInt(2accId);
                
    ps.executeUpdate();
                
    ps.close();
            } catch (
    SQLException e) {
                
    e.printStackTrace();
            }
        } 


  2. #2
    Valued Member ChupameElPene is offline
    MemberRank
    Feb 2010 Join Date
    115Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Yay no more SG bans.

  3. #3
    Account Upgraded | Title Enabled! jakesdexless is offline
    MemberRank
    Nov 2008 Join Date
    278Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Nice release. Came back just to post

  4. #4
    Valued Member ^^^ is offline
    MemberRank
    Aug 2009 Join Date
    124Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Cool. Nice bannings.

  5. #5
    Valued Member Blaze22 is offline
    MemberRank
    May 2009 Join Date
    119Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Yes! Good release.

  6. #6
    Account Upgraded | Title Enabled! AuroX is offline
    MemberRank
    Sep 2008 Join Date
    1,431Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Lol, now i know why certain servers which I didn't play just disconnects me at char selection without any reason.

  7. #7
    Proficient Member MatanStyle is offline
    MemberRank
    Dec 2008 Join Date
    153Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Quote Originally Posted by yenpooh View Post
    Lol, now i know why certain servers which I didn't play just disconnects me at char selection without any reason.
    Due to stupid bans and stuff. Yeah now you can set/unset this.

  8. #8
    Account Upgraded | Title Enabled! hindie is offline
    MemberRank
    Jun 2010 Join Date
    253Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    i dont get this , this basically bans all of SG ips

  9. #9
    Alpha Member XxОsirisxX is offline
    MemberRank
    Aug 2009 Join Date
    2,727Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Quote Originally Posted by hindie View Post
    i dont get this , this basically bans all of SG ips
    On the contrary, it DOESN'T ban the SG's IP. Or at least, that's the propose of what I see, apparently SG's IP's starts with 220.255.

  10. #10
    Proficient Member BrotherHoodMS is offline
    MemberRank
    Nov 2010 Join Date
    185Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Quote Originally Posted by hindie View Post
    i dont get this , this basically bans all of SG ips
    Well, tried banning a Singaporean in your server? It's like this, ban one of them 10 other also get banned, no joke.

    Really usefull release!

  11. #11
    Proficient Member BrotherHoodMS is offline
    MemberRank
    Nov 2010 Join Date
    185Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Quote Originally Posted by Kiren View Post
    Fuck off, u scold people stupid singaporean? You country more suck k. and your mother more stupid than SG.
    You completly misunderstood the point of this thread..

  12. #12
    Account Upgraded | Title Enabled! HorrorChix89 is offline
    MemberRank
    May 2010 Join Date
    ArkansasLocation
    1,279Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    I had to ban all the Singaporean players on my server. Had a large group of them come on an they ALL were hacking in some form of way. Plus, none of them spoke english and tried to use google translate. Horrible fail.

    @Kiren: No on is calling Singaporean people stupid. He was calling the bans stupid.

  13. #13
    Enthusiast FU Im a diglet is offline
    MemberRank
    Sep 2010 Join Date
    46Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Quote Originally Posted by darren557 View Post
    kiren, you're a bloody retard. you just threw our country's face away.
    It's been thrown away for a long time dude...

    OT: Nice (I guess?) I'd just ban them all, but that's just me.

  14. #14
    Account Upgraded | Title Enabled! Emilyx3 is offline
    MemberRank
    Apr 2009 Join Date
    393Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    Full Singaporean IP ranges: Major IP Address Blocks For Singapore

    Out of the range you gave only 110 were on my server's IP ban list of 12494 banned IPs =P

  15. #15
    Account Upgraded | Title Enabled! SuperLol is offline
    MemberRank
    Jun 2010 Join Date
    801Posts

    Re: [Add-on] Avoid stupid SG chain bans and add MAC bans straight into source

    You don't need to ban those. Only the ones that 1000 people share.



Page 1 of 2 12 LastLast

Advertisement