# ShellUptime.tcl v0.3 [07 Janvier 2002] # oranginam@oranginam.com # Tested on eggdrop 1.6.6, 1.6.7 and 1.6.8, Tcl 8.3.1, 8.3.2 and 8.3.3 # Linux 2.2.x and 2.4.x, BSD 4.3 and 4.4 #ShellUptime is a little script who display uptime of your shell # on channel # !shelluptime for all eggdrop who shelluptime is installed replies # botnet-nick !shelluptime for only this eggdrop replies # or party-line # .shelluptime #History #V0.3 # some Fix # Translate in English (french Version on www.oranginam.com) #V0.2 # some FIX # Add: Bot !shelluptime # Add .shelluptime in DCC # Not release #V0.1 # 1st Script 28 Septembre 2001 # Not release # What trigger you would use, ie: !shelluptime or @shelluptime etc ... set trigger "!shell" # Flag allows acces set upflag "U" # antiflood(ignore) 0 disable and 1 enable the flood protect. # if owner (+n) has the upflag, he is not effected by le flood protect set antiflood(ignore) 1 # antiflood(flood) After how many hits in seconds x:y make flood set antiflood(flood) 3:15 # antiflood(ignore_time) How many time user is ignored set antiflood(ignore_time) 3 ##################################################################### # Ne rien modifier en dessous sauf si vous savez ce que vous faites # ##################################################################### set ver "0.3" set antiflood(version) "ShellUptime FloodProtect 1.00 By lolomin" ######################### # Protection anti flood # ######################### proc antiflood_flood_init {} { global antiflood antiflood_flood_array ; if {![string match *:* $antiflood(flood)]} {putlog $antiflood(version): var antiflood(flood) do not correctly set ; return} set antiflood(flood_num) [lindex [split $antiflood(flood) :] 0] ; set antiflood(flood_time) [lindex [split $antiflood(flood) :] 1] ; set i [expr $antiflood(flood_num) - 1] while {$i >= 0} {set antiflood_flood_array($i) 0 ; incr i -1 ; } } ; antiflood_flood_init proc antiflood_flood {nick uhost} { if {[matchattr $nick n]} {return 0} global antiflood antiflood_flood_array ; if {$antiflood(flood_num) == 0} {return 0} ; set i [expr $antiflood(flood_num) - 1] while {$i >= 1} {set antiflood_flood_array($i) $antiflood_flood_array([expr $i - 1]) ; incr i -1} ; set antiflood_flood_array(0) [unixtime] if {[expr [unixtime] - $antiflood_flood_array([expr $antiflood(flood_num) - 1])] <= $antiflood(flood_time)} { putlog "$antiflood(version): Flood detected By $nick. Ignoring for $antiflood(ignore_time) min(s)" ; if {$antiflood(ignore)} {newignore [join [maskhost *!*[string trimleft $uhost ~]]] $antiflood(version) flood $antiflood(ignore_time)} ; putserv "PRIVMSG $nick :$antiflood(version) - Flood detectected ! ignoring for $antiflood(ignore_time) min(s) !!" ; return 1 } {return 0} } ############### # SHELLUPTIME # ############### #Public Commande bind pub $upflag ${trigger}shelluptime pub:shelluptime bind pubm $upflag "*${botnet-nick} ${trigger}shelluptime*" pub:shelluptime proc shelluptime2 { } { if {[catch {exec uptime} uptime]} { set uptime "Uptime non disponible." } if {[catch {exec uname -s} machine]} { set machine [unames] } if {[catch {exec hostname} hostname]} { set hostname [info hostname] } return "Uptime for $hostname ($machine): is $uptime" } proc pub:shelluptime { nick host hand chan arg } { if {[antiflood_flood $nick $host]} {return 0} putserv "PRIVMSG $chan :[shelluptime2]" } #DCC commande bind dcc $upflag shelluptime dcc:dccshell proc dcc:dccshell { hand idx arg } { putdcc $idx "[shelluptime2]" } putlog "ShellUptime.tcl v$ver by Oranginam loaded !!!" putlog " => $antiflood(version) "