Inactive [ADMN/SEC/CHAT] SpamHammer v1.7b - Punish those spammers [1000]

Discussion in 'Inactive/Unsupported Plugins' started by dumptruckman, Jul 14, 2011.

  1. Offline

    dumptruckman

    SpamHammer - Lay down the law on spammers
    Version: v1.7b

    Detects people sending too many messages in short amounts of time (and optionally repeat messages). Mutes, kicks, and then bans players that spam the same message in that order. Server OPs are unaffected. The default settings that this installs with will only detect VERY fast messages... In other words, it will only really prevent automated spam. If you want to detect slower spam, try something like 5 messages in 3 seconds or something. Experiment!

    Instructions:
    • Download the jar to your plugin folder and start your server.
    • Change the default settings if you want:
      • Message Limit is how many messages within the Message Period (seconds) before action is taken against the player. The default is 3 messages within 1 second.
      • *NEW* Add commands to
        Code:
        commandlist:
              possiblespam:
        that you might consider to be spam. By default /g, /general and /yell are added as examples.
    • Choose whether to use each action type. (Mute/Kick/Ban)
    • Configure the messages as you like them. Mute has a mute time to keep the player muted for. Use %t in the message to replace with the mute time.
    • Set a "cool-off" time for when to reset the action level of a player.
    • Note: all times are in seconds
    • Note: actions will always happen in order unless they are disabled. Mute, kick, then ban.
    • After the config is set to your liking, restart or reload the server.
    • You can now choose to disable all punishments and instead have SpamHammer simple rate limit messages.
    Commands:
    • spamunmute - unmutes a player muted by SpamHammer
    • spamunban - unbans a player banned by SpamHammer
    • spamreset - resets the punishment level of a player.
    SuperPerm nodes:
    • spamhammer.unban - allows access to /spamunban
    • spamhammer.unmute - allows access to /spamunmute
    • spamhammer.reset - allows access to /spamreset
    • spamhammer.ignore - makes player unaffected by SpamHammer
    • spamhammer.* - grants all above permissions
    Download latest version
    Source Code

    Changelog:
    Version 1.7b
    • Now has option to not use permissions and instead use OP only for the commands. This will allow for greater compatability.
    Version 1.7a
    • No longer considers all commands for spam blocking by default. Added spammable command list to config where you should add commands that could be considered spam.
    Version 1.6
    • Added back repeat message block as a default option.
    Version 1.5a
    • Added bukkit permissions support.
    Version 1.4
    • Added config option (default: true) to prevent messages over the limit from appearing. This will allow for non-punishment solutions.
    Version 1.3b
    • Disabling certain punishments no longer breaks the ones still enabled.
    • Because this plugin could break features of BukkitContrib, players with the BC client mod on a server with the BC plugin will not be affected.
    Version 1.3a
    • SpamHammer now additionally picks up command usage to prevent using chat commands as a work-around.
    Version 1.2
    • Modified the way the plugin detects spam... Now works faster and more effectively.
    • Changed the config options.
     
    Mitsugaru and pandapipino like this.
  2. Offline

    dumptruckman

    Are you using HeroChat? If so, this a known issue. I made my end compatible, i've asked the HeroChat dev to make HeroChat compatible but he hasn't responded.
     
  3. Offline

    Monkz

    Yes i am, so that would be it then :p Alright! Now just patiently waiting for him and having it set to kick only in the meantime.
     
  4. Offline

    TheMadMan697

    The permission for ignoring a certain group does not seem to be working. i tried to add
    spamhammer.ignore and spamhammer.* to my moderators because they use too many items to spawn stuff and it mutes and kicks them for spamming. even admins with * permissions get kicked. only ops are unaffected.

    Using Permissions 2.7.4
    Bukkit RB 1000
     
  5. Offline

    dumptruckman

    The permissions used are Bukkit Permissions aka Superperms. I do not believe Permissions 2.7.4 is compatible. Sorry.

    Also, it should not be kicking them for using commands unless you added that command to the config file. If you did add it to the config, remove it. If you didn't please let me know.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  6. Offline

    TheMadMan697

    O ok that explains it. i had a look at bukkit permissions. i dont really like it. it looks like a step backwards. permissionsEx seems the most feature rich. there are so many i dont know what one to change to? anyone got any sugestions? i want to have subgroups if possible (dont think bukkit permissions has that)

    No have not added that command to the config. when somone spawns somthing using too many itmes they can click very fast and it spams the server console (not chat) with the give command and spamhammer mutes/kicks that player unless they are op
     
  7. Offline

    dumptruckman

    Well, I thought PermissionsEx supported bukkit permissions. Perhaps there's some extra steps involved. Bukkit permissions does not have it's own plugin, it is just the easiest way to add permissions into a plugin. bPermissions works with it for sure. and PermissionsEx I thought.
    Hmm... I will look into this.
     
  8. Is there a way you could have this detect cancelled chat? I'm using a chat plugin which cancels the chat event to create a local/global chat system. Due to this this plugin is unable to detect spammers. It'd be really great if you could come up with a way to detect this chat :). I'm fairly certain it's possible, as CraftIRC is able to do it :p.
     
  9. Offline

    datwerd

    sorry to bombard you with bug reports m8 but people are still getting muted on my server using /give command
    i have latest SpamHammer and cb 1000 and have not changed the blocked commands list no huge stress it doesnt seem to mute always and dont think theres been a kick or ban from commands yet just something to think about i guess
     
  10. Does not seem to work with PEX :(
     
  11. Offline

    dumptruckman

    It requires a SuperPerms manager to use permissions.
     
  12. Offline

    andune

    @Joy Which, PEX 1.13 now supports. Upgrade PEX and you're good.

    Separate question, @dumptruckman ; I use HeroChat and mute doesn't seem to do anything. Given HeroChat's popularity, any chance of integrating the mute feature with HeroChat so it works as you intended? Thanks.
     
  13. Offline

    dumptruckman

    I've actually already made my plugin as compatible as possible for HeroChat. Unfortunately HeroChat doesn't care when a CommandPreprocess event is cancelled. I've requested that HeroChat gets updated to be compatible but I believe they're working on a huge overhaul version or are just busy with Heroes.
     
  14. Oddly enough, I am running 1.13, and still people with the ignore node are getting banned. Will do more testing...
     
  15. Offline

    andune

    @Joy I've not tested the permissions nodes, TBH. I am running PEX 1.13 which I *have* tested superperms compatibility with other mods and it works fine. So assuming this mod is just using stock superperms checks and not trying to do anything fancy, it should just work (barring a bug in this plugin).

    That all said, I just set my messages/second interval high enough that it will never trigger on normal player activity. Been running this plugin on my server now for the last 24-48 hours and I haven't had it trigger yet, which is exactly what I want. I did test it locally and I know that if I get one of the 1000-messages-in-10-seconds spamtards, it will proc and kick/ban the idiot, which IS exactly what I want.
     
  16. Offline

    dumptruckman

    Indeed, that's what it is made for, really. The default setting of 3/1 should really be too fast for humans but to be safe you could do 4/1.
     
  17. Ok some progress.

    spamhammer.ignore seems to partially work now.

    Players with spamhammer.ignore can spam chat, but not commands, they still get kick/banned for command spam.
     
  18. Offline

    dumptruckman

    @Joy Hmm, i'll continue to investigate..
     
  19. Offline

    OkinKun

    Ok... 2 problems I've got.. =/

    First, it mutes/kicks/bans players for DROPING ITEMS.. -_- Which is obviously HIGHLY undesirable, unless configurable, and it's not in the configs right now.

    Second problem is that it treats usernames as Case Sensitive.. Which makes unmutting/unbanning/resetting very hard to do unless you very carefully type in the usernames.. Took me a few minutes to figure this out, leaving my spam-tester momentarily banned..

    That said, this is EXACTLY what I need! ^_^; So thanks, I hope those things can be fixed, because we can't use it till..

    I'm using bukkit 1046 at the moment, let me know if you need any other information (plugins/settings) about my setup.
     
  20. Offline

    dumptruckman

    I'll look into the second part, but as for the dropping items thing, you must have a plugin that is either forcing the player to say something or running a player command every time a player drops items. Any ideas what that might be?
     
  21. Offline

    OkinKun

    Not sure.. Here's a list of my plugins, if that helps.. =/
     
  22. Offline

    dumptruckman

    Hmmm, there's a reported bug with heroicdeath already, unfortunately, it's source is not readily available for me to see what is causing the issue. But apparently if you die a lot in rapid succession, you can trigger spamhammer. If you want, you could set the limiter to something like 6 messages every 1 second. This would mean only bot spam would be blocked, unless your players are just throwing out items extremely fast.
     
  23. Offline

    OkinKun

    Ok I'll try that.. You're right, that SHOULD help prevent the item dropping problem, shouldn't be able to drop more than 5 in a second, normally.
    Thanks for that suggestion, I've been having HORRIBLE problems with spammers all day long.

    Well, If it is being caused by some other plugin.. Might not be too much you can do. =/
    At the very least tho, it'd help if usernames didn't need to be Case Sensitive. lol

    Anyway, thanks for responding quickly! ^_^;
     
  24. Offline

    StrikeForceZero

    I'm not sure if this is the proper way of doing this since HeroChat doesn't have any documented API, but I rewrote some code to Hook HeroChat and mute players through HeroChat globally.

    I'll make a "fork" on github soon (if that's the right term for it)
    https://github.com/StrikeForceZero/SpamHammer

    Code:
    //added for herochat hooking
    import org.bukkit.plugin.Plugin;
    import com.herocraftonline.dthielke.herochat.*;
    import com.herocraftonline.dthielke.herochat.channels.ChannelManager;
    
    ...
    
    	//for herochat hook
    	public static HeroChat HeroChatHook;
    
        final public void onEnable() {
    ....
            //added for HC hook
            initHeroChatHook();
    }
    
        private void initHeroChatHook() {
        	if (HeroChatHook != null) { return; }
        	Plugin HeroChatPlugin = this.getServer().getPluginManager().getPlugin("HeroChat");
    
        	if (HeroChatPlugin == null) {
        		log.info(PLUGIN_NAME + " HeroChat not detected (!hooking)");
        	    return;
        	}
    
        	HeroChatHook = ((HeroChat) HeroChatPlugin);
        	log.info(PLUGIN_NAME + " HeroChat detected; hooking: "+((HeroChat)HeroChatPlugin).getDescription().getFullName());
        }
    
    
        public void mutePlayer(String name) {
            mutedPlayers.add(name);
            beenMuted.add(name);
            actionTime.put(name, System.currentTimeMillis() / 1000);
            String message = config.getString(MUTE_MESSAGE.toString());
            message = message.replace("%t", config.getString(MUTE_LENGTH.toString()));
            getServer().getPlayer(name).sendMessage(message);
            //HeroChat Hook
            if(HeroChatHook != null)
            {
            	HeroChatMuteToggle(name);
            }
        }
        public void HeroChatMuteToggle(String name)
        {
        	ChannelManager cm = HeroChatHook.getChannelManager();
            Player mutee = HeroChatHook.getServer().getPlayer(name);
            if (cm.getMutelist().contains(name)) {
                cm.getMutelist().remove(name);
                this.getServer().broadcastMessage(name + " has been unmuted");
                //muter.sendMessage(plugin.getTag() + "§c" + name + " has been unmuted");
                //mutee.sendMessage(HeroChatHook.getTag() + "§c"+config.getString(UNMUTE_MESSAGE.toString()));
            } else {
                cm.getMutelist().add(name);
                this.getServer().broadcastMessage(name + " has been globally muted for spamming for "+config.getString(MUTE_LENGTH.toString()));
                //muter.sendMessage(plugin.getTag() + "§c" + name + " has been globally muted for spamming for"+config.getString(MUTE_LENGTH.toString()));
                //mutee.sendMessage(HeroChatHook.getTag() + "§c"+config.getString(MUTE_MESSAGE.toString())+config.getString(MUTE_LENGTH.toString()));
            }
        }
        public void unMutePlayer(String name) {
            mutedPlayers.remove(name);
            if (getServer().getPlayer(name) != null) {
                getServer().getPlayer(name).sendMessage(config.getString(UNMUTE_MESSAGE.toString()));
            }
            //HeroChat Hook
            if(HeroChatHook != null)
            {
            	HeroChatMuteToggle(name);
            }
        }
    
     
  25. Offline

    aperture mines

    Any chance you could introduce a config option to block ALL command spam? because i really dont wanna have to go type out every dang command....
     
  26. Offline

    dumptruckman

    Working on this in the next version.
     
  27. Offline

    spunkiie

    @dumptruckman

    Your plugin just saved my life, thank you.
    As you may already know, there is a "hacked" client called Nexus, that has a .flood option to spam a HUGE amount of messages. I have a 600+ server, the fuckin' script kiddie was crashing/lagging my server with this client.

    Not anymore.

    Installed your plugin and now he get banned after 8 msgs :)

    Thank you very much and please keep the good work

    REQ: A /spamreload would be great to change configs without restarting

    btw: (native bukkit /reload its just suicide on a 600+ server)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  28. Offline

    spunkiie

    REQ: A logfile with bans/kicks and nicknames
     
  29. Offline

    dumptruckman

    mmk, i can't promise anything soon.. i'm doing a major overhaul of the code to make it a bit more efficient. Would you mind adding these as issues on github?
     
  30. Offline

    SniperXPX

    Hey man I love your plugin. Is it compatible with 1060?
     
  31. Offline

    kush

    Hello,
    does the command part go along with the Message limit settings at the top? I have a couple custom commands that run 3-4 other commands to make things easier for my staff. They end up getting kicked cause of this even with the ignore permission. Any ideas how to prevent things? can the command spam part be disabled?
    Thanks!
     

Share This Page