/[cvs]/eggdrop1.6/scripts/weed
ViewVC logotype

Annotation of /eggdrop1.6/scripts/weed

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (hide annotations) (download)
Tue Oct 26 21:38:36 1999 UTC (19 years, 8 months ago) by fabian
Branch: MAIN
Changes since 1.3: +19 -10 lines
resync 940380771-940924890

1 fabian 1.3 #! /bin/sh
2     # ^-- little trick to restart using tclsh \
3     exec tclsh "$0" "$@"
4 segfault 1.1 #
5     # weed out certain undesirables from an eggdrop userlist
6     # try just typing 'tclsh weed' to find out the options
7     # Robey Pointer, november 1994
8     #
9     # <cmwagner@gate.net>:
10     # I did a few bug fixes to the original weed script, things changed...
11     #
12     # when specifying other weed options they would unset the User() field and
13     # a maxlast weed would try and weed again and cause the script to stop due
14     # to User() being already unset (array nonexistant)
15     #
16     # when loadUserFile encountered an xtra field it would try and use the $info
17     # variable, which was supposed to be $xtra (something overlooked when the
18     # line was cut and pasted -- I hate it when that happens)
19     #
20     # changed the formatting of the saved weed file to match more closely to
21     # eggdrop 0.9tp (so this may cause incompatibilities), but when a hostmask
22     # field exactly matched 40 characters it would save it with no spaces after
23     # it and eggdrop would reject the user record. I know I could have easily
24     # changed one character, but I couldn't help myself. <grin>
25 fabian 1.4 # 5 march 1996
26 segfault 1.1 #
27 fabian 1.4 # <robey, 23jul1996>:
28 segfault 1.1 # upgrade for v2 userfiles
29 fabian 1.4 # <bruce s, 04sep1996>:
30 segfault 1.1 # fixed xtra field from getting truncated
31 fabian 1.4 # <robey, 20sep1996>:
32 segfault 1.1 # stopped it from mangling channel ban lists
33 fabian 1.4 # <Ec|ipse & dtM, 10jun1997>:
34 segfault 1.1 # upgrade for v3 userfiles
35 fabian 1.4 # <Ec|ipse 18jun1997>:
36 segfault 1.1 # added an option to remove users from unwanted channels
37 fabian 1.4 # <Ec|ipse 28oct1997>:
38 segfault 1.1 # upgrade for v4 userfiles, with v3 converter
39 fabian 1.4 # <Ernst 8mar1998>:
40 segfault 1.1 # fixed bug "list element in braces followed by X instead of space"
41     # (the use of "lrange" where you aren't sure if it's a list is bad)
42     # fixed --CONSOLE item not being included, creating "user" --CONSOLE
43 fabian 1.4 # <Ernst 1apr1998>:
44 segfault 1.1 # two more improper ocurrences of "lrange" removed
45 fabian 1.2 # <rtc 20sep1999>:
46     # removed ancient way of determining the current time.
47 fabian 1.4 # <Tothwolf 21oct1999
48     # [clock] isn't in all versions of Tcl...
49 segfault 1.1 #
50    
51     set exempt {*ban *ignore}
52     set exemptops 0 ; set exemptmasters 0 ; set exemptfriends 0
53     set exemptparty 0 ; set exemptfile 0 ; set exemptchanm 0
54     set exemptbotm 0 ; set exemptchann 0 ; set exemptchanf 0
55     set exemptchano 0
56     set maxlast 0 ; set maxban 0 ; set maxignore 0
57     set weedops 0 ; set weedmasters 0 ; set weednopw 0
58     set stripops 0 ; set stripmasters 0 ; set weedlurkers 0
59     set chanrem {}
60     set convert 0
61    
62 fabian 1.4 if {![string compare "" [info commands clock]]} then {
63     set fd [open "/tmp/egg.timer." w]
64     close $fd
65     set CURRENT [file atime "/tmp/egg.timer."]
66     exec rm -f /tmp/egg.timer.
67     } else {
68     set CURRENT [clock seconds]
69     }
70 segfault 1.1
71     if {$argc < 1} {
72     puts stdout "\nUsage: weed <userfile> \[options\]"
73     puts stdout " (weeds out users from an eggdrop userlist)"
74     puts stdout "Output goes to <userfile>.weed"
75     puts stdout "Possible options:"
76     puts stdout " -<nick> exempt this user from weeding"
77     puts stdout " ^o ^m ^f exempt ops or masters or friends"
78     puts stdout " ^co ^cm ^cf exempt chanops or chanmasters or chanfriends"
79     puts stdout " ^cn exempt chanowner"
80     puts stdout " ^p ^x exempt party-line or file-area users"
81     puts stdout " ^b exempt botnet master"
82     puts stdout " +<days> weed: haven't been seen in N days"
83     puts stdout " :n weed: haven't EVER been seen"
84     puts stdout " :o :m weed: ops or masters with no password set"
85     puts stdout " :a weed: anyone with no pasword set"
86     puts stdout " o m unop/unmaster: ops or masters with no pass."
87     puts stdout " b<days> weed: bans not used in N days"
88     puts stdout " i<days> weed: ignores created over N days ago"
89     puts stdout " =<chan> weed: channels nolonger supported"
90     puts stdout " c convert v3 eggdrop userfile"
91     puts stdout ""
92     exit
93     }
94     puts stdout "\nWEED 18jun97, robey\n"
95    
96     set filename [lindex $argv 0]
97     for {set i 1} {$i < $argc} {incr i} {
98     set carg [lindex $argv $i]
99     if {$carg == ":n"} {
100     set weedlurkers 1
101     } elseif {$carg == ":o"} {
102     set weedops 1 ; set stripops 0 ; set weednopw 0
103     } elseif {$carg == ":m"} {
104     set weedmasters 1 ; set stripmasters 0 ; set weednopw 0
105     } elseif {$carg == ":a"} {
106     set weednopw 1 ; set weedops 0 ; set weedmasters 0
107     set stripops 0 ; set stripmasters 0
108     } elseif {$carg == "o"} {
109     set stripops 1 ; set weedops 0 ; set weednopw 0
110     } elseif {$carg == "m"} {
111     set stripmasters 1 ; set weedmasters 0 ; set weednopw 0
112     } elseif {$carg == "^m"} {
113     set exemptmasters 1
114     } elseif {$carg == "^o"} {
115     set exemptops 1
116     } elseif {$carg == "^f"} {
117     set exemptfriends 1
118     } elseif {$carg == "^p"} {
119     set exemptparty 1
120     } elseif {$carg == "^x"} {
121     set exemptfile 1
122     } elseif {$carg == "^cf"} {
123     set exemptchanf 1
124     } elseif {$carg == "^cm"} {
125     set exemptchanm 1
126     } elseif {$carg == "^cn"} {
127     set exemptchann 1
128     } elseif {$carg == "^b"} {
129     set exemptbotm 1
130     } elseif {$carg == "^co"} {
131     set exemptchano 1
132     } elseif {$carg == "c"} {
133     set convert 1
134     } elseif {[string index $carg 0] == "-"} {
135     lappend exempt [string range $carg 1 end]
136     } elseif {[string index $carg 0] == "+"} {
137     set maxlast [expr 60*60*24* [string range $carg 1 end]]
138     } elseif {[string index $carg 0] == "b"} {
139     set maxban [expr 60*60*24* [string range $carg 1 end]]
140     } elseif {[string index $carg 0] == "i"} {
141     set maxignore [expr 60*60*24* [string range $carg 1 end]]
142     } elseif {[string index $carg 0] == "="} {
143     lappend chanrem [string tolower [string range $carg 1 end]]
144     } else {
145     puts stderr "UNKNOWN OPTION: '$carg'\n"
146     exit
147     }
148     }
149    
150     if {(!$weedlurkers) && (!$weedops) && (!$weedmasters) && (!$weednopw) &&
151     (!$stripops) && (!$stripmasters) && ($maxlast == 0) && ($convert == 0) &&
152     ($maxban == 0) && ($maxignore == 0) && ($chanrem == {})} {
153     puts stderr "PROBLEM: You didn't specify anything to weed out.\n"
154     exit
155     }
156    
157     set weeding { } ; set strip { } ; set exempting { }
158     if {$weedlurkers} { lappend weeding "lurkers" }
159     if {$weedops} { lappend weeding "pwdless-ops" }
160     if {$weedmasters} { lappend weeding "pwdless-masters" }
161     if {$weednopw} { lappend weeding "pwdless-users" }
162     if {$chanrem != {}} { lappend weeding "unwanted-channel" }
163     if {$maxlast > 0} { lappend weeding ">[expr $maxlast /(60*60*24)]-days" }
164     if {$maxban > 0} { lappend weeding "bans>[expr $maxban /(60*60*24)]-days" }
165     if {$maxignore > 0} { lappend weeding "ign>[expr $maxignore /(60*60*24)]-days" }
166     if {$weeding != { }} { puts stdout "Weeding:$weeding" }
167    
168     if {$stripops} { lappend strip "pwdless-ops" }
169     if {$stripmasters} { lappend strip "pwdless-masters" }
170     if {$strip != { }} { puts stdout "Stripping:$strip" }
171    
172     if {$exemptops} { lappend exempting "(ops)" }
173     if {$exemptmasters} { lappend exempting "(masters)" }
174     if {$exemptfriends} { lappend exempting "(friends)" }
175     if {$exemptparty} { lappend exempting "(party-line)" }
176     if {$exemptfile} { lappend exempting "(file-area)" }
177     if {$exemptchann} { lappend exempting "(channel-owners)" }
178     if {$exemptchanm} { lappend exempting "(channel-masters)" }
179     if {$exemptchano} { lappend exempting "(channel-ops)" }
180     if {$exemptchanf} { lappend exempting "(channel-friends)" }
181     if {$exemptbotm} { lappend exempting "(botnet masters)" }
182     if {[llength $exempt]>2} { lappend exempting "[lrange $exempt 2 end]" }
183     if {$exempting != { }} { puts stdout "Exempt:$exempting" }
184    
185     puts stdout "\nReading $filename ..."
186    
187     proc convertUserFile {fname} {
188     global User Hostmask Channel Botflag LastOn BotAddr Xtra convert
189     puts stdout "\nRunning Converter on $fname"
190     set oldhandle {}
191     if {[catch {set fd [open $fname r]}] != 0} { return 0 }
192     set line [string trim [gets $fd]]
193     if {[string range $line 1 2] == "3v"} {
194     set convert 1
195     } elseif {[string range $line 1 2] == "4v"} {
196     return 0
197     }
198     while {![eof $fd]} {
199     set line [string trim [gets $fd]]
200     if {([string index $line 0] != "#") && ([string length $line] > 0)} {
201     scan $line "%s" handle
202     if {$handle == "-"} {
203     # hostmask
204     set hmList [split [string range $line 2 end] ,]
205     for {set i 0} {$i < [llength $hmList]} {incr i} {
206     lappend Hostmask($oldhandle) [string trim [lindex $hmList $i]]
207     }
208     } elseif {$handle == "!"} {
209     # channel
210     set chList [string trim [string range $line 1 end]]
211     lappend Channel($oldhandle) "[lrange $chList 0 1] [string trim [lindex $chList end] 0123456789]"
212     } elseif {$handle == "*"} {
213     # dccdir
214     set dccdir [string trim [string range $line 2 end]]
215     set User($oldhandle) [lreplace $User($oldhandle) 2 2 $dccdir]
216     } elseif {$handle == "+"} {
217     # email
218     set email [string trim [string range $line 2 end]]
219     set User($oldhandle) [lreplace $User($oldhandle) 3 3 $email]
220     } elseif {$handle == "="} {
221     # comment
222     set comment [string trim [string range $line 2 end]]
223     set User($oldhandle) [lreplace $User($oldhandle) 4 4 $comment]
224     } elseif {$handle == ":"} {
225     # user info line / bot addresses
226     if {[lsearch [split [lindex $User($oldhandle) 0] ""] b] == -1} {
227     set info [string trim [string range $line 1 end]]
228     set User($oldhandle) [lreplace $User($oldhandle) 5 5 $info]
229     } else {
230     set BotAddr($oldhandle) [string trim [string range $line 1 end]]
231     }
232     } elseif {$handle == "."} {
233     # xtra field start
234     if {![info exists xtraList($oldhandle)]} {
235     set xtraList($oldhandle) [string trim [string range $line 1 end]]
236     } {
237     set xtraList($oldhandle) "$xtraList($oldhandle) [string trim [string range $line 1 end]]"
238     }
239     } elseif {$handle == "!!"} {
240     # laston
241     set LastOn($oldhandle) [lindex $line 1]
242     } else {
243     # finish up xtra field first
244     if {[info exists xtraList($oldhandle)]} {
245     for {set i 0} {$i < [llength $xtraList($oldhandle)]} {incr i} {
246     lappend Xtra($oldhandle) [string trim [lindex $xtraList($oldhandle) $i] \{]
247     }
248     }
249     # begin of new user
250     scan $line "%s %s %s %s" handle pass attr ts
251     if {$convert == 1 && $attr != ""} {
252     regsub -all {B} $attr {t} attr
253     set botflags "s h a l r" ; set Botflag($handle) ""
254     set nattr [split [string trim $attr 0123456789] ""] ; set attr ""
255     foreach flag $botflags {
256     if {[lsearch -exact $nattr $flag] != -1} {append Botflag($handle) $flag}
257     }
258     foreach flag $nattr {
259     if {[lsearch -exact $botflags $flag] == -1} {append attr $flag}
260     }
261     }
262     set User($handle) [list $attr $pass {} {} {} {}]
263     set Hostmask($handle) {}
264     set Channel($handle) {}
265     set oldhandle $handle
266     }
267     }
268     }
269     return 1
270     }
271    
272     proc loadUserFile {fname} {
273     global User Hostmask Channel Botflag LastOn BotAddr Xtra
274     set oldhandle {}
275     if {[catch {set fd [open $fname r]}] != 0} { return 0 }
276     set line [string trim [gets $fd]]
277     if {[string range $line 1 2] != "4v"} {
278     if {[string range $line 1 2] == "3v"} {
279     convertUserFile $fname
280     return 1
281     } else {
282     puts stderr "Unknown userfile version! (not v4)\n"
283     exit
284     }
285     }
286     while {![eof $fd]} {
287     set line [string trim [gets $fd]]
288     if {([string index $line 0] != "#") && ([string length $line] > 0)} {
289     scan $line "%s" handle
290     if {$handle == "--HOSTS"} {
291     # hostmask
292     set hmList [lindex $line 1]
293     lappend Hostmask($oldhandle) [string trim $hmList]
294     } elseif {$handle == "-"} {
295     # hostmask
296     set hmList [lindex $line 1]
297     lappend Hostmask($oldhandle) [string trim $hmList]
298     } elseif {$handle == "!"} {
299     # channel
300     set chList [string trim [string range $line 1 end]]
301     lappend Channel($oldhandle) $chList
302     } elseif {$handle == "--BOTADDR"} {
303     # botaddr
304     set BotAddr($oldhandle) [lindex $line 1]
305     } elseif {$handle == "--PASS"} {
306     # pass
307     set pass [string trim [string range $line [expr [string first " " $line] + 1] end]]
308     set User($oldhandle) [lreplace $User($oldhandle) 1 1 $pass]
309     } elseif {$handle == "--DCCDIR"} {
310     # dccdir
311     set first [string first " " $line]
312     if {$first != -1} {
313     set dccdir [string trim [string range $line [expr $first + 1] end]]
314     } {
315     set dccdir ""
316     }
317     set User($oldhandle) [lreplace $User($oldhandle) 2 2 $dccdir]
318     } elseif {$handle == "--COMMENT"} {
319     # comment
320     set first [string first " " $line]
321     if {$first != -1} {
322     set comment [string trim [string range $line [expr $first + 1] end]]
323     } {
324     set comment ""
325     }
326     set User($oldhandle) [lreplace $User($oldhandle) 4 4 $comment]
327     } elseif {$handle == "--INFO"} {
328     # user info line
329     set first [string first " " $line]
330     if {$first != -1} {
331     set info [string trim [string range $line [expr $first + 1] end]]
332     } {
333     set info ""
334     }
335     set User($oldhandle) [lreplace $User($oldhandle) 5 5 $info]
336     } elseif {$handle == "--CONSOLE"} {
337     # console
338     set first [string first " " $line]
339     if {$first != -1} {
340     set console [string trim [string range $line [expr $first + 1] end]]
341     } {
342     set console ""
343     }
344     set User($oldhandle) [lreplace $User($oldhandle) 6 6 $console]
345     } elseif {$handle == "--XTRA"} {
346     # xtra field
347     set first [string first " " $line]
348     if {$first != -1} {
349     set xtraList [string trim [string range $line [expr $first + 1] end]]
350     } {
351     set xtraList ""
352     }
353     lappend Xtra($oldhandle) $xtraList
354     } elseif {$handle == "--LASTON"} {
355     # laston
356     set LastOn($oldhandle) [lindex $line 1]
357     } elseif {$handle == "--BOTFL"} {
358     # botflags
359     set Botflag($oldhandle) [string trim [string range $line 1 end]]
360     } else {
361     # begin of new user
362     scan $line "%s %s %s" handle dash attr
363     set User($handle) [list $attr {} {} {} {} {} {}]
364     set Hostmask($handle) {}
365     set Channel($handle) {}
366     set oldhandle $handle
367     }
368     }
369     }
370     return 1
371     }
372    
373     proc saveUserFile fname {
374     global User Hostmask Channel Botflag LastOn BotAddr Xtra
375     if {[catch {set fd [open $fname w]}] != 0} { return 0 }
376     puts $fd "#4v: weed! now go away."
377     foreach i [array names User] {
378     set hmask "none"
379     set hmloop 0 ; set chloop 0 ; set loloop 0 ; set xloop 0 ; set aloop 0
380     if {[lindex $User($i) 1] == "bans"} {set plug "bans"} {set plug "-"}
381     set attr [lindex $User($i) 0]
382     set ts [lindex $User($i) 2]
383     puts $fd [format "%-9s %-20s %-24s" $i $plug $attr]
384     for {} {$hmloop < [llength $Hostmask($i)]} {incr hmloop} {
385     if {[string index $i 0] == "*" || [string range $i 0 1] == "::"} {
386     set hmask [lindex $Hostmask($i) $hmloop]
387     regsub -all {~} $hmask { } hmask
388     puts $fd "- $hmask"
389     } else {
390     puts $fd "--HOSTS [lindex $Hostmask($i) $hmloop]"
391     }
392     }
393     if {[info exists BotAddr($i)]} {
394     puts $fd "--BOTADDR [lindex $BotAddr($i) 0]"
395     }
396     if {[info exists Xtra($i)]} {
397     for {} {$xloop < [llength $Xtra($i)]} {incr xloop} {
398     puts $fd "--XTRA [lindex $Xtra($i) $xloop]"
399     }
400     }
401     if {[info exists Channel($i)]} {
402     for {} {$chloop < [llength $Channel($i)]} {incr chloop} {
403     puts $fd "! [lindex $Channel($i) $chloop]"
404     }
405     }
406     if {[info exists Botflag($i)]} {
407     if {$Botflag($i) != ""} { puts $fd "--BOTFL [lindex $Botflag($i) 0]" }
408     }
409     if {[string index $i 0] == "*" || [string range $i 0 1] == "::"} {
410     set User($i) [lreplace $User($i) 1 1 {}]
411     }
412     if {[lindex $User($i) 1] != {}} { puts $fd "--PASS [lindex $User($i) 1]" }
413     if {[lindex $User($i) 2] != {}} { puts $fd "--DCCDIR [lindex $User($i) 2]" }
414     if {[lindex $User($i) 3] != {}} { puts $fd "--XTRA EMAIL [lindex $User($i) 3]" }
415     if {[lindex $User($i) 4] != {}} { puts $fd "--COMMENT [lindex $User($i) 4]" }
416     if {[lindex $User($i) 5] != {}} { puts $fd "--INFO [lindex $User($i) 5]" }
417     if {[lindex $User($i) 6] != {}} { puts $fd "--CONSOLE [lindex $User($i) 6]" }
418     if {[info exists LastOn($i)]} {
419     puts $fd "--LASTON [lindex $LastOn($i) 0]"
420     }
421     }
422     close $fd
423     return 1
424     }
425    
426     if {![loadUserFile $filename]} {
427     puts stdout "* Couldn't load userfile!\n"
428     exit
429     }
430    
431     if {$convert == 0} {
432     puts stdout "Loaded. Weeding..."
433     puts stdout "(pwd = no pass, -o/-m = removed op/master, lrk = never seen, exp = expired)"
434     puts stdout "(uwc = unwanted channel)\n"
435     } else {
436     puts stdout "Loaded. Converting..."
437     }
438    
439     set total 0
440     set weeded 0
441     foreach i [array names User] {
442     incr total
443     set attr [lindex $User($i) 0]
444     set chanattr [lindex [lindex $Channel($i) 0] 2]
445     if {([lsearch -exact $exempt $i] == -1) &&
446     ([string range $i 0 1] != "::") &&
447     ([string range $i 0 1] != "--") &&
448     (([string first o $attr] == -1) || (!$exemptops)) &&
449     (([string first m $attr] == -1) || (!$exemptmasters)) &&
450     (([string first f $attr] == -1) || (!$exemptfriends)) &&
451     (([string first p $attr] == -1) || (!$exemptparty)) &&
452     (([string first x $attr] == -1) || (!$exemptfile)) &&
453     (([string first t $attr] == -1) || (!$exemptbotm)) &&
454     (([string first f $chanattr] == -1) || (!$exemptchanf)) &&
455     (([string first m $chanattr] == -1) || (!$exemptchanm)) &&
456     (([string first n $chanattr] == -1) || (!$exemptchann)) &&
457     (([string first o $chanattr] == -1) || (!$exemptchano))} {
458     set pass [lindex $User($i) 1]
459     if {[info exists LastOn($i)]} { set ts [lindex $LastOn($i) 0] } { set ts 0 }
460     if {([string compare $pass "-"] == 0) && ([string first b $attr] == -1)} {
461     if {$weednopw == 1} {
462     unset User($i) ; incr weeded
463     puts -nonewline stdout "[format "pwd: %-10s " $i]"
464     } elseif {([string first o $attr] != -1) && ($weedops == 1)} {
465     unset User($i) ; incr weeded
466     puts -nonewline stdout "[format "pwd: %-10s " $i]"
467     } elseif {([string first m $attr] != -1) && ($weedmasters == 1)} {
468     unset User($i) ; incr weeded
469     puts -nonewline stdout "[format "pwd: %-10s " $i]"
470     }
471     if {([string first o $attr] != -1) && ($stripops == 1)} {
472     set nattr {}
473     for {set x 0} {$x < [string length $attr]} {incr x} {
474     if {[string index $attr $x] != "o"} {
475     set nattr [format "%s%s" $nattr [string index $attr $x]]
476     }
477     }
478     if {$nattr == {}} { set nattr "-" }
479     set User($i) [lreplace $User($i) 0 0 $nattr]
480     puts -nonewline stdout "[format " -o: %-10s " $i]"
481     }
482     if {([string first m $attr] != -1) && ($stripmasters == 1)} {
483     set nattr {}
484     for {set x 0} {$x < [string length $attr]} {incr x} {
485     if {[string index $attr $x] != "m"} {
486     set nattr [format "%s%s" $nattr [string index $attr $x]]
487     }
488     }
489     if {$nattr == {}} { set nattr "-" }
490     set User($i) [lreplace $User($i) 0 0 $nattr]
491     puts -nonewline stdout "[format " -m: %-10s " $i]"
492     }
493     }
494     if {($ts==0) && ($weedlurkers==1) && ([string first b $attr] == -1) && [info exists User($i)]} {
495     unset User($i) ; incr weeded
496     puts -nonewline stdout "[format "lrk: %-10s " $i]"
497     }
498     if {($ts > 0) && ($maxlast > 0) && ($CURRENT-$ts > $maxlast && [info exists User($i)])} {
499     unset User($i) ; incr weeded
500     puts -nonewline stdout "[format "exp: %-10s " $i]"
501     }
502     if {$chanrem != {} && [info exists Channel($i)]} {
503     foreach unchan $chanrem {
504     set id [lsearch [string tolower $Channel($i)] *$unchan*]
505     if {$id != -1} {
506     set Channel($i) [lreplace $Channel($i) $id $id] ; incr weeded
507     puts -nonewline stdout "[format "uwc: %-10s " $i]"
508     }
509     }
510     }
511     }
512     flush stdout
513     }
514     if {$weeded == 0 && $convert == 0} { puts -nonewline stdout "uNF... Nothing to weed!" }
515     puts stdout "\n"
516    
517     foreach i [array names User] {
518     if {([string range $i 0 1] == "::") || ($i == "*ban")} {
519     for {set j 0} {$j < [llength $Hostmask($i)]} {incr j} {
520     set ban [split [lindex $Hostmask($i) $j] :]
521     if {[string range [lindex $ban 2] 0 0] == "+"} {
522     set lastused [lindex $ban 3]
523     if {($maxban > 0) && ($CURRENT-$lastused > $maxban)} {
524     if {$i == "*ban"} {
525     puts stdout "Expired ban: [lindex $ban 0]"
526     } {
527     puts stdout "Expired ban on [string range $i 2 end]: [lindex $ban 0]"
528     }
529     set Hostmask($i) [lreplace $Hostmask($i) $j $j]
530     incr j -1
531     }
532     }
533     }
534     }
535     if {$i == "*ignore"} {
536     for {set j 0} {$j < [llength $Hostmask($i)]} {incr j} {
537     set ign [split [lindex $Hostmask($i) $j] :]
538     set lastused [lindex $ign 3]
539     if {($maxignore > 0) && ($CURRENT-$lastused > $maxignore)} {
540     puts stdout "Expired ignore: [lindex $ign 0]"
541     set Hostmask($i) [lreplace $Hostmask($i) $j $j]
542     incr j -1
543     }
544     }
545     }
546     }
547    
548     puts stdout "\nFinished scan."
549     puts stdout "Original total ($total), new total ([expr $total-$weeded]), zapped ($weeded)"
550    
551     if {![saveUserFile $filename.weed]} {
552     puts stdout "* uNF... Couldn't save new userfile!\n"
553     exit
554     }
555     puts stdout "Wrote $filename.weed"

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23