botlending forum  

Go Back   botlending forum > Eggdrop & TCL > Tcl scripting

Tcl scripting Tcl scripting related questions

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 10-07-2004, 21:47   #1 (permalink)
Senior Member
 
GoRaPiD's Avatar
 
Join Date: Jun 2004
Location: In pat cu avatarul meu
Age: 20
Posts: 256
Rep Power: 0
GoRaPiD is an unknown quantity at this point
Send a message via Yahoo to GoRaPiD
Post Bad Chan Tcl

am luat acest tcl ca sa banezi canale desemnate de mine :


Code:
 if {[info exists bcqueue]} {unset bcqueue} 
set bchan(chans) ""
proc bmaskhost {uhost} {
set uhost [lindex [split $uhost !] [expr [llength [split $uhost !]] -1]]
set temp [string range [lindex [split $uhost @] 0] [expr [string length [lindex [split $uhost @] 0]] - 8] e]
return "*!*$temp@[lindex [split [maskhost *!*@[lindex [split $uhost @] 1]] @] 1]"
}
 
proc bchan_read {} {
global bchan
set fd [open scripts/badchan.conf r]
while {![eof $fd]} {
set inp [gets $fd]
if {[string trim $inp " "] == ""} {continue}
set ban [lrange $inp 1 e]
set chan [string tolower [lindex $inp 0]]
if {[lsearch $bchan(chans) $chan] == -1} {lappend bchan(chans) $chan}
lappend bchan($chan) $ban
}
close $fd
putlog "badchan.conf loaded."
}
putlog "Bass's badchan.tcl 1.0 loaded"
if {[file exists scripts/badchan.conf]} {bchan_read} {putlog "badchan.conf not found!"}
 
proc bc_flood_init {} {
global bc_flood bc_flood_num bc_flood_time bc_flood_array
if {![string match *:* $bc_flood]} {putlog bchan: var bc_flood not set correctly. ; return 1}
set bc_flood_num [lindex [split $bc_flood :] 0]
set bc_flood_time [lindex [split $bc_flood :] 1]
set i [expr $bc_flood_num - 1]
while {$i >= 0} {
set bc_flood_array($i) 0
incr i -1
}
} ; bc_flood_init
 
proc bc_flood {nick uhost} {
global bc_flood_num bc_flood_time bc_flood_array
if {$bc_flood_num == 0} {return 0}
set i [expr $bc_flood_num - 1]
while {$i >= 1} {
set bc_flood_array($i) $bc_flood_array([expr $i - 1])
incr i -1
}
set bc_flood_array(0) [unixtime]
if {[expr [unixtime] - $bc_flood_array([expr $bc_flood_num - 1])] <= $bc_flood_time} {
putlog "bchan: Flood detected from $nick."
#newignore [join [maskhost *!*[string trimleft $uhost ~]]] bchan flood 2
return 1
} {return 0}
}
 
 
bind join -|- * bchan_join
 
proc bchan_join {nick uhost hand chan} {
global bchan bcqueue bcnicks botnick
if {[matchattr [nick2hand $nick $chan] bmnof|mnof $chan]} {return 0}
set host [string tolower [lindex [split $uhost @] 1]]
set chan [string tolower $chan]
set nick [string tolower $nick]
if {[lsearch $bchan(chans) $chan] == -1 && ([lsearch $bchan(chans) global] == -1 || [lsearch $bchan(exempt) $chan] > -1)} {return 0}
if {[string tolower $botnick] == [string tolower $nick]} {return 0}
if {![botisop $chan]} {return 0}
if {$bchan(protect-hosts) != ""} {
foreach i $bchan(protect-hosts) {
if {[string match [string tolower $i] $host]} {return 0}
}
}
if {[info exists bcqueue($host)]} {return 0}
set bcqueue($host) 1 
if {[bc_flood $nick $uhost]} {return 0}
set bcnicks($nick) $chan
putserv "whois $nick" 
set i 0 
set temp ""
while {$i < [string length $nick]} {
if {[string index $nick $i] == "\\"} {append temp "\\\\"} elseif {
[string index $nick $i] == "\["} {append temp "\\\["} elseif {
[string index $nick $i] == "\]"} {append temp "\\\]"} elseif {
[string index $nick $i] == "\{"} {append temp "\\\{"} elseif {
[string index $nick $i] == "\}"} {append temp "\\\}"} {
append temp [string index $nick $i]}
incr i
} ; set nick $temp
timer $bchan(rescan) "unset bcqueue($host) ; unset bcnicks($nick)"
}
 
bind raw - 319 bc_whois
proc bc_whois {from key args} {
global bchan bcqueue bcnicks
# putlog "319: $args"
set args [join $args]
set nick [string tolower [lindex $args 1]]
if {[info exists bcnicks($nick)]} {set chan $bcnicks($nick)} {return 0}
set chans [string tolower [lrange $args 2 e]]
if {[lsearch $bchan(exempt) $chan] == -1 && $bchan(global) != ""} {set bans $bchan(global)} {set bans ""}
if {[lsearch $bchan(chans) $chan] > -1} {set bans "$bans $bchan($chan)"}
foreach tok $chans {
set tok [string trimleft $tok ":@+"]
foreach ban $bans {
if {[string match [lindex $ban 0] $tok]} {
putlog "badchan: match! $nick k/b'd from $chan because [lrange $ban 1 e]"
putlog "args: $args, ban: $ban"
if {[onchan $nick $chan]} {newchanban $chan [bmaskhost [getchanhost $nick $chan]] badchan "[lrange $ban 1 e]" 10}
return 0
}
}
}
return 0
}
bind pub n|- !gbclist bc_glist
proc bc_glist {1 2 3 4 5} {bc_list $1 $2 $3 global $5}
bind pub o|o !bclist bc_list
proc bc_list {nick uhost hand chan args} {
global bchan
set chan [string tolower $chan]
if {[lsearch $bchan(chans) $chan] == -1} {puthelp "notice $nick :No badchans are registered for $chan." ; return 1}
set i 1
puthelp "notice $nick :BadChans for $chan..."
foreach ban $bchan($chan) {
puthelp "notice $nick :$i) $ban"
incr i
}
}
bind pub n|- !gabc bc_gadd
proc bc_gadd {1 2 3 4 5} {bc_add $1 $2 $3 global $5}
bind pub o|o !abc bc_add
proc bc_add {nick uhost hand chan args} {
global bchan
set chan [string tolower $chan]
if {![string match *\\\** [lindex $args 0]]} {puthelp "notice $nick :syntax is: !abc <chanmask> \[reason\]" ; return 1}
set args [string trimright "[string tolower [lindex $args 0]] [lrange $args 1 e]" " "]
if {[lsearch $bchan(chans) $chan]} {lappend bchan(chans) $chan}
lappend bchan($chan) $args
puthelp "notice $nick :[lindex $args 0] was added to $chan's badchan list."
bchan_save
return 1
}
bind pub n|- !grbc bc_grem
proc bc_grem {1 2 3 4 5} {bc_rem $1 $2 $3 global $5}
bind pub o|o !rbc bc_rem
proc bc_rem {nick uhost hand chan args} {
global bchan
set chan [string tolower $chan]
set args [string tolower [lindex [join $args] 0]]
if {[lsearch $bchan(chans) $chan] == -1} {puthelp "notice $nick :No badchans are registered for $chan." ; return 1}
if {![string match *\\\** $args]} {puthelp "notice $nick :syntax is: !rbc <chanmask>" ; return 1}
set i 0
set temp ""
foreach ban $bchan($chan) {
if {[string compare $args [lindex $ban 0]] == 0} {incr i} {lappend temp $ban}
}
if {$i > 0} {
if {$temp != ""} {set bchan($chan) $temp} {
unset bchan($chan)
set temp [lsearch $bchan(chans) $chan]
if {$temp == -1} {putlog "bchan: I'm confused." ; return 1}
set bchan(chans) [lreplace $bchan(chans) $temp $temp]
}
puthelp "notice $nick :$args was removed from $chan's badchan list."
bchan_save
} {puthelp "notice $nick :$args was not found in $chan's badchan list."}
return 1
}
proc bchan_save {} {
global bchan
set fd [open scripts/badchan.conf w]
foreach chan $bchan(chans) {
foreach ban $bchan($chan) {
puts $fd "$chan $ban"
}
}
close $fd
}
dar el baneaza in genul *!*ident@*.host.domain ceea ce ar putea actiona ca un fel de take daca ar bana *!*a@*.undernet.org

As dori sa stiu daca se poate schimba tipul de banmask in *!*user@host.domain , *!*@host.domain

Pls Help
__________________
Forza RAPID ALE ALEEEEEEEEEEEEEEEEEEEEEEe

Last edited by UniversaliA; 11-07-2004 at 01:13. Reason: invatam sa postam codul :) orice cod pui intre [CODE][/CODE]
GoRaPiD is offline  
Old 11-07-2004, 01:19   #2 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 827
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

simplu, adaugi un singur rand in proc bmaskhost

Code:
 
proc bmaskhost {uhost} { 
 
if {[string match -nocase *@*.users.undernet.org $uhost]} {return "*!*[join [regexp -inline -- {@[^@].+} $uhost]]"}
 
set uhost [lindex [split $uhost !] [expr [llength [split $uhost !]] -1]]
set temp [string range [lindex [split $uhost @] 0] [expr [string length [lindex [split $uhost @] 0]] - 8] e]
return "*!*$temp@[lindex [split [maskhost *!*@[lindex [split $uhost @] 1]] @] 1]"
}
corijare SPECIAL pentru *@*.users.undernet.org

Last edited by UniversaliA; 11-07-2004 at 01:51.
UniversaliA is offline  
Old 11-07-2004, 02:21   #3 (permalink)
Senior Member
 
GoRaPiD's Avatar
 
Join Date: Jun 2004
Location: In pat cu avatarul meu
Age: 20
Posts: 256
Rep Power: 0
GoRaPiD is an unknown quantity at this point
Send a message via Yahoo to GoRaPiD
Post Alt script aceeasi problema

Code:
 proc badword {nick uhost hand chan rest} {
putlog "$nick $uhost $hand $chan $rest"
  global botnick ban-time Ban bword
    if {([ matchattr $hand f ])} {
      	putserv "PRIVMSG $chan :\001ACTION OVER Hears \002$nick\002 And SmiLes  L:-) \001"
        return 1
	} elseif {([matchattr $hand G])} {
          chattr $nick +dk
	  setuser $nick COMMENT "Perm banned for 4 bad word offenses"
          putserv "PRIVMSG $chan :$nick You Are Not Welcomed Here Anymore..."
	  putserv "KICK $chan $nick :$Ban \[Perm\]"	
        return 1
	} elseif {([matchattr $hand E])} {
	  chattr $nick +G-E
	  putserv "PRIVMSG $chan :$nick You Have Had Your Chances, Now You Are Out of Here. Strike! two  Your --------=>>> Out."
          set banlamer [maskhost [getchanhost $nick $chan]]
          newban $banlamer Badword $Ban 120 none
          setuser $nick COMMENT "3 Bad Word Offenses"
          return 1
	} elseif {([matchattr $hand Y])} {
	  chattr $nick +E-Y
	  putserv "PRIVMSG $chan :Has taken action on $nick for the 2nd Offense"
	  set banlamer [maskhost [getchanhost $nick $chan]]
          newban $banlamer Badword $Ban 10 none
          setuser $nick COMMENT "2 Bad Word Offenses"
          return 1
	} 
          adduser $nick [maskhost [getchanhost $nick $chan]]
          putserv "PRIVMSG $chan :\001ACTION Detected A Banned Word by $nick\001"
          putserv "PRIVMSG $nick :\001ACTION Hey, $nick, Profanity IS BAD,I Will Not allow Such A Thing In This Channel!!!\001"
          putserv "PRIVMSG $chan :\001ACTION Bad Language Is Not Fun, $nick Should never have said that...\001"
          putserv "KICK $chan $nick :Get The out of here with that kind of talk"
          putserv "NOTICE $nick :Please DON'T use that language in $chan"
          putserv "NOTICE $nick :\001ACTION Is Frowning At $nick This is your \[1st Warning\]\001"
          putserv "NOTICE $nick :If You Continue, You Will Be Banned The Second Time For 1 hour"
          chattr $nick +Y
          setuser $nick PASS $bword 
          setuser $nick COMMENT "1st Offense Badword"
          return 0
	 }
putlog " \[Word|KiCk\]  v3.0 By \002TheGhost\002 is Loaded"
__________________
Forza RAPID ALE ALEEEEEEEEEEEEEEEEEEEEEEe
GoRaPiD is offline  
Old 11-07-2004, 19:05   #4 (permalink)
Member
 
Kurupt's Avatar
 
Join Date: Jun 2004
Location: Hermannstadt
Age: 24
Posts: 108
Rep Power: 36
Kurupt will become famous soon enough
Send a message via Yahoo to Kurupt
Default sau asa

Code:
set userhost [getchanhost $tnick $chan] 
set banmask "*!*@[lindex [split $userhost @] 1]"
te descurci tu
__________________
Owner of #ro-tcl
Kurupt is offline  
Old 11-07-2004, 20:21   #5 (permalink)
Senior Member
 
GoRaPiD's Avatar
 
Join Date: Jun 2004
Location: In pat cu avatarul meu
Age: 20
Posts: 256
Rep Power: 0
GoRaPiD is an unknown quantity at this point
Send a message via Yahoo to GoRaPiD
Talking

Quote:
Originally Posted by Kurupt
Code:
set userhost [getchanhost $tnick $chan] 
set banmask "*!*@[lindex [split $userhost @] 1]"
te descurci tu

Vreau sa iti spun ca ti-ai gasit omu
__________________
Forza RAPID ALE ALEEEEEEEEEEEEEEEEEEEEEEe
GoRaPiD is offline  
Old 12-07-2004, 08:19   #6 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 827
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

aplicam metoda lui Kurupt care e foarte simpla si eficace & luam exemplu de la primul script:

1. adaugam un nou proc

Code:
proc bmaskhost {uhost} { return '*!*@[lindex [split $uhost @] 1]'}
2. schimbam in script proc maskhost cu bmaskhost (adaugam doar litera b la cuvintul maskhost )

Last edited by UniversaliA; 12-07-2004 at 08:21.
UniversaliA is offline  
Old 12-07-2004, 13:38   #7 (permalink)
Senior Member
 
GoRaPiD's Avatar
 
Join Date: Jun 2004
Location: In pat cu avatarul meu
Age: 20
Posts: 256
Rep Power: 0
GoRaPiD is an unknown quantity at this point
Send a message via Yahoo to GoRaPiD
Exclamation

Quote:
Originally Posted by aqwzsx
aplicam metoda lui Kurupt care e foarte simpla si eficace & luam exemplu de la primul script:

1. adaugam un nou proc

Code:
proc bmaskhost {uhost} { return '*!*@[lindex [split $uhost @] 1]'}
2. schimbam in script proc maskhost cu bmaskhost (adaugam doar litera b la cuvintul maskhost )
[12:35:11] * RapidRO sets mode: +b *!*@81-196-68-153.constanta.cablelink.ro

Ms a mers o singura problem care am rezolvato.
La
Code:
proc bmaskhost {uhost} { return '*!*@[lindex [split $uhost @] 1]'}
'*!*@[lindex [split $uhost @] 1]' aici fara cele 2 ghilimele de la inceput si sfarsit :P

P.S. l-am editat
__________________
Forza RAPID ALE ALEEEEEEEEEEEEEEEEEEEEEEe
GoRaPiD is offline  
Old 12-07-2004, 20:23   #8 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 827
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

reformuleaza, nu inteleg nimica
UniversaliA is offline  
Old 16-07-2004, 17:24   #9 (permalink)
Junior Member
 
Join Date: Jul 2004
Age: 27
Posts: 2
Rep Power: 0
v00d00 is an unknown quantity at this point
Send a message via ICQ to v00d00
Post

baietzi am nevoie de ajutor in scriptul lui MC_8 mc.ban_channel.tcl... vreau sa fac excempt pe *!*@*.users.undernet.org, ca sa nu-i scaneze pe ei... adica la join sa nu-i scaneze pe cei cu mask-a *!*@*.users.undernet.org... ca si cum face exempt la OP/VOICE asa sa faca exempt si la *!*@*.users.undernet.org...
scriptul e aici... http://mc.purehype.net/index.tcl?download=Ban+Channel
P.S. si daca vetzi avea timp sa-mi lamuritzi cum sa mai adaug asa tip de exempt pentru alte mask-uri... de exemplu as vrea sa fac exempt la acest script pentru totzi userii cu mask-a: 1) *!*@*.accent.net, 2) *!*@*.nokia.net si altele...

Va multzumesc.
Best Regards, v00d00

Last edited by v00d00; 16-07-2004 at 17:28.
v00d00 is offline  
Old 16-07-2004, 19:29   #10 (permalink)
Member
 
Kurupt's Avatar
 
Join Date: Jun 2004
Location: Hermannstadt
Age: 24
Posts: 108
Rep Power: 36
Kurupt will become famous soon enough
Send a message via Yahoo to Kurupt
Default ce alceva?

uita-te la exempt din dcc!
Code:
.+exempt <hostmask> [channel] [%<XdXhXm>] [comment]
__________________
Owner of #ro-tcl
Kurupt is offline  
Closed Thread

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
chan logging AdrianK Tcl scripting 11 02-11-2006 22:39
.+chan nu functioneaza krimson a&a light script 2 23-05-2006 23:32
[Modify script] modificare la chan join/part Freezed Tcl scripting 7 19-05-2005 16:38
Setari de chan GoRaPiD Tcl scripting 1 19-11-2004 08:39
$chan arg JohnyWalker Tcl scripting 1 14-06-2004 12:44


All times are GMT +3. The time now is 07:09.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.