This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

protection - banning users doing single kick/deop/op/ban

Support & discussion of released scripts, and announcements of new releases.
Post Reply
n
nsrafk
Halfop
Posts: 73
Joined: Fri May 11, 2007 12:25 am

protection - banning users doing single kick/deop/op/ban

Post by nsrafk »

Hi. Im running a channel where all users gets OP on join. Im currently running "smallprotect.tcl" from the archive. I just have 1 problem with it. It only bans the nick! I want it to ban the hostmask, like most antitake scripts would do. Ill show you guys the script, and hope that somebody will tell me how to change the way the bot bans :)

Code: Select all

# smallprotect v1.00b [April 2006]
# Copyright (C) superior <superior_@gmx.net>, www.sunslayer.org or #superior!
#
# Optimized for Quakenet
#
# 1) If you find any Bugs or Errors please report them to me! 
# 1a) You're allowed to use any parts of this Script in your own Script.
#
# Description:
# This Script can be used to support your Anti Take Script or
# to optimize your Channelmanagement.
# IT CANT BE USED FOR PROTECTING YOUR CHANNEL!
# The Script reacts to Channelactions like KICK, BAN, DEOP, OP -
# Just edit the settings and rehash the Bot.
#
# Last updated:
# -none-
#
#######################################################################################
#
# Its important to give L/Q enough rights in the Bots Userlist, so they are allowed 
# to do all Actions which you want to control.
#
#######################################################################################


#######################################
########## Please Edit below ##########
#######################################

############# Mode +o #################

## Who is allowed to op?
set op_allowed "mb"

## What happend if someone op, who isn't allowed?
## 0 = Nothing
## 1 = Deop the User, Reset his Action
## 2 = Kick the User, Reset his Action
## 3 = Ban the User, Reset his Action
set op_revenge "0"

## If you choose "3" before, how long the ban should last?
set op_ban_time "10"

## Should the Bot remove all Userflags on Q/L
## 1 = Yes
## 2 = No
set op_revenge_service "2"

## Choose which Flags should be removed. 
## If your Bot has Master its usefull to choose "ao" - if he has Owner its usefull to choose "amo"
set op_revenge_flags "ao"

## Set the Message, which will send to the unauthorized User
## Please enter a Message, or leave blank
set op_message "You're not allowed to OP people here."

############# Mode -o #################

## Please Configure

set deop_allowed "mb"
set deop_revenge "3"
set deop_ban_time "10"
set deop_revenge_service "2"
set deop_revenge_flags "ao"
set deop_message "You're not allowed to DEOP people here"

############# Mode +b #################

## Please Configure

set ban_allowed "mb"
set ban_revenge "3"
set ban_ban_time "10"
set ban_revenge_service "2"
set ban_revenge_flags "ao"
set ban_message "You're not allowed to BAN people here"

############## Kick ##################

## Please Configure

set kick_allowed "mb"
set kick_revenge "3"
set kick_ban_time "10"
set kick_revenge_service "2"
set kick_revenge_flags "ao"
set kick_message "You're not allowed to KICK people here"

#######################################
########## Don't Edit below ###########
#######################################

#### global ####

set ver "1.00b"

#### bind #####

bind mode - * user:mode
bind kick - * user:kick

#### proc ####

proc user:kick { nick uhost hand chan victim why } {
global botnick kick_allowed kick_revenge kick_revenge_service kick_ban_time kick_message kick_revenge_flags
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $kick_allowed $chan] == 1 } { return 0 }
set chanservice "0"
if { $kick_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$kick_revenge_flags" -next
}
}
if { $kick_revenge == 1 } { 
	putquick "mode $chan -o $nick"
}
if { $kick_revenge == 2 } {
	putquick "kick $chan $nick"
}
if { $kick_revenge == 3 } {
	putquick "mode $chan +b $nick"
	putquick "kick $chan $nick"
	newchanban $chan $nick $victim Banned $kick_ban_time
}
if { $kick_message != "" } { putserv "notice $nick :$kick_message" }
}

proc user:mode { nick uhost hand chan mode victim } {
global botnick ban_allowed op_allowed deop_allowed ban_revenge op_revenge deop_revenge
global ban_revenge_service op_revenge_service deop_revenge_service
global ban_revenge_flags op_revenge_flags deop_revenge_flags
global op_message deop_message ban_message
global op_ban_time deop_ban_time ban_ban_time
if { $mode == "+b" } {
set chanservice "0"
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $ban_allowed $chan] == 1 } { return 0 }
if { $ban_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$ban_revenge_flags" -next
}
} 
if { $ban_revenge == 1 } { 
	putquick "mode $chan -o $nick"
	putserv "mode $chan -b $victim"
}
if { $ban_revenge == 2 } {
	putquick "kick $chan $nick"
	putserv "mode $chan -b $victim"
}
if { $ban_revenge == 3 } {
	putquick "mode $chan +b $nick"
	putquick "kick $chan $nick" -next
	putserv "mode $chan -b $victim"
	newchanban $chan $nick $victim Banned $ban_ban_time
}

if { $ban_message != "" } { putserv "notice $nick :$ban_message" }
}
if { $mode == "+o" } {
set chanservice "0"
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $op_allowed $chan] == 1 } { return 0 }
if { $op_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$op_revenge_flags" -next
}
}
if { $op_revenge == 1 } { 
	putquick "mode $chan -o $nick"
	putserv "mode $chan -o $victim"
}
if { $op_revenge == 2 } {
	putquick "kick $chan $nick"
	putserv "mode $chan -o $victim"
}
if { $op_revenge == 3 } {
	putquick "mode $chan +b $nick"
	putquick "kick $chan $nick"
	putserv "mode $chan -o $victim"
	newchanban $chan $nick $victim Banned $op_ban_time
}
if { $op_message != "" } { putserv "notice $nick :$op_message" }
}
if { $mode == "-o" } {
set chanservice "0"
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $op_allowed $chan] == 1 } { return 0 }
if { $deop_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$deop_revenge_flags" -next
}
} 
if { $deop_revenge == 1 } { 
	putquick "mode $chan -o $nick"
	putserv "mode $chan +o $victim"
}
if { $deop_revenge == 2 } {
	putquick "kick $chan $nick"
	putserv "mode $chan +o $victim"
}
if { $deop_revenge == 3 } {
	putquick "mode $chan +b $nick"
	putquick "kick $chan $nick"
	putserv "mode $chan +o $victim"
	newchanban $chan $nick $victim Banned $deop_ban_time
}
if { $deop_message != "" } { putserv "notice $nick :$deop_message" }
}
}

putlog "smallprotect loaded - by superior - ver $ver"
Many thanks !!
n
nsrafk
Halfop
Posts: 73
Joined: Fri May 11, 2007 12:25 am

Post by nsrafk »

Btw, with 'hostmask' i mean like "*!*@host.com"
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Instead of

Code: Select all

putquick "mode $chan +b $nick"
use

Code: Select all

putquick "mode $chan +b *!*@[lindex [split $uhost @] 1]"
and same for

Code: Select all

newchanban $chan $nick $victim Banned $kick_ban_time
replace $nick with *!*@[lindex [split $uhost @] 1]. (Note that [newchanban] is used several times in the script, so you need to replace $nick in all its occurrences).
n
nsrafk
Halfop
Posts: 73
Joined: Fri May 11, 2007 12:25 am

Post by nsrafk »

Thanks m8 :) Works perfect.
n
nsrafk
Halfop
Posts: 73
Joined: Fri May 11, 2007 12:25 am

Post by nsrafk »

Ok, Sir_Fz. I have changed a bit in the script. Insted of the bot noticing the offender then it now shows the text in the kick message. All i want to hear, is if its a 'good' change, or is it full of bugs? I've used "putkick" instead of putquick "kick" etc. Only reason for this, is that else i couldnt figure out how to get in the different kick reasons.

Here is the modified script: (which btw, works very good on a channel with 150 ops, which tries to takeover channel often) Im using it with melts_antitake.tcl.

Code: Select all

# smallprotect v1.00b [April 2006]
# Copyright (C) superior <superior_@gmx.net>, www.sunslayer.org or #superior!
#
# Optimized for Quakenet
#
# 1) If you find any Bugs or Errors please report them to me! 
# 1a) You're allowed to use any parts of this Script in your own Script.
#
# Description:
# This Script can be used to support your Anti Take Script or
# to optimize your Channelmanagement.
# IT CANT BE USED FOR PROTECTING YOUR CHANNEL!
# The Script reacts to Channelactions like KICK, BAN, DEOP, OP -
# Just edit the settings and rehash the Bot.
#
# Last updated:
# -none-
#
#######################################################################################
#
# Its important to give L/Q enough rights in the Bots Userlist, so they are allowed 
# to do all Actions which you want to control.
#
#######################################################################################


#######################################
########## Please Edit below ##########
#######################################

############# Mode +o #################

## Who is allowed to op?
set op_allowed "mbo"

## What happend if someone op, who isn't allowed?
## 0 = Nothing
## 1 = Deop the User, Reset his Action
## 2 = Kick the User, Reset his Action
## 3 = Ban the User, Reset his Action
set op_revenge "0"

## If you choose "3" before, how long the ban should last?
set op_ban_time "10"

## Should the Bot remove all Userflags on Q/L
## 1 = Yes
## 2 = No
set op_revenge_service "2"

## Choose which Flags should be removed. 
## If your Bot has Master its usefull to choose "ao" - if he has Owner its usefull to choose "amo"
set op_revenge_flags "ao"

## Set the Message, which will send to the unauthorized User
## Please enter a Message, or leave blank
set op_message "You're not allowed to OP people in #Nosser"

############# Mode -o #################

## Please Configure

set deop_allowed "mb"
set deop_revenge "3"
set deop_ban_time "20"
set deop_revenge_service "2"
set deop_revenge_flags "ao"
set deop_message "You're not allowed to DEOP people in #Nosser"

############# Mode +b #################

## Please Configure

set ban_allowed "mb"
set ban_revenge "3"
set ban_ban_time "30"
set ban_revenge_service "2"
set ban_revenge_flags "ao"
set ban_message "You're not allowed to BAN people in #Nosser"

############## Kick ##################

## Please Configure

set kick_allowed "mb"
set kick_revenge "3"
set kick_ban_time "20"
set kick_revenge_service "2"
set kick_revenge_flags "ao"
set kick_message "You're not allowed to KICK in #Nosser"

#######################################
########## Don't Edit below ###########
#######################################

#### global ####

set ver "1.00b"

#### bind #####

bind mode - * user:mode
bind kick - * user:kick

#### proc ####

proc user:kick { nick uhost hand chan victim why } {
global botnick kick_allowed kick_revenge kick_revenge_service kick_ban_time kick_message kick_revenge_flags
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $kick_allowed $chan] == 1 } { return 0 }
set chanservice "0"
if { $kick_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$kick_revenge_flags" -next
}
}
if { $kick_revenge == 1 } { 
	putquick "mode $chan -o $nick"
}
if { $kick_revenge == 2 } {
	putkick $chan $nick "$kick_message"
}
if { $kick_revenge == 3 } {
	putquick "mode $chan +b *!*@[lindex [split $uhost @] 1]"
	putkick $chan $nick "$kick_message"
	newchanban $chan *!*@[lindex [split $uhost @] 1] $victim "$kick_message" $kick_ban_time
}
if { $kick_message != "" } { putserv "notice $nick :$kick_message" }
}

proc user:mode { nick uhost hand chan mode victim } {
global botnick ban_allowed op_allowed deop_allowed ban_revenge op_revenge deop_revenge
global ban_revenge_service op_revenge_service deop_revenge_service
global ban_revenge_flags op_revenge_flags deop_revenge_flags
global op_message deop_message ban_message
global op_ban_time deop_ban_time ban_ban_time
if { $mode == "+b" } {
set chanservice "0"
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $ban_allowed $chan] == 1 } { return 0 }
if { $ban_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$ban_revenge_flags" -next
}
} 
if { $ban_revenge == 1 } { 
	putquick "mode $chan -o $nick"
	putserv "mode $chan -b $victim"
}
if { $ban_revenge == 2 } {
	putkick $chan $nick "$ban_message"
	putserv "mode $chan -b $victim"
}
if { $ban_revenge == 3 } {
	putquick "mode $chan +b *!*@[lindex [split $uhost @] 1]"
	putkick $chan $nick "$ban_message" -next
	putserv "mode $chan -b $victim"
	newchanban $chan *!*@[lindex [split $uhost @] 1] $victim "$ban_message" $ban_ban_time
}

}
if { $mode == "+o" } {
set chanservice "0"
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $op_allowed $chan] == 1 } { return 0 }
if { $op_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$op_revenge_flags" -next
}
}
if { $op_revenge == 1 } { 
	putquick "mode $chan -o $nick"
	putserv "mode $chan -o $victim"
}
if { $op_revenge == 2 } {
	putkick $chan $nick "$op_message"
	putserv "mode $chan -o $victim"
}
if { $op_revenge == 3 } {
	putquick "mode $chan +b *!*@[lindex [split $uhost @] 1]"
	putkick $chan $nick "$op_message"
	putserv "mode $chan -o $victim"
	newchanban $chan *!*@[lindex [split $uhost @] 1] $victim "$op_message" $op_ban_time
}

}
if { $mode == "-o" } {
set chanservice "0"
if { $botnick == $nick || [matchattr [nick2hand $nick $chan] $op_allowed $chan] == 1 } { return 0 }
if { $deop_revenge_service == 1 } {
	if {[onchan L $chan] == 1} { set chanservice "L" }
	if {[onchan Q $chan] == 1} { set chanservice "Q" }
	if { $chanservice != 0 } { 
		putquick "PRIVMSG $chanservice :CHANLEV $chan $nick -$deop_revenge_flags" -next
}
} 
if { $deop_revenge == 1 } { 
	putquick "mode $chan -o $nick"
	putserv "mode $chan +o $victim"
}
if { $deop_revenge == 2 } {
	putkick $chan $nick "$deop_message"
	putserv "mode $chan +o $victim"
}
if { $deop_revenge == 3 } {
	putquick "mode $chan +b *!*@[lindex [split $uhost @] 1]"
	putkick $chan $nick "$deop_message"
	putserv "mode $chan +o $victim"
	newchanban $chan *!*@[lindex [split $uhost @] 1] $victim "$deop_message" $deop_ban_time
}
}
}

putlog "smallprotect loaded - by superior - ver $ver"
I hope its good enough hehe.
b
bootdisk
Voice
Posts: 12
Joined: Mon Jun 11, 2007 10:22 am

Post by bootdisk »

Nice script, but i got one question, how to make this script active in several channels? and in the kick msg it should say the active channel?

Some thing like..

#######################################
########## Please Edit below ##########
#######################################

Set channels "channel1 channel2" etc

or make a public command so the channel owner/master can enable/disable this future?
n
nsrafk
Halfop
Posts: 73
Joined: Fri May 11, 2007 12:25 am

Post by nsrafk »

Its enabled in all channels by default. would be nice to being able to set the chans it should be active in though.
Post Reply