download alltools.tcl
Language: Tcl
LOC: 204
Project Info
xbot4 - The version of X-Bot to supercede ... 2003(xbot4)
Server: Google
Type: svn
...\bin\Debug\xTclLib\scripts\
   _BotnetStats1.9.desc
   _cutetopics100.desc
   _dict109.desc
   _entity92.desc
   _hangman101.desc
   _infobottcl.desc
   _jesusbot1.0.desc
   _jIRCserv-0.02n.desc
   _Lusers.desc
   _mp3list100.desc
   _MsgLog1.1.desc
   _mysqlseen1.1.desc
   _newtopics.desc
   _no.spam.desc
   _quizgod.desc
   _serials100.desc
   _skool101.desc
   _Split4.1.desc
   _thehelper100.desc
   _topicmaster1.1.desc
   _trivia.desc
   _UltramodeNews10.desc
   _UndernetCS.desc
   _userquotes100.desc
   _Veed_0.2.desc
   _WebBanList1.1.desc
   _words100.desc
   _zipcodes100.desc
   abuse100.desc
   abuse100.tcl
   action.fix.desc
   action.fix.tcl
   activech100.desc
   activech100.tcl
   adbseen192.desc
   Adbseen192.tcl
   addban10-mbti.desc
   addban10-mbti.tcl
   added140.desc
   Added140.tcl
   addicted100.desc
   addicted100.tcl
   advert105.desc
   advert105.tcl
   alice120.desc
   alice120.tcl
   alltools.desc
   alltools.tcl
   antiidle-narf-0.3.desc
   antiidle-narf-0.3.tcl
   auth103.desc
   auth103.tcl
   autolimit102.desc
   autolimit102.tcl
   autooper.desc
   autooper.tcl
   av.pubmsg.desc
   av.pubmsg.tcl
   bancheck.desc
   bancheck.tcl
   BanCount1.1.desc
   BanCount1.1.tcl
   BanTools1.2.desc
   BanTools1.2.tcl
   bitchxirix.desc
   bitchxirix.tcl
   bot-solutions.3.0.desc
   bot-solutions.3.0.tcl
   botping.desc
   botping.tcl
   bwscript20.desc
   bwscript20.tcl
   chancheck100.desc
   chancheck100.tcl
   ChanMax1.2.desc
   ChanMax1.2.tcl
   ChanPeak1.3.desc
   ChanPeak1.3.tcl
   chanrelay.desc
   chanrelay.tcl
   ClanAvail1.4.desc
   ClanAvail1.4.tcl
   ClanBase1.1.desc
   ClanBase1.1.tcl
   cmd_resolve.desc
   cmd_resolve.tcl
   compat.desc
   compat.tcl
   CopyVoice1.3.desc
   CopyVoice1.3.tcl
   cracks100.desc
   cracks100.tcl
   DALnetNews1.1.desc
   DALnetNews1.1.tcl
   date1.3.desc
   date1.3.tcl
   DateToDay1.0.desc
   DateToDay1.0.tcl
   daystill102.desc
   daystill102.tcl
   dccwatch104.desc
   dccwatch104.tcl
   Decide1.2.desc
   Decide1.2.tcl
   decide100.desc
   decide100.tcl
   define.desc
   define.tcl
   delhost1.01.desc
   delhost1.01.tcl
   delivery101.desc
   delivery101.tcl
   Dictionary1.1.desc
   Dictionary1.1.tcl
   DieAuth2.1.desc
   DieAuth2.1.tcl
   Dns2.5.desc
   Dns2.5.tcl
   DomainWhois1.2.desc
   DomainWhois1.2.tcl
   EFnetNews1.1.desc
   EFnetNews1.1.tcl
   egg-fu.1.7.desc
   egg-fu.1.7.tcl
   eggpad.desc
   eggpad.tcl
   englishonly102.desc
   englishonly102.tcl
   filerelay0.4.desc
   filerelay0.4.tcl
   fluxlearn1.5a.desc
   fluxlearn1.5a.tcl
   flyby101.desc
   flyby101.tcl
   gamble100.desc
   gamble100.tcl
   gamestar1.4.desc
   gamestar1.4.tcl
   GBan1.4.desc
   GBan1.4.tcl
   getops-2.6.desc
   getops-2.6.tcl
   getops.desc
   getops.tcl
   greeter101.desc
   greeter101.tcl
   guard101.desc
   guard101.tcl
   heise1.4.desc
   heise1.4.tcl
   HostSpy1.8.desc
   HostSpy1.8.tcl
   HostTools1.5.desc
   HostTools1.5.tcl
   HTMLOpVote2.0.desc
   HTMLOpVote2.0.tcl
   ident.desc
   ident.tcl
   ieXbeta1.1.desc
   ieXbeta1.1.tcl
   ilc100.desc
   ilc100.tcl
   infoegg-v1-3.desc
   infoegg-v1-3.tcl
   insult101.desc
   insult101.tcl
   inv.desc
   inv.tcl
   irco-fuckem.desc
   irco-fuckem.tcl
   irco-muh.desc
   irco-muh.tcl
   irco-psybnc.desc
   irco-psybnc.tcl
   irco-scanport.desc
   irco-scanport.tcl
   irco-soundkick.desc
   irco-soundkick.tcl
   irco-wingateban.desc
   irco-wingateban.tcl
   kick100.desc
   kick100.tcl
   kickad100.desc
   kickad100.tcl
   KillLog2.5.desc
   KillLog2.5.tcl
   klined.desc
   klined.tcl
   lamer.desc
   lamer.tcl
   lanparty.desc
   lanparty.tcl
   limit-v1.1.desc
   limit-v1.1.tcl
   limitchan.desc
   limitchan.tcl
   LinkedBots1.2.desc
   LinkedBots1.2.tcl
   maxvisitors101.desc
   maxvisitors101.tcl
   mc.banchan.desc
   mc.banchan.tcl
   mc.spamcheck.desc
   mc.spamcheck.tcl
   megadeth100.desc
   megadeth100.tcl
   mIRCShitlist1.2.desc
   mIRCShitlist1.2.tcl
   moi.desc
   moi.tcl
   netlink107.desc
   netlink107.tcl
   NetStats1.2.desc
   NetStats1.2.tcl
   news.desc
   news.tcl
   news2html.desc
   news2html.tcl
   NoAccess1.1.desc
   NoAccess1.1.tcl
   noads108.desc
   noads108.tcl
   noawayactions1.03.desc
   noawayactions1.03.tcl
   NoColors1.2.desc
   NoColors1.2.tcl
   nocomics100.desc
   nocomics100.tcl
   NoFservs1.5.desc
   NoFservs1.5.tcl
   nosense2.desc
   nosense2.tcl
   notes2.desc
   notes2.tcl
   NoTriggers2.3.desc
   NoTriggers2.3.tcl
   oannouce100.desc
   oannouce100.tcl
   ok1.3.desc
   ok1.3.tcl
   opbegger103.desc
   opbegger103.tcl
   opkillsnn.desc
   opkillsnn.tcl
   OpNotice1.9.desc
   OpNotice1.9.tcl
   pa-trgt3_68.desc
   pa-trgt3_68.tcl
   passgen.desc
   passgen.tcl
   pcgames.desc
   pcgames.tcl
   pickakick102.desc
   pickakick102.tcl
   PortCheck2.2.desc
   PortCheck2.2.tcl
   postal101.desc
   postal101.tcl
   Pub.desc
   Pub.tcl
   pwf.desc
   pwf.tcl
   ques5.desc
   ques5.tcl
   ran.desc
   ran.tcl
   RandRead1.1.desc
   RandRead1.1.tcl
   randtopic2.04.desc
   randtopic2.04.tcl
   recruiters100.desc
   recruiters100.tcl
   released102.desc
   released102.tcl
   SearchPage.desc
   SearchPage.tcl
   sentinel.desc
   sentinel.tcl
   Services2.0.desc
   Services2.0.tcl
   sharereactor1.0.desc
   sharereactor1.0.tcl
   ShellTime1.6.desc
   ShellTime1.6.tcl
   ShellUptime1.0.desc
   ShellUptime1.0.tcl
   shortnews.desc
   shortnews.tcl
   showchans104.desc
   showchans104.tcl
   sound_dos-0.02a.desc
   sound_dos-0.02a.tcl
   Spod.desc
   Spod.tcl
   spymsg.desc
   spymsg.tcl
   StockQuote.desc
   StockQuote.tcl
   striptease104.desc
   striptease104.tcl
   SubChan2.0.desc
   SubChan2.0.tcl
   superbitch0.45.desc
   superbitch0.45.tcl
   sync1.2.desc
   sync1.2.tcl
   tan101.desc
   tan101.tcl
   tempc100.desc
   tempc100.tcl
   textsearch0.2.desc
   textsearch0.2.tcl
   TimeIdent1.0.desc
   TimeIdent1.0.tcl
   TimeMessage1.0.desc
   TimeMessage1.0.tcl
   TimeRehash1.0.desc
   TimeRehash1.0.tcl
   tool-lyrics.desc
   tool-lyrics.tcl
   top10.desc
   top10.tcl
   topiclock2.04.desc
   topiclock2.04.tcl
   topiclogger1.01.desc
   topiclogger1.01.tcl
   ucsx0.2.desc
   ucsx0.2.tcl
   uptime1.08.desc
   uptime1.08.tcl
   UrlGet1.4.desc
   UrlGet1.4.tcl
   userinfo.desc
   userinfo.tcl
   VerboseMail1.1.desc
   VerboseMail1.1.tcl
   Voice1.1.desc
   Voice1.1.tcl
   voiceallbut102.desc
   voiceallbut102.tcl
   voicebitch0.1.desc
   voicebitch0.1.tcl
   VoiceFservs1.3.desc
   VoiceFservs1.3.tcl
   vote1.14.desc
   vote1.14.tcl
   warn100.desc
   warn100.tcl
   weather3.3.1.desc
   weather3.3.1.tcl
   WebSiteStatus1.0.desc
   WebSiteStatus1.0.tcl
   Whatis1.5.desc
   Whatis1.5.tcl
   Whom1.0.desc
   Whom1.0.tcl
   winfuture.desc
   winfuture.tcl
   winident1.2.desc
   winident1.2.tcl
   worldtime.desc
   worldtime.tcl
   x-commands0.1.desc
   x-commands0.1.tcl
   zdnet1.1.desc
   zdnet1.1.tcl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
#
# All-Tools TCL, includes toolbox.tcl, toolkit.tcl and moretools.tcl
# toolbox was authored by cmwagner@sodre.net
# toolkit was authored by (Someone claim this)[unknown]
# moretools was authored by David Sesno(walker@shell.pcrealm.net)
#
# TG        ?????????: modified for 1.3.0 bots
# Tothwolf  02May1999: rewritten and updated
# guppy     02May1999: updated even more
# Tothwolf  02May1999: fixed what guppy broke and updated again
# Tothwolf  24/25May1999: more changes
# rtc       20Sep1999: added isnumber, changes
# dw        20Sep1999: use regexp for isnumber checking
# Tothwolf  06Oct1999: optimized completely
# krbb      09Jun2000: added missing return to randstring
# Tothwolf  18Jun2000: added ispermowner
# Sup       02Apr2001: added matchbotattr
# Tothwolf  13Jun2001: updated/modified several commands
# Hanno     28Sep2001: fixed testip
# guppy     03Mar2002: optimized
#
# $Id: alltools.tcl,v 1.13 2002/03/04 04:27:03 guppy Exp $
#
########################################
# Descriptions of available commands:
## (toolkit):
# putmsg <nick/chan> <text>
#   send a privmsg to the given nick or channel
#
# putchan <nick/chan> <text>
#   send a privmsg to the given nick or channel
#   (for compat only, this is the same as 'putmsg' above)
#
# putnotc <nick/chan> <text>
#   send a notice to the given nick or channel
#
# putact <nick/chan> <text>
#   send an action to the given nick or channel
#
## (toolbox):
# strlwr <string>
#   string tolower
#
# strupr <string>
#   string toupper
#
# strcmp <string1> <string2>
#   string compare
#
# stricmp <string1> <string2>
#   string compare (case insensitive)
#
# strlen <string>
#   string length
#
# stridx <string> <index>
#   string index
#
# iscommand <command>
#   if the given command exists, return 1
#   else return 0
#
# timerexists <command>
#   if the given command is scheduled by a timer, return its timer id
#   else return empty string
#
# utimerexists <command>
#   if the given command is scheduled by a utimer, return its utimer id
#   else return empty string
#
# inchain <bot>
#   if the given bot is connected to the botnet, return 1
#   else return 0
#   (for compat only, same as 'islinked')
#
# randstring <length>
#   returns a random string of the given length
#
# putdccall <text>
#   send the given text to all dcc users
#
# putdccbut <idx> <text>
#   send the given text to all dcc users except for the given idx
#
# killdccall
#   kill all dcc user connections
#
# killdccbut <idx>
#   kill all dcc user connections except for the given idx
#
## (moretools):
# iso <nick> <channel>
#   if the given nick has +o access on the given channel, return 1
#   else return 0
#
# realtime [format]
#   'time' returns the current time in 24 hour format '14:15'
#   'date' returns the current date in the format '21 Dec 1994'
#   not specifying any format will return the current time in
#   12 hour format '1:15 am'
#
# testip <ip>
#   if the given ip is valid, return 1
#   else return 0
#
# number_to_number <number>
#   if the given number is between 1 and 15, return its text representation
#   else return the number given
#
## (other commands):
# isnumber <string>
#   if the given string is a valid number, return 1
#   else return 0
#
# ispermowner <handle>
#   if the given handle is a permanent owner, return 1
#   else return 0
#
# matchbotattr <bot> <flags>
#   if the given bot has all the given flags, return 1
#   else return 0
#
########################################

# So scripts can see if allt is loaded.
set alltools_loaded 1
set allt_version 204

# For backward compatibility.
set toolbox_revision 1007
set toolbox_loaded 1
set toolkit_loaded 1

#
# toolbox:
#

proc putmsg {dest text} {
  puthelp "PRIVMSG $dest :$text"
}

proc putchan {dest text} {
  puthelp "PRIVMSG $dest :$text"
}

proc putnotc {dest text} {
  puthelp "NOTICE $dest :$text"
}

proc putact {dest text} {
  puthelp "PRIVMSG $dest :\001ACTION $text\001"
}

#
# toolkit:
#

proc strlwr {string} {
  string tolower $string
}

proc strupr {string} {
  string toupper $string
}

proc strcmp {string1 string2} {
  string compare $string1 $string2
}

proc stricmp {string1 string2} {
  string compare [string tolower $string1] [string tolower $string2]
}

proc strlen {string} {
  string length $string
}

proc stridx {string index} {
  string index $string $index
}

proc iscommand {command} {
  if {[string compare "" [info commands $command]]} then {
    return 1
  }
  return 0
}

proc timerexists {command} {
  foreach i [timers] {
    if {![string compare $command [lindex $i 1]]} then {
      return [lindex $i 2]
    }
  }
  return
}

proc utimerexists {command} {
  foreach i [utimers] {
    if {![string compare $command [lindex $i 1]]} then {
      return [lindex $i 2]
    }
  }
  return
}

proc inchain {bot} {
  islinked $bot
}

proc randstring {length {chars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789}} {
  set count [string length $chars]
  for {set index 0} {$index < $length} {incr index} {
    append result [string index $chars [rand $count]]
  }
  return $result
}

proc putdccall {text} {
  foreach i [dcclist CHAT] {
    putdcc [lindex $i 0] $text
  }
}

proc putdccbut {idx text} {
  foreach i [dcclist CHAT] {
    set j [lindex $i 0]
    if {$j != $idx} then {
      putdcc $j $text
    }
  }
}

proc killdccall {} {
  foreach i [dcclist CHAT] {
    killdcc [lindex $i 0]
  }
}

proc killdccbut {idx} {
  foreach i [dcclist CHAT] {
    set j [lindex $i 0]
    if {$j != $idx} then {
      killdcc $j
    }
  }
}

#
# moretools:
#

proc iso {nick chan} {
  matchattr [nick2hand $nick $chan] o|o $chan
}

proc realtime {args} {
  switch -exact -- [lindex $args 0] {
    time {
      return [strftime %H:%M]
    }
    date {
      return [strftime "%d %b %Y"]
    }
    default {
      return [strftime "%I:%M %P"]
    }
  }
}

proc testip {ip} {
  set tmp [split $ip .]
  if {[llength $tmp] != 4} then {
    return 0
  }
  set index 0
  foreach i $tmp {
    if {(([regexp \[^0-9\] $i]) || ([string length $i] > 3) || \
         (($index == 3) && (($i > 254) || ($i < 1))) || \
         (($index <= 2) && (($i > 255) || ($i < 0))))} then {
      return 0
    }
    incr index
  }
  return 1
}

proc number_to_number {number} {
  switch -exact -- $number {
    0 {
      return Zero
    }
    1 {
      return One
    }
    2 {
      return Two
    }
    3 {
      return Three
    }
    4 {
      return Four
    }
    5 {
      return Five
    }
    6 {
      return Six
    }
    7 {
      return Seven
    }
    8 {
      return Eight
    }
    9 {
      return Nine
    }
    10 {
      return Ten
    }
    11 {
      return Eleven
    }
    12 {
      return Twelve
    }
    13 {
      return Thirteen
    }
    14 {
      return Fourteen
    }
    15 {
      return Fifteen
    }
    default {
      return $number
    }
  }
}

#
# other commands:
#

proc isnumber {string} {
  if {([string compare "" $string]) && \
      (![regexp \[^0-9\] $string])} then {
    return 1
  }
  return 0
}

proc ispermowner {hand} {
  global owner

  regsub -all -- , [string tolower $owner] "" owners
  if {([matchattr $hand n]) && \
      ([lsearch -exact $owners [string tolower $hand]] != -1)} then {
    return 1
  }
  return 0
}

proc matchbotattr {bot flags} {
  foreach flag [split $flags ""] {
    if {[lsearch -exact [split [botattr $bot] ""] $flag] == -1} then {
      return 0
    }
  }
  return 1
}

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us