TCLDROP
Would you like to react to this message? Create an account in a few clicks or log in to continue.
TCLDROP

Eggdrop And TCL Help, Support And Chat
 
HomeHome  PublicationsPublications  FAQFAQ  SearchSearch  MemberlistMemberlist  Latest imagesLatest images  UsergroupsUsergroups  RegisterRegister  Log in  CalendarCalendar  WebsiteWebsite  ChatRoomChatRoom  

 

 lockdown.tcl

Go down 
AuthorMessage
ComputerTech
Owner
Owner
ComputerTech


Posts : 99
Points : 268
Reputation : 0
Join date : 2020-04-30

lockdown.tcl Empty
PostSubject: lockdown.tcl   lockdown.tcl Empty21/5/2020, 23:54

This is my first script needs a few repairs (not bugs) just security stuff Smile still useful clone scan anyway hehe Razz

Code:
#################################################################################################################################################################
# LockDown.tcl 2.0      Made By ComputerTech
################################################################################################################################################################
#ComputerTech
#IRC IRC.FREENODE.NET ##tcldrop
#EMAIL COMPUTERTECH312@GMAIL.COM
#GitHub  https://github.com/computertech312
#Website www.tcl3.webnode.co.uk
#Forum  www.tcldrop.forumotion.com
#################################################################################################################################################################
#Commands
#################################################################################################################################################################
#
# ?999 To Activate The LockMode
# ?999 To DeActivate The LockMode
# ?clonescan to activate kickban scan
# ?masskick  kicks everyone below the rank of "voiceV off the channel
# ?clearbans clears all channel bans
#################################################################################################################################################################
# START OF EDITING
#################################################################################################################################################################

#Here you set the maximum number of clones to which the bot will act according to the configuration

set scn(maxclone) "3"

#set the user flags needed to use this script

set flag "o|o"

# Here you set the time frame in which the bot will scan the clone channel

set scn(time) "1"

#Set here what flags the clone scan command can activate. ( .clonescan )

set scn(flags) "o|o"

#Set to 1 for kickban
#Set to 0 for notify

set scn(what) "0"

#If you set to scn (what) "1" set the reason for the kickban here.

set scn(reason) "This host% host% has exceeded the number of clones accepted on %chan%. For more info contact Operators."

#If you have set to scn (what) "1" set here the duration of the money. (minute)

set scn(btime) "30"

#set the trigger for channel lockdown mode and unlock mode

set lockmode "?999"

#set the trigger for masskick

set masstrig "?masskick"

#set the trigger of ban

set bantrig "?ban"

#set the trigger of unban

set unbantrig "?unban"

#set the max amount of bans to be clear per time (recommended to leave at 4 for safety of your bot)

set clearbans(max) 4

#set the trigger of clear channel bans

set cleartrig "?clearbans"
#################################################################################################################################################################
#END OF EDITING # NO EDTING NEEDED BELOW
#################################################################################################################################################################


bind pub ${flag} ${lockmode}  do_lock_mode
bind pub ${flag} ${lockmode} do_unlock_mode
bind pub ${flag} ${masstrig} pub:masskick
bind pub ${flag} ${bantrig} do_ban_now
bind pub ${flag} ${unbantrig} do_unban_now
bind pub ${flag} ${cleartrig} clear:bans

bind pub $scn(flags) .clonescan scanner
setudef flag clonescan



proc clear:bans {nick uhost hand chan text} {
  global clearbans
  set chan [string tolower $chan]
  if {![botisop $chan]} return
  set clearbans($chan) {}
  bind raw - 367 cb:bind:raw
  bind raw - 368 cb:bind:raw
  putserv "MODE $chan b"
}

proc cb:bind:raw {from key text} {
  global clearbans
  switch -- $key {
      367 {
        lassign [split $text] bot chan mask
        set chan [string tolower $chan]
        if {![info exists clearbans($chan)]} return
        if {[lsearch $clearbans($chan) $mask] > -1} return
        lappend clearbans($chan) $mask
      }
      368 {
        lassign [split $text] bot chan
        set chan [string tolower $chan]
        if {![info exists clearbans($chan)]} return
        unbind raw - 367 cb:bind:raw
        unbind raw - 368 cb:bind:raw
        set len [llength $clearbans($chan)]
        set total 0
        if {$len > 0} {
            while {$len > 0} {
              if {$len > $clearbans(max)} {
                  set mode [string repeat "b" $clearbans(max)]
                  set masks [join [lrange $clearbans($chan) 0 [expr {$clearbans(max) - 1}]]]
                  set clearbans($chan) [lrange $clearbans($chan) $clearbans(max) end]
                  incr len -$clearbans(max)
                  incr total $clearbans(max)
              } else {
                  set mode [string repeat "b" $len]
                  set masks [join $clearbans($chan)]
                  incr total $len
                  set len 0
              }
              puthelp "MODE $chan -$mode $masks"
            }
        } else {
            puthelp "PRIVMSG $chan :Bans list is empty."
        }
        puthelp "PRIVMSG $chan :Removed $total bans and list is now empty."
      }
  }
}

proc do_lock_mode {nick ushost handle chan text} {

   if {![botisop $chan]} {
      putserv "privmsg $chan :/<pssst!/>  I'm not op'd  "
      return 0
   }



   putserv "mode $chan +imVk ?5Q5E42Ddf42s"


}


proc do_unlock_mode {nick ushost handle chan text} {

   if {![botisop $chan]} {
      putserv "privmsg $chan :/<pssst!/>  I'm not op'd  "
      return 0
   }

   if {![isop $nick $chan]} {
      putserv "privmsg $chan :Sorry $nick, but you are not op'd in $chan right now"
      return 0
   }


   putserv "mode $chan -imVk ?5Q5E42Ddf42s"

}

proc do_ban_now { nick uhost hand chan text } {


   if {![botisop $chan]} {
      putserv "privmsg $chan :I'm Not Op'd"
      return 0
   }

   set bnick [lindex [split $text] 0 ]

   set host [getchanhost $bnick $chan]
   if {[onchan $bnick $chan]} {
      if {![isop $nick $chan]} {
      putserv "privmsg $chan :Sorry $nick,but you cant ban ops"
      return 0
   }


      pushmode $chan +b [maskhost $bnick!$host 2]
   } else {
      putserv "MODE $chan +b $bnick"

   }

}

proc do_unban_now { nick uhost hand chan text } {


   if {![botisop $chan]} {
      putserv "privmsg $chan :I'm Not Op'd"
      return 0
   }

   set unbnick [lindex [split $text] 0 ]

   set unhost [getchanhost $unbnick $chan]
   if {[onchan $unbnick $chan]} {
      pushmode $chan -b [maskhost $unbnick!$unhost 2]
   } else {
      putserv "MODE $chan -b $unbnick"

   }

}

if {![info exists clonescanner_running]} {
   timer $scn(time) clonescan:timer
   set clonescanner_running 1
}


proc scanner {nick host hand chan arg} {
   global scn
   array set clones [list]
   clonescan:act $chan $nick $hand 0 0
}

proc clonescan:timer {} {
   global scn
   set type 1
   set channels ""
   foreach chan [channels] {
      if {[validchan $chan] && [channel get $chan clonescan]} {
         lappend channels $chan
      }
   }
   if {$channels != ""} {
      clonescan:act $channels "nick" "chan1" 1 0
   }
}

proc clonescan:act {channels nick hand type counter} {
   global scn botnick
   set chan [lindex $channels $counter]
   set cc [expr $counter + 1]
   set found_clones 0
   set found_mask ""
   set theclones ""
   array set clones [list]
   if {$chan != ""} {
      set replace(%chan%) $chan
      foreach user [chanlist $chan] {
         set host [string tolower [lindex [split [getchanhost $user $chan] @] 1]]
         if {[string match "*undernet.org*" $host]} {
            continue
         }
         set replace(%host%) $host
         lappend clones($host) $user
      }
      foreach clone [array names clones] {
         set userlist [join $clones($clone)]
         if {[llength [split $userlist]] >= $scn(maxclone)} {
            set found_clones 1
            lappend found_mask $clone
            lappend theclones $clones($clone)
            if {$type == "0"} {
               putserv "PRIVMSG $nick :We Found [llength [split $userlist]] clone on $chan from the host $clone. these are9: [join $clones($clone) ", "]"
            }
         }
      }
      if {$found_clones == "1"} {
         if {$type == "1"} {
            putserv " @$chan :[llength [split $theclones]] $found_mask. These are: [join $theclones " ,"]"
         }
         if {$scn(what) == "1"} {
            foreach m $found_mask {
               set mask "*!*@$m"
               set replace(%chan%) $chan
               set reason [string map [array get replace] $scn(reason)]
               newchanban $chan $mask $botnick $reason $scn(btime)
            }
         }
      }
   }
   if {([lindex $channels $cc] != "") && ($type == "1")} {
      utimer 5 [list clonescan:act $channels $nick $hand $type $cc]
   }
   if {($type == "0") && ($found_clones == "0")} {
      putserv "PRIVMSG $chan :\005\[BT\]\005 We didn't find clones on $chan."
   }
}




proc pub:masskick {nick host handle chan text} {

if {![isop $nick $chan] && ![ishalfop $nick $chan] && ![matchattr [nick2hand $nick] o|o $chan]} { putserv "NOTICE $nick you dont have access to use this command" ; return o}

set reasonX55 [join [lrange [split $text ] 0 end]]
if {$reasonX55 eq ""} { set reasonX55 Requested }

foreach user [chanlist $chan] {
if {![isop $user $chan] && ![ishalfop $user $chan] && ![isvoice $user $chan] && ![matchattr [nick2hand $user] fnmo|fnmo $chan]} {
if {[set chost [getchanhost $user $chan]] ne ""} {
putnow "kick $chan $user"
}
lappend kickList $user
}
}

flushmode $chan

if {[info exists kickList]} {
set max 20
set count [llength $kickList]
if {$count > 0} {
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $kickList 0 [expr {$max - 1}]] ","]
set kickList [lrange $kickList $max end]
incr count -$max
} else {
set users [join $kickList ","]
set count 0
}
putnow "KICK $chan $users $reasonX55"
}
}
}
}

putlog "lockdown.tcl Created By ComputerTech Loaded Successfully"

#################################################################################################################################################################
#CREATED BY COMPUTERTECH
#################################################################################################################################################################

Back to top Go down
http://www.computer-tech1.webnode.co.uk
 
lockdown.tcl
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
TCLDROP :: Other :: Code-
Jump to: