proc join_proc { nick uhost handle chan } { global method nn_db domains_db idents_db bn_db bc_db ##BEGIN NEW STYLE METAKIT## # test database #mk::file open db test.mk #set vw [mk::view layout db.test {test:I}] #mk::row append $vw test 1 #mk::row append $vw test 2 #mk::file commit db #mk::file close db # real database #mk::file open ds domain-stats.mk if {[catch {mk::file open ds domain-stats.mk} temp]} { foreach l [split $::errorInfo \n] { putquick "PRIVMSG $nick :trace - $l" } mk::file close ds } elseif {!$temp} { putlog ">> 1" } else { putlog ">> 2" } # fields currently in use: # id, nickname, username (user@), idented, domain (@domain), valid, # botnet, controler, ip, longip # id: The unique ID for each entry, this keeps each entry # unique while allowing the same nick to be tracked with # different usernames, domain names, networks, chans, # and dates. # This will allow for global profiling of compiled data # nickname: The nickname on the irc server. # username: The ident username (part before the @). # idented: Is the username idented or not? simple 0/1 field. # domain: The domain (or maybe IP) of the user # (part after the @). # ip: The IPv4 (or IPv6) address of the domain. # This will not be looked up during the join event. It # will be processed as the bot has time to avoid slowing # The bot down during a clone/join flood. # longip: 32bit value of a IPv4 address. # IPv6 support will be added as soon as I can decode the # address into a base 10 number. :P # network: The network on which this nickname was seen. # chan: The channel on which this nickname was seen. # date: The unix timestamp (in seconds) of when this nick # seen. To keep the database from becoming unmanageable, # This will only be updated if the time difference # between the current join and last join is more than 1 # minute. # valid # /botnet # /controler: Simple 0/1 field, only one may be set at any given # time. If 1, this nick is of the category it is set # for. set vm [mk::view layout ds.info {id:I nickname:S username:S idented:I domain:S ip:S longip:L network:S chan:S date:S valid:I botnet:I controler:I}] set next_id [expr [mk::view size ds.info] + 1] set max_rows [mk::view size ds.info] set i 0 putlog "[list i is $i]" while {$i < $max_rows} { putlog ">>> i: $i" putlog ">>> Username: [mk::get expr ds.info!$i nickname]" incr i } #mk::file commit ds if {[catch {mk::file commit ds} temp]} { foreach l [split $::errorInfo \n] { putquick "PRIVMSG $nick :trace - $l" } } elseif {!$temp} { putlog ">> 3" } else { putlog ">> 4" } #mk::file close ds if {[catch {mk::file close ds} temp]} { foreach l [split $::errorInfo \n] { putquick "PRIVMSG $nick :trace - $l" } } elseif {!$temp} { putlog ">> 5" } else { putlog ">> 6" } ##END NEW STYLE METAKIT## ##BEGIN OLD STYLE BERKDB## # nickname stuff set dbh [berkdb open $method $nn_db] $dbh put $nick 1 $dbh close # userhost/domain stuff set user_split [split $uhost @] set user [lindex $user_split 0] set host [lindex $user_split 1] set dbh [berkdb open $method $idents_db] #putlog ">>>> Host: $host" $dbh put $user 1 $dbh close ##END OLD STYLE BERKDB## }