set urllogfile "url.log" set urlwebfile "/home/login/public_html/urllog.html" bind pubm - *.* check_if_url bind topc - *.* check_if_url putlog "URL-catcher 1.2 by Goblet" proc isnumber {arg} { set foo 1 foreach i [split $arg {}] { if ![string match \[0-9\] $i] {set foo 0} } return $foo } proc check_if_url {nick uhost hand chan text} { global urllogfile urlwebfile botnick if {$nick != "*"} { set text [split $text " "] foreach i $text { if {([string match "*http://*" $i]) || ([string match "*ftp://*" $i]) || ([string match "*www.*" $i]) || ([string match "*ftp.*" $i])} { if {[string match "*www.*" $i] && ![string match "*http://*" $i]} { set i "http://$i" } if {[string match "*ftp.*" $i] && ![string match "*ftp://*" $i]} { set i "ftp://$i" } set hostname [lindex [split $i "/"] 2] set sane [lindex [split $hostname ":"] end] if {![isnumber $sane] && ($sane != "") && ($sane != $hostname)} { putlog "Insane URL said by $nick: ($i) illegal port $sane" return 0 } set sane [lindex [split $hostname "."] end] set sane [lindex [split $sane ":"] 0] if {[string length $sane] > 3} { putlog "Insane URL said by $nick: ($i) illegal top-level $sane" return 0 } set sane [lindex [split $hostname ":"] 0] catch {set sane3 [exec host $sane]} if {![info exists sane3]} { putlog "Adres ktory podal $nick: ($i) nieodpowiada :(." return 0 } if {([string range $i 0 3] != "http") && ([string range $i 0 2] != "ftp")} { putlog "Insane URL said by $nick: ($i) weird beginning" return 0 } set fd [open $urllogfile a+] close $fd set fd [open $urllogfile r] while {![eof $fd]} { gets $fd foo set foo [split $foo " "] if {[lindex $foo 0] == $i} { putlog "Already heard URL said by $nick" return 0 } } close $fd set fd [open $urllogfile a+] puts $fd "$i [ctime [unixtime]] $nick ($uhost)" close $fd putlog "URL detected ($nick)" set fd [open $urlwebfile w] set fd2 [open $urllogfile r] puts $fd "Zlapane adresy..." puts $fd "" puts $fd "" puts $fd "
Adresy zlapane przez bota

" puts $fd "" while {![eof $fd2]} { gets $fd2 foo regsub -all "<|>|\"" $foo "" foo set foo [split $foo " "] set foo "[lindex $foo 0]
[join [lrange $foo 1 end]]

" if {$foo != "


"} {puts $fd $foo} } puts $fd "
© " puts $fd "MoFo
" puts $fd "" close $fd close $fd2 } } } } # end