IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet

Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 15 Şubat 2008, 21:50   #1
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
m_cmdflood modüLünde tüm ipLer iLe iLgiLi düzenLeme yapıLabiLirmi?




S.a arkadaşLar...
HocaLarımızdan bu konu iLe iLgiLi yardım ve fikir bekLiyorum.

BaşLıktada beLirttiğim gibi; biLindiği üzere bu modüL sunucuda aktif iken, örneğin register komutunu kuLLanan kişi aynı dakika doLmadan yani 30 saniye içerisinde tekrar register komutunu gönderdiğinde kendisine:
-NickServ- Lütfen 30 saniye REGISTER komutunu tekrar kullanmak için bekleyin.
ŞekLinde bir uyarı gidiyor. Bu uyarıyı bütün kuLLanıcıLar için geçerLi kıLabiLirmiyiz mümkünmü? demek istediğim şu: Ahmet iLe Mehmet in ip'Leri biribirinden farkLı, Ahmet nickini şifreLediğinde diğeri aynı süre içerisinde register komutunu gönderdiğinde yine 30 saniye bekLemek zorunda kaLsın. kısacası sunucuda register komutu 30 saniyede yaLnızca bir kez kuLLanıLsın istiyorum.
SaygıLarımLa...

m_cmdflood.c modülü
PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
/*
 * =================================================================
 * Filename:             cmdflood.c
 * Description:          Flood protection for commands.
 * Written by:           AngryWolf <
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
>
 * Requested by:         aaadicted
 * Documentation:        cmdflood.txt (comes with the package)
 * =================================================================
 */
#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.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
typedef struct _floodsetting FloodSetting;
typedef struct _floodinfo FloodInfo;
struct _floodsetting
{
 
FloodSetting *prev, *next;
 
char  *cmd;
 
Cmdoverride *ovr;
 
int  count;
 
int  period;
};
struct _floodinfo
{
 
FloodInfo *prev, *next;
 
aClient  *cptr;
 
char  *cmd;
 
int  count;
 
TS  last;
};
extern void   sendto_one(aClient *tochar *pattern, ...);
extern void   sendto_realops(char *pattern, ...);
extern int   config_parse_flood(char *origint *timesint *period);
#define MSG_CMDFLOOD  "CMDFLOOD"
#define TOK_CMDFLOOD  "CF"
#define ERR_TOOMANYUSES  ":%s 495 %s :%s. Komutunu Cok Fazla Kullandiniz. %d Saniye Bekledikten Sonra Tekrar Deneyiniz.."
#define DelOverride(cmd, ovr) if (ovr && CommandExists(cmd)) CmdoverrideDel(ovr); ovr = NULL
#define DelHook(x)       if (x) HookDel(x); x = NULL
#define DelCommand(x)  if (x) CommandDel(x); x = NULL
#define ircstrdup(x,y)  if (x) MyFree(x); if (!y) x = NULL; else x = strdup(y)
#define ircfree(x)  if (x) MyFree(x); x = NULL
static Command   *AddCommand(Module *modulechar *msgchar *tokeniFP func);
static 
Cmdoverride  *AddOverride(char *msgiFP cb);
static 
int   m_cmdflood(aClient *cptraClient *sptrint parcchar *parv[]);
static 
int   override_cmd(Cmdoverride *, aClient *, aClient *, intchar *[]);
static 
int   cb_config_test(ConfigFile *, ConfigEntry *, intint *);
static 
int   cb_config_run(ConfigFile *, ConfigEntry *, int);
static 
int   cb_config_rehash();
static 
int   cb_quit(aClient *, char *);
static 
FloodSetting  *find_FloodSetting(char *cmd);
static 
FloodInfo  *find_FloodInfo(aClient *cptrchar *cmd);
static 
void   FreeFloodSettings();
static 
void   FreeFloodInfoList();
static 
void   InitConf();
static 
void   FreeConf();
#ifdef HOOKTYPE_REHASH_COMPLETE
static int   cb_rehash_complete();
#else
static    EVENT(LoadOverrides);
#endif
static Command   *CmdCmdflood;
static 
Hook   *HookConfTest, *HookConfRun, *HookConfRehash;
static 
Hook   *HookQuit;
#ifdef STATIC_LINKING
 #ifdef HOOKTYPE_REHASH_COMPLETE
static Hook   *HookRehashDone;
 
#else
static u_int   event_added;
 
#endif
#endif
static FloodSetting  *FloodSettings;
static 
FloodInfo  *FloodInfoList;
#ifndef STATIC_LINKING
static ModuleInfo  *MyModInfo;
 
#define MyMod   MyModInfo->handle
 #define SAVE_MODINFO  MyModInfo = modinfo;
#else
 #define MyMod   NULL
 #define SAVE_MODINFO
#endif
ModuleHeader MOD_HEADER(cmdflood)
  = {
 
"Command Flood Protection",
 
"v.1.1",
 
"WorD.cmflood Install v1.0",
 
"3.2-b8-1",
 
NULL 
    
};
DLLFUNC int MOD_TEST(cmdflood)(ModuleInfo *modinfo)
{
 
SAVE_MODINFO
 HookConfTest 
HookAddEx(modinfo->handleHOOKTYPE_CONFIGTESTcb_config_test);
 return 
MOD_SUCCESS;
}
DLLFUNC int MOD_INIT(cmdflood)(ModuleInfo *modinfo)
{
 
SAVE_MODINFO
 FloodInfoList 
NULL;
#ifndef STATIC_LINKING
 
ModuleSetOptions(modinfo->handleMOD_OPT_PERM);
#endif
 
InitConf();
 
HookConfRun HookAddEx(modinfo->handleHOOKTYPE_CONFIGRUNcb_config_run);
 
HookConfRehash HookAddEx(modinfo->handleHOOKTYPE_REHASHcb_config_rehash);
#if defined(HOOKTYPE_REHASH_COMPLETE) && defined(STATIC_LINKING)
 
HookRehashDone HookAddEx(modinfo->handleHOOKTYPE_REHASH_COMPLETEcb_rehash_complete);
#endif
        
HookQuit HookAddEx(modinfo->handleHOOKTYPE_LOCAL_QUITcb_quit);
 
CmdCmdflood AddCommand(modinfo->handleMSG_CMDFLOODTOK_CMDFLOODm_cmdflood);
 if (!
CmdCmdflood)
  return 
MOD_FAILED;
        return 
MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(cmdflood)(int module_load)
{
#ifdef HOOKTYPE_REHASH_COMPLETE
 
cb_rehash_complete();
#else
 
LoadOverrides(NULL);
#endif
 
return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(cmdflood)(int module_unload)
{
 
FreeConf();
 
FreeFloodInfoList();
#if defined(HOOKTYPE_REHASH_COMPLETE) && defined(STATIC_LINKING)
 
DelHook(HookRehashDone);
#endif
 
DelHook(HookQuit);
 
DelHook(HookConfRehash);
 
DelHook(HookConfRun);
 
DelHook(HookConfTest);
 
DelCommand(CmdCmdflood);
 return 
MOD_SUCCESS;
}
static 
void InitConf()
{
 
FloodSettings NULL;
#if defined(STATIC_LINKING) && !defined(HOOKTYPE_REHASH_COMPLETE)
 
event_added 0;
#endif
}
static 
void FreeConf()
{
 
FreeFloodSettings();
}
#ifdef HOOKTYPE_REHASH_COMPLETE
static int cb_rehash_complete()
#else
static EVENT(LoadOverrides)
#endif
{
 
FloodSetting *f;
 for (
FloodSettingsff->next)
  
f->ovr AddOverride(f->cmdoverride_cmd);
#ifdef HOOKTYPE_REHASH_COMPLETE
 
return 0;
#endif
}
static 
FloodSetting *find_FloodSetting(char *cmd)
{
 
FloodSetting *f;
 for (
FloodSettingsff->next)
  if (!
stricmp(f->cmdcmd))
   break;
 return 
f;
}
static 
FloodInfo *find_FloodInfo(aClient *cptrchar *cmd)
{
 
FloodInfo *f;
 for (
FloodInfoListff->next)
  if (
f->cptr == cptr && !stricmp(f->cmdcmd))
   break;
 return 
f;
}
static 
void FreeFloodSettings()
{
 
FloodSetting *f;
 
ListStruct *next;
 for (
FloodSettingsf= (FloodSetting *) next)
 {
  
next = (ListStruct *) f->next;
  
DelListItem(fFloodSettings);
  
DelOverride(f->cmdf->ovr);
  
MyFree(f->cmd);
  
MyFree(f);
 }
}
static 
void FreeFloodInfoList()
{
 
FloodInfo *f;
 
ListStruct *next;
 for (
FloodInfoListf= (FloodInfo *) next)
 {
  
next = (ListStruct *) f->next;
  
DelListItem(fFloodInfoList);
  
MyFree(f->cmd);
  
MyFree(f);
 }
}
static 
int cb_config_rehash()
{
 
FreeConf();
 
InitConf();
 return 
1;
}
#define CHECK_EMPTY(ce, parent) \
  
if (!(ce)->ce_varname) \
  { \
   
config_error("%s:%i: blank %s item", \
    (
ce)->ce_fileptr->cf_filename, \
    (
ce)->ce_varlinenum, (parent)->ce_varname); \
   
errors++; \
   continue; \
  } \
  if (!(
ce)->ce_vardata) \
  { \
   
config_error("%s:%i: %s::%s without contents", \
    (
ce)->ce_fileptr->cf_filename, \
    (
ce)->ce_varlinenum, \
    (
parent)->ce_varname, (ce)->ce_varname); \
   
errors++; \
   continue; \
  }
static 
int cb_config_test(ConfigFile *cfConfigEntry *ceint typeint *errs)
{
 
ConfigEntry *cep;
 
int  errors 0;
 
int  countperiod;
 if (
type != CONFIG_MAIN)
  return 
0;
 if (!
strcmp(ce->ce_varname"cmdflood"))
 {
  for (
cep ce->ce_entriescepcep cep->ce_next)
  {
   
CHECK_EMPTY(cepce)
   if (!
config_parse_flood(cep->ce_vardata, &count, &period) ||
       (
count 1) || (count 255) || (period 5))
   {
    
config_error("%s:%i: Bad value for cmdflood::%s. Syntax is '<count>:<period>' (ie. 5:60), "
     "count should be in range 1-255, period greater than 4"
,
     
cep->ce_fileptr->cf_filenamecep->ce_varlinenum,
     
cep->ce_varname);
    
errors++;
   }
  }
  *
errs errors;
  return 
errors ? -1;
 }
 return 
0;
}
static 
int cb_config_run(ConfigFile *cfConfigEntry *ceint type)
{
 
ConfigEntry *cep;
 
FloodSetting *f;
 if (
type != CONFIG_MAIN)
  return 
0;
 if (!
strcmp(ce->ce_varname"cmdflood"))
 {
  for (
cep ce->ce_entriescepcep cep->ce_next)
  {
   if (
find_FloodSetting(cep->ce_varname))
    continue;
   
= (FloodSetting *) MyMallocEx(sizeof(FloodSetting));
   
f->cmd strdup(cep->ce_varname);
   
config_parse_flood(cep->ce_vardata, &f->count, &f->period);
   
AddListItem(fFloodSettings);
#if defined(STATIC_LINKING) && !defined(HOOKTYPE_REHASH_COMPLETE)
   
if (!event_added)
   {
    
/* Not the best solution, but it works. */
    
EventAdd("cmdflood_loadoverrides"01,
     
LoadOverridesNULL);
    
event_added 1;
   }
#endif
  
}
  return 
1;  
 }
 return 
0;
}
static 
Cmdoverride *AddOverride(char *msgiFP cb)
{
 
Cmdoverride *ovr CmdoverrideAdd(MyModmsgcb);
#ifndef STATIC_LINKING
        
if (ModuleGetError(MyMod) != MODERR_NOERROR || !ovr)
#else
        
if (!ovr)
#endif
 
{
#ifndef STATIC_LINKING
  
config_error("Error replacing command %s when loading module %s: %s",
   
msgMOD_HEADER(cmdflood).nameModuleGetErrorStr(MyMod));
#else
  
config_error("Error replacing command %s when loading module %s",
   
msgMOD_HEADER(cmdflood).name);
#endif
  
return NULL;
 }
 return 
ovr;
}
static 
Command *AddCommand(Module *modulechar *msgchar *tokeniFP func)
{
 
Command *cmd;
 if (
CommandExists(msg))
     {
  
config_error("Command %s already exists"msg);
  return 
NULL;
     }
     if (
CommandExists(token))
 {
  
config_error("Token %s already exists"token);
  return 
NULL;
     }
 
cmd CommandAdd(modulemsgtokenfuncMAXPARA0);
#ifndef STATIC_LINKING
 
if (ModuleGetError(module) != MODERR_NOERROR || !cmd)
#else
 
if (!cmd)
#endif
 
{
#ifndef STATIC_LINKING
  
config_error("Error adding command %s: %s"msg,
   
ModuleGetErrorStr(module));
#else
  
config_error("Error adding command %s"msg);
#endif
  
return NULL;
 }
 return 
cmd;
}
static 
int cb_quit(aClient *sptrchar *comment)
{
 
FloodInfo *f;
 
ListStruct *next;
 for (
FloodInfoListf= (FloodInfo *) next)
 {
  
next = (ListStruct *) f->next;
  if (
f->cptr == sptr)
  {
   
DelListItem(fFloodInfoList);
   
MyFree(f->cmd);
   
MyFree(f);
  }
 }
 return 
0;
}
static 
int override_cmd(Cmdoverride *ovraClient *cptraClient *sptrint parcchar *parv[])
{
 
FloodInfo *fi;
 
FloodSetting *fs;
 
TS  now  TStime();
 
char  *cmd  ovr->command->cmd;
 if (
IsPerson(sptr) && !IsAnOper(sptr))
 {
  if (!(
fi find_FloodInfo(sptrcmd)))
  {
   
fi  = (FloodInfo *) MyMallocEx(sizeof(FloodInfo));
   
fi->cptr sptr;
   
fi->cmd  strdup(cmd);
   
fi->last now;
   
fi->count 1;
   
AddListItem(fiFloodInfoList);
  }
  else
  {
   
fs find_FloodSetting(cmd);
   if (!
fs)
   {
    
sendto_realops("*** [BUG] %s. Komutu icin Hic Bir Eklenti Yapilmamistir.."
        " Lutfen http://angrywolf.clanintern-irc.de/. Adresine Bildiriniz.."
,
        
cmd);
    return 
CallCmdoverride(ovrcptrsptrparcparv);
   }
   if (
now fi->last >= fs->period)
   {
    
fi->last now;
    
fi->count 1;
   }
   else
   {
    
fi->count++;
    if (
fi->count fs->count && now fi->last fs->period)
    {
     
sendto_one(sptrERR_TOOMANYUSES,
      
me.namesptr->namecmd,
      
fi->last fs->period now);
     return 
0;
    }
   }
  }
 }
 return 
CallCmdoverride(ovrcptrsptrparcparv);
}
static 
int m_cmdflood(aClient *cptraClient *sptrint parcchar *parv[])
{
 
FloodSetting *f;
 if (!
IsPerson(sptr))
  return -
1;
 if (!
MyConnect(sptr) || !IsAnOper(sptr))
 {
  
sendto_one(sptrerr_str(ERR_NOPRIVILEGES), me.nameparv[0]);
  return -
1;
 }
 for (
FloodSettingsff->next)
  
sendto_one(sptr":%s %i %s :x %s: %d per %s",
   
me.nameRPL_TEXTsptr->name,
   
f->cmdf->count,
   
pretty_time_val(f->period));
 
sendto_one(sptrrpl_str(RPL_ENDOFSTATS), me.namesptr->name'x');
 return 
0;



 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları sohbet odaları Benimmekan Mobil Sohbet
Alt 16 Şubat 2008, 21:28   #2
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Cevap: m_cmdflood modüLünde tüm ipLer iLe iLgiLi düzenLeme yapıLabiLirmi?




şimdi bu moduleyı hic kullanmadım ama bu unreal modulunun services işlemi ile ilgisi nedir cozebilmiş degilim

dedigin ozellıge gelince

Alıntı:

# NickRegDelay <seconds> [OPTIONAL]
# Prevents users from regging their nick if they are not
# connected for at least X seconds.
NickRegDelay 30

nickin baglantıdan ne kadar sonra ayıt işlemi yapabilecegını beliryelen satır services.conf ta bulunmakta


Alıntı:
if (!is_oper(u) && NickRegDelay
&& ((time(NULL) - u->my_signon) < NickRegDelay)) {
notice_lang(s_NickServ, u, NICK_REG_DELAY, NickRegDelay);
return MOD_CONT;
}

buda registerdeki tarama suresi baglantı anından nickin kaydına kadar ne kadar sure gececegını ve ne kadar sure kaldıgını gosteren bolum

buradada sadece nick ve baglantı anına gore işlem yapılıyor dedıgın sekılde yapılabilir mi bence hyr

 
Alıntı ile Cevapla

Alt 17 Şubat 2008, 01:32   #3
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Yanıt: m_cmdflood modüLünde tüm ipLer iLe iLgiLi düzenLeme yapıLabiLirmi?




S.a
hocam services işLemi iLe iLgisi;
ikinci oLarak beLirttiğiniz yere tekrar bknz. dedinizki:
''buda registerdeki tarama suresi baglantı anından nickin kaydına kadar ne kadar sure gececegını ve ne kadar sure kaldıgını gosteren bolum''

ve şimdi bu açıkLamanıza istinaden göstermiş oLduğum modüLdeki iLgiLi satırLara bknz. ns_register.c dosyası iLe aynı işLemi yapmaktadır.

FloodSetting *f;
if (!
IsPerson(sptr
))
return -
1
;
if (!
MyConnect(sptr) || !IsAnOper(sptr
))
{
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0
]);
return -
1
;
}
for (
f = FloodSettings; f; f = f->next
)
sendto_one(sptr, ":%s %i %s :x %s: %d per %s"
,
me.name, RPL_TEXT, sptr->name
,
f->cmd, f->count
,

hocam teşekür ederim iLgin için ama;
dediğiniz gibi services.conft ta buLunan iLgiLi satır: sunucuya bağLanırken devamında bağLandıktan sonraki görevine devam edecek oLsaydı bu modüLü yazmazLardı ve bizLerde kuLLanmazdık.
ama fikir edinmek istedim yardımcı oLmak isteyenLerde oLmaya çaLışanLarda sağoLsun.

SaygıLar...

 
Alıntı ile Cevapla

Cevapla

Etiketler
duzenleme, düzenleme, ile, ilgili, ipler, mcmdflood, modulunde, modülünde, m_cmdflood, tum, tüm, yapilabilirmi, yapılabilirmi


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 
Seçenekler
Stil

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Sağlıkçıların ikametiyle ilgili düzenleme System Sağlık Köşesi 0 03 Aralık 2011 18:58
Addonlar Exe yapılabilirmi BARBOROS mIRC Scripting Sorunları 1 23 Şubat 2011 21:07
Adwords Modülünde Büyük Sorun seal Unreal IRCd 13 04 Eylül 2008 06:44
Yapılabilirmi? theson Servisler 3 08 Haziran 2007 10:59
Yapılabilirmi ? ReiS Unreal IRCd 3 26 Nisan 2007 17:37