Server Lock Down

By OddJoe69 on Apr 28, 2009

Simple little snippet that auto kills anyone connecting when turned on. YOU MUST BE IRCOP OR ADMIN. It does allow people from a safelist to still connect just fine. Usefull if your server is getting attacked.

menu menubar {
  Protections
  .Server LockDown
  .. -
  .. $iif($group(#lock) == on,$style(1) Enabled,Enabled): enable #lock | set %lock on | msg $chan 4Server Locked Down now started.
  .. $iif($group(#lock) == off,$style(1) Disabled,Disabled): disable #lock | set %lock off | msg $chan 4Server Lockdown now terminated.
} 
#lock off
on *:snotice:*Client connecting*:{
  if (%lock == on) {
    var %tempfilea $read(server.txt,w,$gettok($remove($9,$chr(40)),1,64)) 
    if ($gettok(%tempfilea,0,32) != $null) { globops $9 a 4Safelist User has Connected } 
    else { kill $9 4Server Is Locked Down
      unset %tempfilea 
    } 
  }
}
#lock end

Comments

Sign in to comment.
TheWhistler   -  Aug 23, 2009

nice snipplet but 1 question , how do you add to the safelist ?? i tested it out and it works great, just dont understand the safelist

 Respond  
Aucun50   -  May 02, 2009

Pretty much what everyone else said also the script looks good.

 Respond  
PATX   -  Apr 29, 2009

good script... could use some edits but these guys above me covered them all.

 Respond  
Prelude   -  Apr 29, 2009

Prolly a good idea to add a way or several to add ppl to this list, nicklist menu or alias and even a bot mode for admin/ircop to turn it on snd off and add nicks.

 Respond  
sunslayer   -  Apr 28, 2009

doesnt os_defcon do pretty much the same thing cept for the safelist and if ur network is being attacked y kill them just so they can reconect when u could add an akill for them?

edit: assuming u r using anope services anyways

 Respond  
Kirby   -  Apr 28, 2009

Ohai from EzzyChat!

Besides what I've said in IRC, there are other things that you can change towards the script.

menu menubar {
  Protections
  .Server LockDown
  .. -
  .. $iif($group(#lock) == on,$style(1) Enabled,Enabled): enable #lock | set %lock on | msg $chan 4Server Locked Down now started.
  .. $iif($group(#lock) == off,$style(1) Disabled,Disabled): disable #lock | set %lock off | msg $chan 4Server Lockdown now terminated.
} 
#lock off
on *:snotice:*Client connecting*:{
  if (%lock == on) {
    var %tempfilea $read(server.txt,w,$gettok($remove($9,$chr(40)),1,64)) 
    if ($gettok(%tempfilea,0,32) != $null) { globops $9 a 4Safelist User has Connected }
    else { kill $9 4Server Is Locked Down
      unset %tempfilea 
    } 
  }
}
#lock end

This code does work, but can be better.

I asked you earlier why you put set %lock on/off, and I've reconsidered to what you told me on IRC. However, I'm taking back my initial theory.

Because you are using groups, it takes care of the whole event. You don't need to have double protection for assurance.

As for the variable %tempfilea; I wouldn't use /var or /set if I am to only use it in the script once. In this case, it is only used once, so it can be removed and replaced. /unset %tempfilea can also be removed because you were only using /var.

So, from what I said, it can be shrunk down to this:

menu * {
  Protections
  .$iif($group(#lock) == On,$style(1)) Server Lockdown
  ..$iif($group(#lock) == On,$style(2)) On: .enable #lock | msg # 4Server Locked Down now started.
  ..$iif($group(#lock) == Off,$style(2)) Off: .disable #lock | 4Server Lockdown now terminated.
}

#lock off
on *:snotice:*Client connecting*:{
  if ($gettok($read(server.txt,w,$gettok($remove($9,$chr(40)),1,64)),0,32) != $null) { globops $9 a 4Safelist User has Connected } 
  else { kill $9 4Server Is Locked Down } 
}
#lock end

I changed the menu a little bit, because this one says if the lockdown is on or not, and disables selection for the one that is "active".

Other than that, I would explain two more things in your introduction:

  • What server.txt is.
  • Why and how /globops is used (as it is not available in every network)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.