Firewall alias.

By Spartacus on Dec 12, 2007

I'll keep it as short and sweet as possible. This script makes use of HNetCfg.FwMgr to turn your firewall on or off, by using "/firewall on" or "/firewall off" respectively. Initially this was just my toying around but I figured it may be of use to those who want to learn COM. Should you tend to poke around on SwiftIRC you'll notice the same alias posted under Champagne, my IRC name.

alias firewall { 
  if ($$1 = on || $$1 = off) {
    var %f $ticks, %ff f $+ %f, %fff ff $+ %ff, %i, %b $iif($$1 = on,true,false)
    if (!$com(%f)) .comopen %f HNetCfg.FwMgr
    if (!$comerr) {
      .comclose %f $com(%f,LocalPolicy,3,dispatch* %ff)
      if ($com(%ff)) {
        .comclose %ff $com(%ff,CurrentProfile,3,dispatch* %fff)
        if ($com(%fff)) {
          %i = $com(%fff,FirewallEnabled,5,bool,%b)
          %i = $com(%fff,FirewallEnabled,3)
          echo -s Firewall Enabled: $com(%fff).result
          .comclose %fff
        }
      }
    }
  }
}

Comments

Sign in to comment.
Korvin   -  Dec 15, 2007

this is a good gateway script =] ty for the submission.

 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.