Merhaba,
Elimde bir joindelay modülü var, girişte kanallara girmeden önce bekletiyor falan tamam ama saldırı esnasında raw join olarak giren botlara karşı nedense hükmü geçmiyor. Bunun çözümü var mı? Başka bir şeyi mi düzenlemek gerek, işin içinden çıkamadım. Modül aşağıda, unreal sürümüm 3.2.10.4
Kod: Kodu kopyalamak için üzerine çift tıklayın!
/*
*********************************************************************
*
**
*** Released from : C-IRC Modules
**** Description : Delays the joining process till the given time is up
**** Written by : srcmaster <srcmaster@
*** Web page :
**
*
** Changes:
*
** 1.0
* - Initial release
** 1.1
* - Fixed potential crashes on join and quit
* - [REQUEST] Nick changes are not permitted anymore (while users in delay)
*
*
** Configuration line: set { join-delay 5s; };
*
*********************************************************************
*/
/*
**********************************************************************
*** Modülü son düzenleyen: Entrance
*** (IP, NICK, IDENT vb düzenlemeler yapıldı.)
***********************************************************************
*/
#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "proto.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#ifdef STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif
#define J(x) auser[x->slot]
typedef struct _JEvent {
Event *event;
} JEvent;
static JEvent *auser[4096];
static Hook *JH, *PCH, *PCX, *QH = NULL;
ModuleInfo joindelay;
DLLFUNC int joindelay_ct(ConfigFile *, ConfigEntry *, int, int *);
DLLFUNC int joindelay_cr(ConfigFile *, ConfigEntry *, int);
DLLFUNC int joindelay_cpt(int *);
DLLFUNC int nickreover();
DLLFUNC int nickover(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, char *parv[]);
static int ptime = 0;
static int pre_connect_h(aClient *);
static int connect_h(aClient *);
static int quit_h(aClient *, char *);
static int join_h(aClient *, aChannel *, char *[]);
static void join_stuff(aClient *);
ModuleHeader MOD_HEADER(joindelay) = {
"joindelay",
"$Id: m_joindelay.c,v 1.1 2011/03/17 00:42:25 srcmaster Exp $",
"Adds a delay to the join command by srcmaster",
"3.2-b8-1",
NULL
};
ModuleInfo joindelay;
DLLFUNC int MOD_TEST(joindelay)(ModuleInfo *module)
{
bcopy(module, &joindelay, module->size);
HookAddEx(joindelay.handle, HOOKTYPE_CONFIGTEST, joindelay_ct);
HookAddEx(joindelay.handle, HOOKTYPE_CONFIGPOSTTEST, joindelay_cpt);
return MOD_SUCCESS;
}
DLLFUNC int MOD_INIT(joindelay)(ModuleInfo *module)
{
ModuleSetOptions(joindelay.handle, MOD_OPT_PERM);
JH = HookAddEx(joindelay.handle, HOOKTYPE_PRE_LOCAL_JOIN, join_h);
PCH = HookAddEx(joindelay.handle, HOOKTYPE_PRE_LOCAL_CONNECT, pre_connect_h);
PCX = HookAddEx(joindelay.handle, HOOKTYPE_LOCAL_CONNECT, connect_h);
QH = HookAddEx(joindelay.handle, HOOKTYPE_LOCAL_QUIT, quit_h);
HookAddEx(joindelay.handle, HOOKTYPE_CONFIGRUN, joindelay_cr);
HookAddEx(joindelay.handle, HOOKTYPE_REHASH_COMPLETE, nickreover);
if (!JH || !PCH || !QH || !PCX)
return MOD_FAILED;
return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(joindelay)(int module_load)
{
CmdoverrideAdd(joindelay.handle, "NICK", nickover);
return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(joindelay)(int module_unload)
{
HookDel(JH);
HookDel(PCH);
HookDel(PCX);
HookDel(QH);
return MOD_SUCCESS;
}
DLLFUNC int nickreover()
{
CmdoverrideAdd(joindelay.handle, "NICK", nickover);
return 1;
}
DLLFUNC int joindelay_ct(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
int errors = 0;
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "join-delay"))
{
if (!ce->ce_vardata)
{
config_error("Make sure you have the join-delay set!");
errors++;
}
ptime = 1; // i know, i know...
*errs = errors;
return errors ? -1 : 1;
}
else return 0;
}
DLLFUNC int joindelay_cr(ConfigFile *cf, ConfigEntry *ce, int type)
{
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "join-delay"))
{
ptime = config_checkval(ce->ce_vardata, CFG_TIME);
return 1;
}
else return 0;
}
DLLFUNC int joindelay_cpt(int *errs)
{
int errors = 0;
if (!ptime)
{
config_error("Make sure you have the join-delay set!");
errors++;
}
*errs = errors;
return errors ? -1 : 1;
}
static int join_h(aClient *cptr, aChannel *chptr, char *parv[])
{
if (J(cptr) && !IsAnOper(cptr) && cptr->listener->port != 7088 && cptr->listener->port != 7089)
{
if ((TStime() - cptr->firsttime) < ptime)
{
//sendto_one(cptr, ":%s NOTICE %s :** /JOIN komutunu kullanabilmeniz için yeteri kadar bagli olmadiginiz görüldü.", me.name, cptr->name);/*/
sendto_one(cptr, ":%s NOTICE %s :1*** Kanallara giris yapabilmek icin en az %d saniye daha beklemelisiniz.", me.name, cptr->name, ptime - (TStime() - cptr->firsttime));
return HOOK_DENY;
}
}
return HOOK_CONTINUE;
}
static void join_stuff(aClient *cptr)
{
if (IsAnOper(cptr))
return;
if (!BadPtr(AUTO_JOIN_CHANS) && strcmp(AUTO_JOIN_CHANS, "0") && cptr->listener->port != 7013 && cptr->listener->port != 7014)
{
char *chans[3] = {
cptr->name,
AUTO_JOIN_CHANS,
NULL
};
do_cmd(cptr, cptr, "JOIN", 3, chans);
}
}
static int pre_connect_h(aClient *cptr)
{
if (MyConnect(cptr))
{
J(cptr) = MyMallocEx(sizeof(JEvent));
J(cptr)->event = EventAddEx(joindelay.handle, "join-stuff", ptime, 1, join_stuff, cptr);
}
return HOOK_CONTINUE;
}
static int connect_h(aClient *cptr)
{
if (MyConnect(cptr)) {
sendto_one(cptr, ":%s NOTICE %s :1*** NICK (%s), IDENT (%s), IP (%s) bağlantı bilgileriniz ile TOR ve PROXY taramalarından geçiriliyorsunuz.", me.name, cptr->name, cptr->name, cptr->user->username, cptr->user->realhost);
sendto_one(cptr, ":%s NOTICE %s :1*** Sistem Üzerinde1 herhangi bir ihlal 1gözükmediği taktirde,1 ( %d ) saniye sonra kanallara otomatik olarak aktarılacaksınız..", me.name, cptr->name, ptime - (TStime() - cptr->firsttime));
}
return HOOK_CONTINUE;
}
static int quit_h(aClient *cptr, char *comment)
{
if (MyConnect(cptr))
{
if (J(cptr))
{
EventDel(J(cptr)->event);
memset(J(cptr), 0, sizeof(JEvent));
MyFree(J(cptr));
J(cptr) = NULL;
}
}
return 0;
}
DLLFUNC int nickover(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, char *parv[])
{
if (MyConnect(sptr))
{
if (J(cptr) && !IsAnOper(cptr) && (TStime() - cptr->firsttime) < ptime)
return 0;
}
if (ovr->prev)
return ovr->prev->func(ovr->prev, cptr, sptr, parc, parv);
else
return ovr->command->func(cptr, sptr, parc, parv);
}
Elimde bir joindelay modülü var, girişte kanallara girmeden önce bekletiyor falan tamam ama saldırı esnasında raw join olarak giren botlara karşı nedense hükmü geçmiyor. Bunun çözümü var mı? Başka bir şeyi mi düzenlemek gerek, işin içinden çıkamadım. Modül aşağıda, unreal sürümüm 3.2.10.4
Kod: Kodu kopyalamak için üzerine çift tıklayın!
/*
*********************************************************************
*
**
*** Released from : C-IRC Modules
**** Description : Delays the joining process till the given time is up
**** Written by : srcmaster <srcmaster@
Ziyaretçiler için gizlenmiş link,görmek için
Giriş yap veya üye ol.
.org>*** Web page :
Ziyaretçiler için gizlenmiş link,görmek için
Giriş yap veya üye ol.
**
*
** Changes:
*
** 1.0
* - Initial release
** 1.1
* - Fixed potential crashes on join and quit
* - [REQUEST] Nick changes are not permitted anymore (while users in delay)
*
*
** Configuration line: set { join-delay 5s; };
*
*********************************************************************
*/
/*
**********************************************************************
*** Modülü son düzenleyen: Entrance
*** (IP, NICK, IDENT vb düzenlemeler yapıldı.)
***********************************************************************
*/
#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "proto.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#ifdef STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif
#define J(x) auser[x->slot]
typedef struct _JEvent {
Event *event;
} JEvent;
static JEvent *auser[4096];
static Hook *JH, *PCH, *PCX, *QH = NULL;
ModuleInfo joindelay;
DLLFUNC int joindelay_ct(ConfigFile *, ConfigEntry *, int, int *);
DLLFUNC int joindelay_cr(ConfigFile *, ConfigEntry *, int);
DLLFUNC int joindelay_cpt(int *);
DLLFUNC int nickreover();
DLLFUNC int nickover(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, char *parv[]);
static int ptime = 0;
static int pre_connect_h(aClient *);
static int connect_h(aClient *);
static int quit_h(aClient *, char *);
static int join_h(aClient *, aChannel *, char *[]);
static void join_stuff(aClient *);
ModuleHeader MOD_HEADER(joindelay) = {
"joindelay",
"$Id: m_joindelay.c,v 1.1 2011/03/17 00:42:25 srcmaster Exp $",
"Adds a delay to the join command by srcmaster",
"3.2-b8-1",
NULL
};
ModuleInfo joindelay;
DLLFUNC int MOD_TEST(joindelay)(ModuleInfo *module)
{
bcopy(module, &joindelay, module->size);
HookAddEx(joindelay.handle, HOOKTYPE_CONFIGTEST, joindelay_ct);
HookAddEx(joindelay.handle, HOOKTYPE_CONFIGPOSTTEST, joindelay_cpt);
return MOD_SUCCESS;
}
DLLFUNC int MOD_INIT(joindelay)(ModuleInfo *module)
{
ModuleSetOptions(joindelay.handle, MOD_OPT_PERM);
JH = HookAddEx(joindelay.handle, HOOKTYPE_PRE_LOCAL_JOIN, join_h);
PCH = HookAddEx(joindelay.handle, HOOKTYPE_PRE_LOCAL_CONNECT, pre_connect_h);
PCX = HookAddEx(joindelay.handle, HOOKTYPE_LOCAL_CONNECT, connect_h);
QH = HookAddEx(joindelay.handle, HOOKTYPE_LOCAL_QUIT, quit_h);
HookAddEx(joindelay.handle, HOOKTYPE_CONFIGRUN, joindelay_cr);
HookAddEx(joindelay.handle, HOOKTYPE_REHASH_COMPLETE, nickreover);
if (!JH || !PCH || !QH || !PCX)
return MOD_FAILED;
return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(joindelay)(int module_load)
{
CmdoverrideAdd(joindelay.handle, "NICK", nickover);
return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(joindelay)(int module_unload)
{
HookDel(JH);
HookDel(PCH);
HookDel(PCX);
HookDel(QH);
return MOD_SUCCESS;
}
DLLFUNC int nickreover()
{
CmdoverrideAdd(joindelay.handle, "NICK", nickover);
return 1;
}
DLLFUNC int joindelay_ct(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
int errors = 0;
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "join-delay"))
{
if (!ce->ce_vardata)
{
config_error("Make sure you have the join-delay set!");
errors++;
}
ptime = 1; // i know, i know...
*errs = errors;
return errors ? -1 : 1;
}
else return 0;
}
DLLFUNC int joindelay_cr(ConfigFile *cf, ConfigEntry *ce, int type)
{
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "join-delay"))
{
ptime = config_checkval(ce->ce_vardata, CFG_TIME);
return 1;
}
else return 0;
}
DLLFUNC int joindelay_cpt(int *errs)
{
int errors = 0;
if (!ptime)
{
config_error("Make sure you have the join-delay set!");
errors++;
}
*errs = errors;
return errors ? -1 : 1;
}
static int join_h(aClient *cptr, aChannel *chptr, char *parv[])
{
if (J(cptr) && !IsAnOper(cptr) && cptr->listener->port != 7088 && cptr->listener->port != 7089)
{
if ((TStime() - cptr->firsttime) < ptime)
{
//sendto_one(cptr, ":%s NOTICE %s :** /JOIN komutunu kullanabilmeniz için yeteri kadar bagli olmadiginiz görüldü.", me.name, cptr->name);/*/
sendto_one(cptr, ":%s NOTICE %s :1*** Kanallara giris yapabilmek icin en az %d saniye daha beklemelisiniz.", me.name, cptr->name, ptime - (TStime() - cptr->firsttime));
return HOOK_DENY;
}
}
return HOOK_CONTINUE;
}
static void join_stuff(aClient *cptr)
{
if (IsAnOper(cptr))
return;
if (!BadPtr(AUTO_JOIN_CHANS) && strcmp(AUTO_JOIN_CHANS, "0") && cptr->listener->port != 7013 && cptr->listener->port != 7014)
{
char *chans[3] = {
cptr->name,
AUTO_JOIN_CHANS,
NULL
};
do_cmd(cptr, cptr, "JOIN", 3, chans);
}
}
static int pre_connect_h(aClient *cptr)
{
if (MyConnect(cptr))
{
J(cptr) = MyMallocEx(sizeof(JEvent));
J(cptr)->event = EventAddEx(joindelay.handle, "join-stuff", ptime, 1, join_stuff, cptr);
}
return HOOK_CONTINUE;
}
static int connect_h(aClient *cptr)
{
if (MyConnect(cptr)) {
sendto_one(cptr, ":%s NOTICE %s :1*** NICK (%s), IDENT (%s), IP (%s) bağlantı bilgileriniz ile TOR ve PROXY taramalarından geçiriliyorsunuz.", me.name, cptr->name, cptr->name, cptr->user->username, cptr->user->realhost);
sendto_one(cptr, ":%s NOTICE %s :1*** Sistem Üzerinde1 herhangi bir ihlal 1gözükmediği taktirde,1 ( %d ) saniye sonra kanallara otomatik olarak aktarılacaksınız..", me.name, cptr->name, ptime - (TStime() - cptr->firsttime));
}
return HOOK_CONTINUE;
}
static int quit_h(aClient *cptr, char *comment)
{
if (MyConnect(cptr))
{
if (J(cptr))
{
EventDel(J(cptr)->event);
memset(J(cptr), 0, sizeof(JEvent));
MyFree(J(cptr));
J(cptr) = NULL;
}
}
return 0;
}
DLLFUNC int nickover(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, char *parv[])
{
if (MyConnect(sptr))
{
if (J(cptr) && !IsAnOper(cptr) && (TStime() - cptr->firsttime) < ptime)
return 0;
}
if (ovr->prev)
return ovr->prev->func(ovr->prev, cptr, sptr, parc, parv);
else
return ovr->command->func(cptr, sptr, parc, parv);
}