egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need Help , Blacklist tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
aboutme
Voice


Joined: 23 Nov 2015
Posts: 1

PostPosted: Mon Nov 23, 2015 6:50 am    Post subject: Need Help , Blacklist tcl Reply with quote

Features: support ip, host, resolve , CIDR

- blacklist file
example: set blacklist(file) "scripts/blacklist.txt"
- special flag
example: only user with flag +B can use commands addban, remban and banlist ( this flag can be settable only from perm owner )

1. Procedures:
- addban
example: partyline command .addban *!*@10.1.1.1 reason time
example CIDR: partyline command: addban *!*@10.1.1.1/8 reason time
- remban
example: partyline command .remban *!*@10.1.1.1
- banlist
example: partyline command: .banlist ( show the current list with all bans )
if is possible to order bans a-z after adding or removing some ban ( but if that load the bot better not )

2. bantype:
- IP: all users join from host/ip will be ban with mask *!*@10.1.1.1 or *!*@some.host.com ( example: use set ipban [maskhost $host 2] )
- HEX: all users join from type: *!*@*.html.chat, *!*@*.xs4all.nl, *!*@*.kiwiirc.com or *!*@*.mibbit.com will be ban with the banmask *!*ident@*.html.chat ( example: use set hexban [maskhost $host 3] )

3. exempt:
- by default eggdrop don't check other eggdrops/bots
- flag I gives user exempt and he wouldn't be checked

4. Putidx
- addban example: putidx $idx "SYNTAX: \003.addban \002<nick>\002!\002<user>\002@\002<host>\002 \[reason\] \[bantime\]\003"
- addban check for existing ban: putidx $idx "[string map {! \002!\002 @ \002@\002} \002$blnick\002] has been \002added\002 to the blacklist."
- remban example: putidx $idx "SYNTAX: \003.remban \002<nick>\002!\002<user>\002@\002<host>\002\003"
- remban message: putidx $idx "[string map {! \002!\002 @ \002@\002} \002$blnick\002] was \002deleted\002 from the blacklist."
- remban check: putidx $idx "[string map {! \002!\002 @ \002@\002} \002$blnick\002] was \002not\002 found in the blacklist."
- banlist example: putidx $idx "SYNTAX: \003.Showing the banlist!\003" , putidx $idx "SYNTAX: \003.End of the banlist!\003"
- ban is added: putidx $idx "[string map {! \002!\002 @ \002@\002} \002$blnick\002] has been \002added\002 to the blacklist.
- ban already exist: putidx $idx "[string map {! \002!\002 @ \002@\002} \002$blnick\002] already \002exists\002 in the blacklist."
- Empty banlist: putidx $idx "There are \002no\002 bans in the blacklist."

5. Handle
- Showing handle of user set the ban ( if is possible to show and date like )
- example reason: (Violation of the rules section 2 of regulation! 13/04/2014 Kiril@Valhalla)

Note:
if user join with host eggdrop resolve host to ip and check in database ( blacklist ).
if blacklist file does not exist than create one!
Check if IP is already added in blacklist!

Legend:
- Time: .addban *!*@10.1.1.1 [censored] ya 60 ( that means ban is for 60 min )
- Time: .addban *!*@10.1.1.1/16 [censored] ya 0 ( that means ban is permanent )

Logic:
user join for example from host [05:20:36] * ShakeIT46982 (d4059ee1@elitsat.html.chat) has joined #gyuvetch
TO DO Procedures:
1. Convert HEX to IP ( d4059ee1 -> 212.5.158.225 )
2. Convert HOST to IP ( Resolve ) if is need it like linux.com -> 140.211.167.50 ( for users join via IRC client not webchat )
3. Compare IP with banlist using matchcidr or whatever is need it!
4. Set Channel ban depends from that is it from *!*@*.html.chat or it is host/ip see 2. bantype

HELP materials:

- hex2ip Procedure:

proc bl:h2d {hex} {
# Simple check to validate proper hex string
if {[regexp {^[a-fA-F0-9]{8}$} $hex]} {
set dec [expr 0x$hex]
set o1 [expr {($dec >> 24) & 0xff}]
set o2 [expr {($dec >> 16) & 0xff}]
set o3 [expr {($dec >> Cool & 0xff}]
set o4 [expr {$dec & 0xff}]

return "$o1.$o2.$o3.$o4"
}
return 0
}

- Checking for perm owner

proc ispermowner {hand} {
global owner
regsub -all -- , [string tolower $owner] "" owners
if {([matchattr $hand n]) && \
([lsearch -exact $owners [string tolower $hand]] != -1)} then {
return 1
}
return 0
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber