bind pub v !rausschmiss do_rausschmiss bind pub v !hausverbot do_hausverbot bind pub nvf !idiot do_idiot if [info exist ::ModeD::major] { set ::ModeDV [expr $::ModeD::major*100000+$::ModeD::minor*1000+$::ModeD::build] putcmdlog "ModeD Version $ModeDV detected" } { set ::ModeDV 0 putcmdlog "ModeD not detected" } proc cyonchan {nick {chan ""}} { if {$::ModeDV=="0" || ($chan!=$::ModeD::channel && $chan!="#berlin.intern")} { if {$chan!=""} { putcmdlog "return chan normal: [onchan $nick $chan]" return [onchan $nick $chan] } { putcmdlog "return normal: [onchan $nick]" return [onchan $nick] } } { if {$chan!=""} { putcmdlog "return chan ModeD: [expr [lsearch -exact [string tolower $::ModeD::onlinelist] [string tolower $nick]]!=-1 || [onchan $nick $chan]]" #putcmdlog "return chan ModeD: [expr [lsearch [string tolower $::ModeD::onlinelist] [string tolower $nick]]!=-1 || [onchan $nick $chan]]" return [expr [lsearch -exact [string tolower $::ModeD::onlinelist] [string tolower $nick]]!=-1 || [onchan $nick $chan]] } { putcmdlog "return ModeD: [expr [lsearch -exact [string tolower $::ModeD::onlinelist] [string tolower $nick]]!=-1 || [onchan $nick]]" #putcmdlog "return ModeD: [expr [lsearch [string tolower $::ModeD::onlinelist] [string tolower $nick]]!=-1 || [onchan $nick]]" return [expr [lsearch -exact [string tolower $::ModeD::onlinelist] [string tolower $nick]]!=-1 || [onchan $nick]] } } } if ![info exist ::biplist] {set biplist [list]} proc save:ips args { putcmdlog "save ips" set f [open "/home/berlinchat/public_html/ipaccess" w] foreach item $::biplist { foreach {ip ts} $item { puts $f "$ip 0" } } puts $f "*.*.*.* 2" close $f } bind time - "27 *" chk:ips proc chk:ips args { foreach item $::biplist { foreach {ip ts} $item { if {[expr [clock second]-$ts]>172800} { set num [lsearch -exact $::biplist $item] if {$num!=-1} { set ::biplist [lreplace $::biplist $num $num] putcmdlog "remove ip:$ip is [duration [expr [clock second]-$ts]] ago ($num)" save:ips } { putcmdlog "!remove ip:$ip is [duration [expr [clock second]-$ts]] ago ($num)" } } { putcmdlog "!r ip:$ip is [duration [expr [clock second]-$ts]] ago" } } } } proc dns:311 {ip host status} { putcmdlog "ip:$ip h:$host s:$status" if $status { lappend ::biplist [list $ip [clock second]] save:ips } } proc chk:raw311 {from key text} { set list [split $text] set nick [lindex $list 1] set ident [lindex $list 2] set host [lindex $list 3] set real [string range [join [lrange $list 5 end]] 1 end] putcmdlog "finduser $nick!$ident@$host == [finduser $nick!$ident@$host]" if {[finduser $nick!$ident@$host]=="BerlinChat"} { putcmdlog "311 hm:$nick!$ident@$host r:$real ([finduser $nick!$ident@$host])" set hostname [string range $real [expr [string first \[ $real]+1] [expr [string first \] $real]-1]] dnslookup $hostname dns:311 putcmdlog "hostname $hostname" unbind:raw311 } } proc unbind:raw311 args { putcmdlog "unbind raw311" catch {unbind raw - 311 chk:raw311} } proc do_rausschmiss {nick uhost hand chan text} { putlog "RAUSSCHMISS: $nick!$uhost ($hand) $chan $text" global botnick if {$chan != "#berlin" && $chan != "#berlin.intern"} {putlog "wrong channel"; return 0} if {[isvoice $nick $chan] == 0} {putlog "$nick is not voice"; return 0} set who [lindex [split $text] 0] if {![cyonchan $who $chan]} { putnotc $nick "$who is nicht in $chan .." return } set reason ""; set reason [join [lrange [split $text] 1 end]] if {[string tolower $who] == [string tolower $botnick]} {putlog "its me"; return 0} if {[isvoice $who $chan] == 1} {putlog "$who is voice"; return 0} switch -- [rand 4] { 1 {set pretext "Jetzt wirds mir aber zu Bunt mit dir $who..."} 2 {set pretext "Warum kannst du nich einfach gehen ${who}?"} default {set pretext "\001ACTION geht zu $who und packt ihn an der Schulter...\001"} } switch -- [rand 4] { 1 {set kicktext "RAUS!!!"} 2 {set kicktext "GEH WEG!!"} 3 {set kicktext "GEH JETZT!!"} default {set kicktext "RAUS!!"} } switch -- [rand 4] { 1 {set posttext "wer will als naechstes gehen? ;)"} 2 {set posttext "wer will jetzt gehen? ;)"} 3 {set posttext "hoffentlich kommt $who nich so schnell wieder! ;)"} default {set posttext "noch jemand? ;)"} } switch -- [rand 3] { 1 {set posttext2 "$who hat den Channel verlassen.."} default {set posttext2 "$who entsorgt! ;)"} } if {[cyonchan $who $chan] && ![onchan $who $chan]} { if {$reason==""} { utimer 2 [list putserv "KICK $chan $who :$kicktext"] } { utimer 2 [list putserv "KICK $chan $who :$kicktext $reason"] } utimer 4 [list putserv "PRIVMSG $chan :$posttext2"] } else { putserv "PRIVMSG $chan :$pretext" if {$reason==""} { utimer 3 [list putserv "KICK $chan $who :$kicktext"] } { utimer 3 [list putserv "KICK $chan $who :$kicktext $reason"] } utimer 5 [list putserv "PRIVMSG $chan :$posttext"] } } proc do_hausverbot {nick uhost hand chan text} { putlog "HAUSVERBOT: $nick!$uhost ($hand) $chan $text" global botnick if {$chan != "#berlin" && $chan != "#berlin.intern"} {putlog "wrong channel"; return 0} if {[isvoice $nick $chan] == 0} {putlog "$nick is not voice"; return 0} set who [lindex [split $text] 0] if {![cyonchan $who $chan]} { putnotc $nick "$who is nicht in $chan .." return } set reason ""; set reason [join [lrange [split $text] 1 end]] if {[string tolower $who] == [string tolower $botnick]} {putlog "its me"; return 0} if {[isvoice $who $chan] == 1} {putlog "$who is voice"; return 0} switch -- [rand 5] { 1 {set pretext "\001ACTION schleift $who vor die Tür und bricht ihm alle Knochen\001"} 2 {set pretext "Jetzt wirds mir aber zu Bunt mit dir $who..."} 3 {set pretext "Warum kannst du nich einfach wegbleiben ${who}?"} default {set pretext "\001ACTION schleift $who vor die Tür und bricht ihm die Beine\001"} } switch -- [rand 5] { 1 {set kicktext "RAUS!!!"} 2 {set kicktext "GEH WEG!!"} 3 {set kicktext "HAU AB!!"} 4 {set kicktext "RAUS MIT DIR!!"} default {set kicktext "BLEIB WEG!!"} } switch -- [rand 6] { 1 {set posttext "wer will als naechstes? ;)"} 2 {set posttext "der kommt hoffentlich nich so schnell wieder.. ;)"} 3 {set posttext "hoffentlich sehen wir ${who} nie wieder.. ;)"} 4 {set posttext "${who} hat den channel verlassen.. ;)"} 5 {set posttext "$who entsorgt! ;)"} default {set posttext "noch jemand? ;)"} } switch -- [rand 4] { 1 {set posttext2 "$who hat den Channel verlassen.."} default {set posttext2 "$who entsorgt! ;)"} } putserv "PRIVMSG $chan :$pretext" if {[nick2hand $who]=="BerlinChat"} { putcmdlog "Hausverbot WebChat $who" set ban $who!*@* utimer 1 [list putserv "MODE $chan -ov+b $who $who $ban"] putcmdlog "MODE $chan -ov+b $who $who $ban" putcmdlog "bind raw311" bind raw - 311 chk:raw311 utimer 15 [list unbind:raw311] if {![string eq -noc fishbot $who]} {utimer 1 [list putserv "WHOIS $who"]} if {$reason==""} { utimer 3 [list putserv "KICK $chan $who :$kicktext"] utimer 5 [list newchanban $chan $ban $nick "$kicktext" 180] } { utimer 3 [list putserv "KICK $chan $who :$kicktext $reason"] utimer 5 [list newchanban $chan $ban $nick "$kicktext $reason" 180] } utimer 7 [list putserv "PRIVMSG $chan :$posttext"] } else { #set ban [getchanhost $who $chan] #set ban [maskhost "$who!*$ban"] if {[getchanhost $who $chan]!="" && [getchanhost $who $chan]!="*"} { set ban [maskhost "$who!*[lindex [split [getchanhost $who $chan] @] 0]@*[lindex [split [getchanhost $who $chan] @] 1]"] set ban2 *$who*!*@*[lindex [split [getchanhost $who $chan] @] 1] } else { set ban $who!*@* set ban2 "" } set ban3 ""; if {[string match -nocase *.users.quakenet.org [getchanhost $who $chan]]} { set ban3 *!*@[lindex [split [getchanhost $who $chan] @] 1] } utimer 1 [list putserv "MODE $chan -ov+bbb $who $who $ban $ban2 $ban3"] if {$reason==""} { utimer 5 [list putserv "KICK $chan $who :$kicktext"] utimer 11 [list newchanban $chan $ban $nick "$kicktext" 180] if {$ban2!=""} { utimer 11 [list newchanban $chan $ban2 $nick "$kicktext" 180] } if {$ban3!=""} { utimer 11 [list newchanban $chan $ban3 $nick "$kicktext" 180] } } { utimer 5 [list putserv "KICK $chan $who :$kicktext $reason"] utimer 11 [list newchanban $chan $ban $nick "$kicktext $reason" 180] if {$ban2!=""} { utimer 11 [list newchanban $chan $ban2 $nick "$kicktext $reason" 180] } if {$ban3!=""} { utimer 11 [list newchanban $chan $ban3 $nick "$kicktext" 180] } } utimer 7 [list putserv "PRIVMSG $chan :$posttext"] } } proc do_idiot {nick uhost hand chan text} { putlog "DU IDIOT: $nick!$uhost ($hand) $chan $text" global botnick if {$chan != "#berlin" && $chan != "#berlin.intern"} {putlog "wrong channel"; return 0} if {[isvoice $nick $chan] == 0} {putlog "$nick is not voice"; return 0} set who [lindex [split $text] 0] if {![cyonchan $who $chan]} { putnotc $nick "$who is nicht in $chan .." return } set reason ""; set reason [join [lrange [split $text] 1 end]] if {[string tolower $who] == [string tolower $botnick]} {putlog "its me"; return 0} if {[isvoice $who $chan] == 1} {putlog "$who is voice"; return 0} set ban [maskhost "$who!*[lindex [split [getchanhost $who $chan] @] 0]@*[lindex [split [getchanhost $who $chan] @] 1]"] set ban2 *$who*!*@*[lindex [split [getchanhost $who $chan] @] 1] set ban3 ""; if {[string match -nocase *.users.quakenet.org [getchanhost $who $chan]]} { set ban3 *!*@[lindex [split [getchanhost $who $chan] @] 1] } if {$reason==""} { putserv "KICK $chan $who :DU IDIOT!"] } { putserv "KICK $chan $who :DU IDIOT! $reason"] } addhost idiot $ban; timer 1440 [list delhost idiot $ban] addhost idiot $ban2; timer 1440 [list delhost idiot $ban2] if {$ban3!=""} { addhost idiot $ban3; timer 20160 [list delhost idiot $ban3] } }