forked from atheme/atheme-contrib-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos_pingspam.c
156 lines (132 loc) · 3.65 KB
/
os_pingspam.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
* Copyright (c) 2005 William Pitcock, et al.
* Rights to this code are as documented in doc/LICENSE.
*
* ping spammer thingy
*
*/
#include "atheme-compat.h"
DECLARE_MODULE_V1
(
"contrib/os_pingspam", false, _modinit, _moddeinit,
PACKAGE_STRING,
VENDOR_STRING
);
char *notices[] =
{
"Scanning for proxies.",
"Killing off bottlers.",
"LOL ok so like we are teh SKANZ0RZING j00 becuz well like OMG deze bots r h3r3 an liek they are FL00DING!!#@! ignore plz",
"gaben",
"Please ignore this notice.",
"Scanning for warez.",
"All your pr0n are belong to us!",
"Move over! This is the police!",
"This notice brought to you by Burma-Shave.",
"They're coming...",
":)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(::)(:",
"lolz!",
"<Hikaru> your a pagan",
"* Ads needs to shower soon",
"<Hik`Coding> Don't make me get Yakuza on you",
"beu fails it",
"BAN KAI~!$"
};
char *phrases[] =
{
"",
" please-ignore",
" proxy scan",
" ignore me",
" <3 neostats",
};
void pingspam(user_t *u);
static void user_add_hook(hook_user_nick_t *data);
static void os_cmd_pingspam(sourceinfo_t *si, int parc, char *parv[]);
static void os_cmd_autopingspam(sourceinfo_t *si, int parc, char *parv[]);
command_t os_pingspam = { "PINGSPAM", "Spam a user with pings from every service, plus some bonus notices.", PRIV_OMODE, 1, os_cmd_pingspam, { .path = "contrib/pingspam" } };
command_t os_autopingspam = { "AUTOPINGSPAM", "Spam connecting users with pings from every service, plus some bonus notices (setting).", PRIV_ADMIN, 1, os_cmd_autopingspam, { .path = "contrib/autopingspam" } };
int spamming;
void _modinit(module_t *m)
{
spamming = 0;
service_named_bind_command("operserv", &os_pingspam);
service_named_bind_command("operserv", &os_autopingspam);
hook_add_event("user_add");
hook_add_user_add(user_add_hook);
}
void _moddeinit(module_unload_intent_t intent)
{
service_named_unbind_command("operserv", &os_pingspam);
service_named_unbind_command("operserv", &os_autopingspam);
hook_del_user_add(user_add_hook);
}
static void user_add_hook(hook_user_nick_t *data)
{
user_t *u;
u = data->u;
if (u == NULL)
return;
if (is_internal_client(u))
return;
if (spamming)
pingspam(u);
}
static void os_cmd_pingspam(sourceinfo_t *si, int parc, char *parv[])
{
char *target = parv[0];
user_t *u;
if(!target)
{
command_fail(si, fault_badparams, "Usage: \2PINGSPAM\2 <target>");
return;
}
if(!(u = user_find_named(target)))
{
command_fail(si, fault_nosuch_target, "\2%s\2 is not on the network", target);
return;
}
pingspam(u);
command_success_nodata(si, "\2%s\2 has been pwned.", target);
logcommand(si, CMDLOG_ADMIN, "PINGSPAM: \2%s\2", target);
}
static void os_cmd_autopingspam(sourceinfo_t *si, int parc, char *parv[])
{
char *mode = parv[0];
if(!mode)
{
command_success_nodata(si, "Auto-pingspam is currently \2%s\2", spamming ? "ON" : "OFF");
return;
}
if(strcasecmp(mode, "on") == 0 || atoi(mode))
{
spamming = 1;
command_success_nodata(si, "Auto-pingspam is now \2ON\2");
}else{
spamming = 0;
command_success_nodata(si, "Auto-pingspam is now \2OFF\2");
}
}
void pingspam(user_t *u)
{
user_t *sptr;
mowgli_node_t *n;
int i;
service_t *svs;
if((svs = service_find("global")) != NULL)
for(i = 0;i < 6;i++)
notice(svs->me->nick, u->nick, "%s", notices[rand() % sizeof(notices) / sizeof(char*)]);
MOWGLI_ITER_FOREACH(n, me.me->userlist.head)
{
sptr = n->data;
msg(sptr->nick, u->nick, "\001PING %ld%s\001",
time(NULL),
phrases[rand() % sizeof(phrases) / sizeof(char*)]
);
}
}
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
* vim:ts=8
* vim:sw=8
* vim:noexpandtab
*/