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 

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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Sat May 26, 2007 5:51 pm    Post subject: protection - banning users doing single kick/deop/op/ban Reply with quote

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 Smile
Code:
# 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 !!
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Sat May 26, 2007 5:54 pm    Post subject: Reply with quote

Btw, with 'hostmask' i mean like "*!*@host.com"
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat May 26, 2007 9:00 pm    Post subject: Reply with quote

Instead of
Code:
putquick "mode $chan +b $nick"

use
Code:
putquick "mode $chan +b *!*@[lindex [split $uhost @] 1]"

and same for
Code:
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).
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Sat May 26, 2007 10:27 pm    Post subject: Reply with quote

Thanks m8 Smile Works perfect.
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Sat May 26, 2007 11:14 pm    Post subject: Reply with quote

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:
# 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.
Back to top
View user's profile Send private message
bootdisk
Voice


Joined: 11 Jun 2007
Posts: 12

PostPosted: Sun Jun 24, 2007 1:18 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Tue Jun 26, 2007 4:47 pm    Post subject: Reply with quote

Its enabled in all channels by default. would be nice to being able to set the chans it should be active in though.
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 Support & Releases 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