ModuL KuruLumu Hakkinda Bilgiyi Emegine SagLik eXeLaNCe Arkasimin Anlattigi SekiLde[Üye olmadan linki göremezsiniz.. Üye olmak için tıklayınız...] KurabiLirsiniz..
Vermis oLdugum moduLLeri kopyaLarak Bir Text Dosyasi icine yapistirin daha sonra modul ismi.c olarak kaydedin sonrasini kuruLum Simdiden BasariLar..
Antirandom ModuLu iLe basLamak istiyorum. Bu moduL sayesinde Serverinize Karisik NickLerLe Kullanici ki bunLar geneLde saLdiri amacLi kuLLaniLan CloneLar oLuor bunLarin girmesini engelleyebilirsiniz..
YapiLabiLecek DegisikLikLer..
Kod:
#define ANTIRANDOM_THRESHOLD 5 Nick Karakter UzunLugunu Burdan Secebilirsiniz..
Kod:
#define ANTIRANDOM_BANACT BAN_ACT_KILL Buda Ceza Turu GecerLis Secim Kill istege bagLi oLarak satirin uzerindeki ceza turLerinden birisi seciLebiLir..
Kod:
#define ANTIRANDOM_REASON "Your nick/userinfo seems too random, please fill in proper info" Buda UzakLastirma Sebebimiz..
Kod:
#define ANTIRANDOM_BANTIME 14400 bu da Kalici CezaLarda Ne Kadar Sure iLe UzakLastiriLicagi..
PHP- Kodu:
/*
* IRC - Internet Relay Chat, antirandom.c
* (C) Copyright 2004-2005, Bram Matthys (Syzop) <syzop@vulnscan.org>
*
* Contains ideas from Keith Dunnett <keith@dunnett.org>
* Most of the detection mechanisms come from SpamAssassin FVGT_Tripwire.
*
* $Id: antirandom.c,v 1.9 2005/01/06 16:14:24 syzop Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* ANTIRANDOM_THRESHOLD: Score to exceed before user gets banned,
* the ideal value is unknown... just don't set it lower than 2 ;).
*/
#define ANTIRANDOM_THRESHOLD 5
/* ANTIRANDOM_BANACT: what action should be performed if the user exceeds the threshold?
* BAN_ACT_KILL = kill
* BAN_ACT_GLINE = gline
* BAN_ACT_GZLINE = gzline
* BAN_ACT_KLINE = kline
* BAN_ACT_ZLINE = zline
* BAN_ACT_SHUN = shun
* BAN_ACT_TEMPSHUN = temporary shun for this session
*/
#define ANTIRANDOM_BANACT BAN_ACT_KILL
/* The reason field for kill/..line/shun, probably wise to fill in
* an email address that innocent/n00b users can use contact you.
*/
#define ANTIRANDOM_REASON "Your nick/userinfo seems too random, please fill in proper info"
/* Duration of the ban in seconds (does not apply to kills of course)
* Quick hints:
* 1 hour 3600
* 4 hours 14400
* 6 hours 21600
* 1 day 86400
* 4 days 345600
* (much more is usually not recomended due to dynamic ips)
*/
#define ANTIRANDOM_BANTIME 14400
/* FULLSTATUS_ON_LOAD: if defined, then upon loading it will give a report
* on all currently connected users that exceed their threshold.. Useful
* for first-time loading/testing, otherwise it just won't output much
* (since they would have been killed anyway), but useful to have :).
* NOTE: any currently connected users won't be killed/banned.. this is
* ONLY informative.
*/
#define FULLSTATUS_ON_LOAD
/* Enable the next one to get notifications of any matches on-connect.
* Obviously this can get really noisy! I chose however to enable it
* on by default due to my paranoiaism ;).
* change 'define' to 'undef' to disable it.
*/
#define SHOW_FAILEDCONNECTS
/**************** End of configurable items **************/
/* You can change this 'undef' into 'define' if you want to see quite
* a flood for every user that connects (and on-load if FULLSTATUS_ON_LOAD).
* Obviously only recommended for testing, use with care!
*/
#undef DEBUGMODE
typedef struct {
char *regex;
int score;
} ScoreTable;
/* You can define regexes here.. the format is:
* {"<REGEX>", SCORE},
*/
ScoreTable regex_scores***91;***93; = {
/* (note.. these ones come from the original and are
* not very efficient, but they work fine and I'm lazy)
*/
{"***91;bcdfghjklmnpqrstvwxyz***93;{10}", 10},
{"***91;aeiou***93;{10}", 10},
{"***91;0-9***93;{10}", 10},
{"***91;bcdfghjklmnpqrstvwxyz***93;{9}", 9},
{"***91;aeiou***93;{9}", 9},
{"***91;0-9***93;{9}", 9},
{"***91;bcdfghjklmnpqrstvwxyz***93;{8}", 8},
{"***91;aeiou***93;{8}", 8},
{"***91;0-9***93;{8}", 8},
{"***91;bcdfghjklmnpqrstvwxyz***93;{7}", 7},
{"***91;aeiou***93;{7}", 7},
{"***91;bcdfghjklmnpqrstvwxyz***93;{6}", 6},
{"***91;aeiou***93;{6}", 6},
{"***91;bcdfghjklmnpqrstvwxyz***93;{5}", 5},
{"***91;aeiou***93;{5}", 5},
{"***91;bcdfghjklmnpqrstvwxyz***93;{4}", 4},
{"***91;aeiou***93;{4}", 4},
{NULL, 0}
};
DLLFUNC int MOD_UNLOAD(antirandom)(int module_unload)
{
free_stuff();
return MOD_SUCCESS;
}
int init_stuff(void)
{
if (!init_sregexes() || !init_triples())
return 0;
return 1;
}
/** Initializes the sregexes regex list */
int init_sregexes()
{
ScoreTable *s = ®ex_scores***91;0***93;;
RegexList *e, *last=NULL;
int cnt=0, n;
char *res;
for (s=®ex_scores***91;0***93;; s->regex; s++)
{
cnt++;
e = MyMallocEx(sizeof(RegexList));
/* validate regex */
res = unreal_checkregex(s->regex, 0, 1);
if (res)
{
config_error("init_sregexes: sregexes_txt contains invalid regex (nr %d): %s",
cnt, res);
return 0;
}
/* parse regex here (should go fine, checked above) */
n = regcomp(&e->regex, s->regex, REG_ICASE|REG_EXTENDED);
if (n)
{
/* should never happen (yes I'm too lazy to get the errormsg) */
config_error("init_sregexes: weird regcomp() failure: item=%d, errorcode=%d, aborting...",
cnt, n);
return 0;
}
#ifdef DEBUGMODE
e->regextxt = strdup(s->regex);
#endif
/* Append at end of list (to keep it in order, not importent yet, but..) */
if (last)
last->next = e;
else
sregexes = e; /*(head)*/
last = e;
}
return 1;
}
/** Initializes the triples list. */
int init_triples()
{
char **s;
Triples *e, *last=NULL;
int cnt=0;
/* Append at end of list (to keep it in order, not importent yet, but..) */
if (last)
last->next = e;
else
triples = e; /*(head)*/
last = e;
}
return 1;
}
/** Run the actual tests over this string.
* There are 3 tests:
* - weird chars (not used)
* - sregexes (easy stuff)
* - triples (three-letter combinations)
*/
static int internal_getscore(char *str)
{
RegexList *r;
Triples *t;
register char *s;
int score = 0;
for (r=sregexes; r; r=r->next)
{
if (!regexec(&r->regex, str, 0, NULL, 0))
{
score += 1; /* note: in the draft this returns the # of occurances, not 1 */
#ifdef DEBUGMODE
sendto_realops("score@'%s': MATCH for '%s'", str, r->regextxt);
#endif
}
}
for (t=triples; t; t=t->next)
{
for (s=str; *s; s++)
if ((t->two***91;0***93; == s***91;0***93;) && (t->two***91;1***93; == s***91;1***93;) && s***91;2***93; && strchr(t->rest, s***91;2***93;))
{
score++; /* OK */
#ifdef DEBUGMODE
sendto_realops("score@'%s': MATCH for '%s***91;%s***93;' %c/%c/%c", str, t->two, t->rest,
s***91;0***93;, s***91;1***93;, s***91;2***93;);
#endif
}
}
return score;
}
/** Returns "spam score".
* @note a user is expected, do not call for anything else (eg: servers)
*/
static int get_spam_score(aClient *sptr)
{
char *nick = sptr->name;
char *user = sptr->user->username;
char *gecos = sptr->info;
int nscore, uscore, gscore, score;
Bu Modulun Amaci komut flood'u engeLLemek. Biraz Hayal gucu iLe Cok super Bir moduL..
Modul Uzerinde oynama yapiLmasina gerek yok sadece moduL kuruLduktan sonra unrealircd.conf' bir kac satir ekLemeniz herseyi daha mukemmel yapacak.
Kod:
cmdflood
{
module 2:10s;
list 3:1m;
whois 3:20;
};
bu ornek bir satir. Bunu Su SekiLde AcabiLiriz.
module = Kullanilan Komut.
10s kismi kac saniyede 2 kismida kac kez kullanilacagi anLamina geLior. Yani Ornekte module komutunu 10 saniyede 2 kez kullandigi zaman 3'uncu seferde bekLemeye aLinacagi anLamina geLmektedir.
Sure ibareLeri
Kod:
s: Second Yani Saniye
m: Minute Yani Dakika
h: Hour Yani Saat.
PHP- Kodu:
/*
* =================================================================
* Filename: cmdflood.c
* Description: Flood protection for commands.
* Written by: AngryWolf <angrywolf@flashmail.com>
* Requested by: aaadicted
* Documentation: cmdflood.txt (comes with the package)
* =================================================================
*/
extern void sendto_one(aClient *to, char *pattern, ...);
extern void sendto_realops(char *pattern, ...);
extern int config_parse_flood(char *orig, int *times, int *period);
#define MSG_CMDFLOOD "CMDFLOOD"
#define TOK_CMDFLOOD "CF"
#define ERR_TOOMANYUSES ":%s 495 %s :%s Komutu Cok Fazla Kullanildi. %d Dakika 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 int cb_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
ConfigEntry *cep;
int errors = 0;
int count, period;
if (type != CONFIG_MAIN)
return 0;
if (!strcmp(ce->ce_varname, "cmdflood"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
{
CHECK_EMPTY(cep, ce)
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_filename, cep->ce_varlinenum,
cep->ce_varname);
errors++;
}
}
*errs = errors;
return errors ? -1 : 1;
}
return 0;
}
static int cb_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
{
ConfigEntry *cep;
FloodSetting *f;
if (type != CONFIG_MAIN)
return 0;
if (!strcmp(ce->ce_varname, "cmdflood"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
{
if (find_FloodSetting(cep->ce_varname))
continue;
#if defined(STATIC_LINKING) && !defined(HOOKTYPE_REHASH_COMPLETE)
if (!event_added)
{
/* Not the best solution, but it works. */
EventAdd("cmdflood_loadoverrides", 0, 1,
LoadOverrides, NULL);
event_added = 1;
}
#endif
}
Siradaki Module Hideserver Modulu.
Bu ModuL iLe ister /map ister /links isterseniz her ikisinide yasaklayabilirsiniz..
Sadece unrealircd.conf'a
Kod:
hideserver
{
disable-map no;
disable-links no;
map-deny-message "*** /Map Komutu GuvenLik Nedeni ile YasakLanmistir.";
links-deny-message "*** /Links Komutu GuvenLik Nedeni iLe YasakLanmistir.";
hide
{
hub4.test.com;
leaf3.test.com;
};
};
Bu SatirLari Kendimize Gore DuzenLeyip Ekliyoruz..
Degiskenler
Kod:
disable-map no;
disable-links no;
Map ve Links'i yasakLamak icin no yazan yerLere yes yazmamiz yeterlidir..
PHP- Kodu:
/*
* =================================================================
* Filename: hideserver.c
* Description: Hide certain or all servers from /map & /links.
* Written by: AngryWolf <angrywolf@flashmail.com>
* Documentation: hideserver.txt (comes with the package)
* =================================================================
*/
#define DelOverride(cmd, ovr) if (ovr && CommandExists(cmd)) CmdoverrideDel(ovr); ovr = NULL
#define DelHook(x) if (x) HookDel(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
Cmdoverride *AddOverride(char *msg, iFP cb);
static int override_map(Cmdoverride *, aClient *, aClient *, int, char ****91;***93;);
static int override_links(Cmdoverride *, aClient *, aClient *, int, char ****91;***93;);
static int cb_test(ConfigFile *, ConfigEntry *, int, int *);
static int cb_conf(ConfigFile *, ConfigEntry *, int);
static int cb_rehash();
/* static int cb_stats(aClient *sptr, char *stats); */
Bu Modul Kanallarimiza "P" modunu ekLior.
Kullanimi
Kod:
/mode #Kanal +P X
X Yerine Kullanilabilecek Degerler
Kod:
N - A - a - C - o
Peki Bu Ne ise yariyor diyen arkadaslarin sorularini yanitliyoruz hemen.
Bu Mod Sayesinde Kanalinizi rutbeye gore kapatabilirsiniz.. Yani
/Mode #Kanal +P C
Dedigimiz zaman Kanala Sadece Co-Admin ve Uzeri Rutbeler Girebilir.
N = Network AdminLere Ozel
A = Server Adminler ve Ustune Ozel
a = Services Adminlere ve Ustune Ozel
C = Co-AdminLere ve Ustune Ozel
o = OperatorLer ve Ustune Ozel..
PHP- Kodu:
/*
* IRC - Internet Relay Chat levelimit.c
* (C) 2005 Dominick Meglio
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
if (acptr->user->swhois)
MyFree(acptr->user->swhois);
if (IsParam(2))
{
acptr->user->swhois = strdup(parv***91;2***93;);
sendto_snomask(SNO_EYES,
"%s changed the SWHOIS of %s (%s@%s) to be %s",
sptr->name, acptr->name, acptr->user->username,
acptr->user->realhost, parv***91;2***93;);
ircd_log(LOG_CHGCMDS,
"CHGSWHOIS: %s changed the SWHOIS of %s (%s@%s) to be %s",
sptr->name, acptr->name, acptr->user->username,
acptr->user->realhost, parv***91;2***93;);
}
else
{
acptr->user->swhois = NULL;
sendto_snomask(SNO_EYES,
"%s cleared the SWHOIS of %s (%s@%s)",
sptr->name, acptr->name, acptr->user->username,
acptr->user->realhost);
ircd_log(LOG_CHGCMDS,
"CHGSWHOIS: %s cleared the SWHOIS of %s (%s@%s)",
sptr->name, acptr->name, acptr->user->username,
acptr->user->realhost);
}
DLLFUNC int MOD_LOAD(m_rmtkl)(int module_load)
{
return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(m_rmtkl)(int module_unload)
{
DelCommand(CmdRmtkl);
return MOD_SUCCESS;
}
/*
* =================================================================
* tkl_check_local_remove_shun:
* Copied from src/s_kline.c (because it's declared statically,
* but I want to use it).
* =================================================================
*/
static void tkl_check_local_remove_shun(aTKline *tmp)
{
long i1, i;
char *chost, *cname, *cip;
int is_ip;
aClient *acptr;
for (i1 = 0; i1 <= 5; i1++)
{
for (i = 0; i <= LastSlot; ++i)
{
if ((acptr = local***91;i***93;))
if (MyClient(acptr) && IsShunned(acptr))
{
chost = acptr->sockhost;
cname = acptr->user->username;
/*
* =================================================================
* my_tkl_del_line:
* Modified version of tkl_del_line (from src/s_kline.c),
* because using loops is unnecessary here). Also, I don't
* delete any spamfilter entries with this module either.
* =================================================================
*/
/*
* =================================================================
* dumpit:
* Dump a NULL-terminated array of strings to user sptr using
* the numeric rplnum, and then return 0.
* (Taken from DarkFire IRCd)
* =================================================================
*/
static int dumpit(aClient *sptr, char **p)
{
for (; *p != NULL; p++)
sendto_one(sptr, ":%s %03d %s :%s",
me.name, RPL_TEXT, sptr->name, *p);
/* let user take 8 seconds to read it! */
sptr->since += 8;
return 0;
}
/* help for /rmtkl command */
static char *rmtkl_help***91;***93; =
{
"*** Help on /rmtkl *** ",
"COMMAND - Removes all TKLs matching the given conditions from the",
"local server or the IRC Network depending on it's a global ban or not.",
"With this command you can remove any type of TKLs (including K:Line",
"G:Line, Z:Line, Global Z:Line and Shun).",
"Syntax:",
" /rmtkl type user@host ***91;comment***93;",
"The type field may contain any number of the following characters:",
" K, z, G, Z, q, Q and *",
" (asterix includes every types but q & Q).",
"The user@host field is a wildcard mask to match an user@host which",
" a ban was set on.",
"The comment field is also wildcard mask that you can match the",
" text of the reason for a ban.",
"Examples:",
" - /rmtkl * *",
" ***91;remove all TKLs but q and Q lines***93;",
" - /rmtkl GZ *@*.mx",
" ***91;remove all Mexican G/Z:Lines***93;",
" - /rmtkl * * *Zombie*",
" ***91;remove all non-nick bans having Zombie in their reasons***93;",
"*** End of help ***",
NULL
};
// =================================================================
// Array of TKL types
// =================================================================
if (IsNotParam(1))
return dumpit(sptr, rmtkl_help);
if (IsNotParam(2))
{
/*
* In this case we don't send the entire help text to
* the client.
*/
sendto_one(sptr, ":%s NOTICE %s :Not enough parameters. "
"Type /%s for help.",
me.name, parv***91;0***93;, "RMTKL");
return 0;
}
/* I don't add 'q' and 'Q' here. They are different. */
if (strchr(types, '*'))
types = "KzGZs";
/* check access */
if (!IsULine(sptr))
for (p = types; *p; p++)
{
tkltype = find_TKLType_by_flag(*p);
if (!tkltype->type)
continue;
if (((tkltype->type & TKL_GLOBAL) && !IsOper(sptr))
|| !(sptr->oflag & tkltype->oflag))
{
sendto_one(sptr, err_str(ERR_NOPRIVILEGES),
me.name, parv***91;0***93;);
return -1;
}
}
#ifdef TKLISTLEN /* Unreal3.2-RC1 */
for (tkltype = tkl_types; tkltype->type; tkltype++)
{
flag = tkltype->flag;
tklindex = tkl_hash(flag);
if (!strchr(types, flag))
continue;
for (tk = tklines***91;tklindex***93;; tk; tk = next)
{
next = tk->next;
if (tk->type != tkltype->type)
continue;
#ifdef TKL_NICK
if (tk->type & TKL_NICK)
{
/*
* If it's a services hold (ie. NickServ is holding
* a nick), it's better not to touch it
*/
if (*tk->usermask == 'H')
continue;
if (match(uhmask, tk->hostmask))
continue;
}
else
#endif
if (match(uhmask, make_user_host(tk->usermask, tk->hostmask)))
continue;
tkltype = find_TKLType_by_type(tk->type);
flag = tkltype->flag;
if (!strchr(types, flag))
continue;
if (match(uhmask, make_user_host(tk->usermask, tk->hostmask)))
continue;
if (cmask && _match(cmask, tk->reason))
continue;