1
//=============================================================================
3
// File : optw_ctcpfloodprotection.cpp
4
// Creation date : Sun Jan 21 2001 14:35:06 CEST by Szymon Stefanek
6
// This file is part of the KVirc irc client distribution
7
// Copyright (C) 2001-2008 Szymon Stefanek (pragma at kvirc dot net)
9
// This program is FREE software. You can redistribute it and/or
10
// modify it under the terms of the GNU General Public License
11
// as published by the Free Software Foundation; either version 2
12
// of the License, or (at your opinion) any later version.
14
// This program is distributed in the HOPE that it will be USEFUL,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
// See the GNU General Public License for more details.
19
// You should have received a copy of the GNU General Public License
20
// along with this program. If not, write to the Free Software Foundation,
21
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
//=============================================================================
25
#include "optw_ctcpfloodprotection.h"
27
#include "kvi_options.h"
28
#include "kvi_locale.h"
35
@doc: ctcpfloodprotectionoptions
39
CTCP flood protection options
41
Protection against CTCP flooding
45
Here, you can configure the CTCP flood protection system.[br]
46
The CTCP engine in IRC clients may be subject to an attack, called "CTCP flooding".[br]
47
Basically, the attackers (usually there is more than one offending client) sends a stream
48
of CTCP requests to the victim's client, and the client attempts to respond to all requests
49
by sending a stream of replies to the server, which causes the server to disconnect the user
50
due to "excess flood" for sending too many messages before the server can process them.[br]
51
Many user defined scripts choose to completely ignore all the CTCP requests in order to prevent such attacks.[br]
52
KVIrc offers an alternative method that allows you to take advantage of the CTCP protocol
53
and at the same time prevent the flood attacks.[br]
54
The method is really simple: The client will only respond to a limited number of CTCP requests within a
55
specified time interval.[br]
56
The "Use flood protection" option enables this protection method.[br]
57
In the "Allowed up to" field you should enter the maximum number of CTCP requests that KVIrc should
58
respond to within the interval of time defined in the second field.[br]
59
A strong protection against floods would be replying to 4 requests every 20 seconds.[br]
60
The minimum effective setting is about 3 messages every 6 seconds.[br]
61
Please note that 3 messages every 6 seconds is NOT the same as 10 messages every 20 seconds;
62
the first setting would allow 3 requests within one second, but the client would
63
ignore all the requests for the next 5 seconds, the second setting would allow 10 messages within one second
64
and ignore everything for the next 19 seconds. Therefore, 3/6 is a safer setting.[br]
65
The maximum protection you can set is 0 messages within any number of seconds; in that case any
66
CTCP request will be considered a flood and ignored.[br]
68
You can also decide to ignore specific CTCP requests. For example, if you don't want to reply to PING
69
requests, just select "PING" under the "Ignored Requests" section.[br]
71
Some specific protection options can be set also in other CTCP options sections:
72
see the [widget:ctcpavatarprotooptions]CTCP AVATAR protocol options[/widget] and [widget:ctcpdccprotooptions]CTCP DCC protocol options[/widget].[br]
76
KviCtcpFloodProtectionOptionsWidget::KviCtcpFloodProtectionOptionsWidget(QWidget * parent)
77
: KviOptionsWidget(parent)
79
setObjectName("ctcpfloodprotection_options_widget");
83
KviBoolSelector * b = addBoolSelector(0,0,1,0,__tr2qs_ctx("Use flood protection for CTCP requests (recommended)","options"),KviOption_boolUseCtcpFloodProtection);
84
mergeTip(b,__tr2qs_ctx("<center>This option makes KVIrc only respond to a limited number of CTCP requests within a specified time interval, to prevent \"flooding\" CTCP messages.</center>","options"));
86
KviUIntSelector * u = addUIntSelector(0,1,0,1,__tr2qs_ctx("Allow up to:","options"),KviOption_uintMaxCtcpRequests,0,10000,3,KVI_OPTION_BOOL(KviOption_boolUseCtcpFloodProtection));
87
u->setSuffix(__tr2qs_ctx(" requests","options"));
88
mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>0 requests</b><br>Maximum value: <b>10000 requests</b></center>","options"));
89
connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));
91
u = addUIntSelector(1,1,1,1,__tr2qs_ctx("within:","options"),KviOption_uintCtcpFloodCheckInterval,1,3600,6,KVI_OPTION_BOOL(KviOption_boolUseCtcpFloodProtection));
92
u->setSuffix(__tr2qs_ctx(" sec","options"));
93
mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>1 sec</b><br>Maximum value: <b>3600 sec</b></center>","options"));
94
connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));
96
KviTalGroupBox * g = addGroupBox(0,2,1,2,Qt::Horizontal,__tr2qs_ctx("Ignored Ctcp Requests","options"));
97
addBoolSelector(g,__tr2qs_ctx("PING","options"),KviOption_boolIgnoreCtcpPing);
98
addBoolSelector(g,__tr2qs_ctx("FINGER","options"),KviOption_boolIgnoreCtcpFinger);
99
addBoolSelector(g,__tr2qs_ctx("CLIENTINFO","options"),KviOption_boolIgnoreCtcpClientinfo);
100
addBoolSelector(g,__tr2qs_ctx("USERINFO","options"),KviOption_boolIgnoreCtcpUserinfo);
101
addBoolSelector(g,__tr2qs_ctx("VERSION","options"),KviOption_boolIgnoreCtcpVersion);
102
addBoolSelector(g,__tr2qs_ctx("SOURCE","options"),KviOption_boolIgnoreCtcpSource);
103
addBoolSelector(g,__tr2qs_ctx("TIME","options"),KviOption_boolIgnoreCtcpTime);
104
addBoolSelector(g,__tr2qs_ctx("PAGE","options"),KviOption_boolIgnoreCtcpPage);
105
addBoolSelector(g,__tr2qs_ctx("AVATAR","options"),KviOption_boolIgnoreCtcpAvatar);
106
addBoolSelector(g,__tr2qs_ctx("DCC/TDCC","options"),KviOption_boolIgnoreCtcpDcc);
108
addRowSpacer(0,3,1,3);
111
KviCtcpFloodProtectionOptionsWidget::~KviCtcpFloodProtectionOptionsWidget()
116
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
117
#include "m_optw_ctcpfloodprotection.moc"
118
#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES