1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
17 /* $ModDesc: Sends a numeric on connect which cripples a common type of trojan/spambot */
19 class ModuleAntiBear : public Module
23 ModuleAntiBear() : bearExt("antibear_timewait", this)
25 ServerInstance->Extensions.Register(&bearExt);
26 Implementation eventlist[] = { I_OnUserRegister, I_OnPreCommand };
27 ServerInstance->Modules->Attach(eventlist, this, 2);
30 virtual ~ModuleAntiBear()
34 virtual Version GetVersion()
36 return Version("Sends a numeric on connect which cripples a common type of trojan/spambot",VF_VENDOR);
39 virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
41 if (command == "NOTICE" && !validated && parameters.size() > 1 && bearExt.get(user))
43 if (!strncmp(parameters[1].c_str(), "\1TIME Mon May 01 18:54:20 2006", 30))
45 ZLine* zl = new ZLine(ServerInstance->Time(), 86400, ServerInstance->Config->ServerName.c_str(),
46 "Unless you're stuck in a time warp, you appear to be a bear bot!", user->GetIPString());
47 if (ServerInstance->XLines->AddLine(zl,NULL))
49 ServerInstance->XLines->ApplyLines();
58 // Block the command, so the user doesn't receive a no such nick notice
62 return MOD_RES_PASSTHRU;
65 virtual ModResult OnUserRegister(LocalUser* user)
67 user->WriteNumeric(439, "%s :This server has anti-spambot mechanisms enabled.", user->nick.c_str());
68 user->WriteNumeric(931, "%s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick.c_str());
69 user->WriteServ("PRIVMSG %s :\1TIME\1", user->nick.c_str());
71 return MOD_RES_PASSTHRU;
75 MODULE_INIT(ModuleAntiBear)