1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/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
24 ModuleAntiBear(InspIRCd* Me) : Module(Me)
27 Implementation eventlist[] = { I_OnUserRegister, I_OnPreCommand };
28 ServerInstance->Modules->Attach(eventlist, this, 2);
31 virtual ~ModuleAntiBear()
35 virtual Version GetVersion()
37 return Version("$Id$",VF_VENDOR,API_VERSION);
40 virtual int OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
42 if (command == "NOTICE" && !validated && parameters.size() > 1 && user->GetExt("antibear_timewait"))
44 if (!strncmp(parameters[1].c_str(), "\1TIME Mon May 01 18:54:20 2006", 30))
46 ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), 86400, ServerInstance->Config->ServerName,
47 "Unless you're stuck in a time warp, you appear to be a bear bot!", user->GetIPString());
48 if (ServerInstance->XLines->AddLine(zl,NULL))
50 ServerInstance->XLines->ApplyLines();
58 user->Shrink("antibear_timewait");
59 // Block the command, so the user doesn't receive a no such nick notice
66 virtual int OnUserRegister(User* user)
68 user->WriteNumeric(439, "%s :This server has anti-spambot mechanisms enabled.", user->nick.c_str());
69 user->WriteNumeric(931, "%s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick.c_str());
70 user->WriteServ("PRIVMSG %s :\1TIME\1", user->nick.c_str());
71 user->Extend("antibear_timewait");
76 MODULE_INIT(ModuleAntiBear)