Bios Password

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, January 10, 2010

Windows Firewall, the netsh command, and verbose = enable

Posted on 5:54 PM by Unknown

Back in my Opening Ports in Windows Firewall from Batch files post I found the command-line power (for batch file building) of the netsh command.

In the end I wrote a few variants to a) install a needed application surreptitiously, and b) set the Windows Firewall to open up a needed port to inbound connections from a few specific remote IP address based servers.

Here they are a few examples (with my environmental specifics removed) as built specifically for deployment on our XP Pro systems.  As the first post pointed out, Vista and Windows 7 now has some updated (advanced) items that should be used instead.

Note the setup.exe file is held in the same folder that contains the bat files

For my user-prompted batch-file:

@echo off
echo -
echo To Set up and configure Application and FW-rule, type 1
echo -
echo To cancel, type 2
echo -

set /P  selection=    Type the number and then press Enter:  

If "%selection%" == "1"  goto APP_SETUP
If "%selection%" == "2"  goto end

:APP_SETUP
echo Installing Application applet

Setup.exe

echo Adding Windows Firewall port exception

netsh firewall add portopening protocol=tcp port=portnumber name=app-name mode=ENABLE profile=All Scope=custom addresses = server-ip-address_#1/subnet,server-ip-address_#1/subnet

echo Windows Firewall port opened

:end

and for the “silent” no-prompt bat file:

Setup.exe

netsh firewall add portopening protocol=tcp port=portnumber name=app-name mode=ENABLE profile=All Scope=custom addresses = server-ip-address_#1/subnet,server-ip-address_#1/subnet

Easy Peasy.

Note: those netsh command lines are actually all on one line with no returns like it seems….

Show + “Verbose = enable”

While verifying that I had my netsh line format built correctly, I needed to validate it (specifically the subnet into) against a system I had manually configured and verified was working correctly.

Although I was running the following command, it wasn’t quite giving me the firewall port detail I wanted.

netsh firewall show portopening

It took me some more digging but I found that if I passed the CLI as follows with the verbose = enabled added, I got VERY detailed information on the port settings.

netsh firewall show portopening verbose = enable

This technique can easily generate great data from the command-line for system information audits and incident responses.

From this post: Netsh Commands for Windows Firewall – Microsoft TechNet

show commands

The following show commands are used to display the current configuration:

The show command cannot be used to see the list of exceptions for the public profile, even if the public profile is the current profile. To see the list of exceptions for the public profile, use the Windows Firewall with Advanced Security MMC snap-in, and use the Filter by Profile option in the Actions pane.

  • show allowedprogram [ [ verbose = ] { enable | disable } ]
    Displays the current list of program exceptions for the domain and standard profiles. Use the parameter verbose=enable to see additional details.
  • show config [ [ verbose = ] { enable | disable } ]
    Displays the local configuration information for the domain and standard profiles, including the output of all other show commands. Use parameter verbose=enable to see additional details.
  • show currentprofile
    Displays the current profile in use for the network location type.
    If the current profile is the public profile, then this command shows the standard profile.
  • show icmpsetting [ [ verbose = ] { enable | disable } ]
    Displays the ICMP settings. Use parameter verbose=enable to see additional details.
  • show logging
    Displays the current logging settings.
    If the current profile is the public profile, then this command shows the standard profile.
  • show multicastbroadcastresponse
    Displays multicast/broadcast response settings for each profile.
  • show notifications
    Displays whether the firewall displays pop-up notifications for each profile.
  • show opmode
    Displays the operational mode for the firewall for each profile.
  • show portopening
    Displays the current list of port exceptions for each profile. Use parameter verbose=enable to see additional details.
  • show service
    Displays the service configuration for each profile. Use parameter verbose=enable to see additional details.
  • show state
    Displays the current state information for the firewall. Use parameter verbose=enable to see additional details.

For more info see these additional sources:

  • JSI Tip 8399. How can I report Windows Firewall settings? - WindowsITPro
  • Download details: Troubleshooting Windows Firewall in Microsoft Windows XP Service Pack 2 – Microsoft Download Center

Cheers!

--Claus V.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in command-line interface, firewalls, forensics, Microsoft, tutorials | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Finally! Time to Post! New material list
    After a recent text from my bro reminding me it has been since March since I’ve done a blog post, I was finally able to clear the schedule a...
  • Oscar watch Linkpost
    Alvis and Lavie are watching the Oscars tonight and I’m along for the ride. I wasn’t able to come even close to getting out some of the pos...
  • New Year’s Day - First Post 2011
    Same day I came out with my first post after a long drought, I fell upon this article Blogging Seems To Have Peaked, Says Pew Report over a...
  • Utility Gumbo
    There’s a lot in this pot.  Probably something everyone can find to enjoy. I’m serving it up tonight out of the back of the truck on the s...
  • iodd : Multi-boot madness!
    Like many computer technicians and responders, I seem to always have at hand a collection of bootable media; CD’s, DVD’s, USB-HDD’s, flash m...
  • Ubuntu 13.10 Upgrade - Lessons Learned & VIDMA utility found
    A few weeks ago a new release of Ubuntu came out. Naturally that meant it was update time! I have been getting pretty good at this now so ...
  • Interesting Malware in Email Attempt - URL Scanner Links
    Last weekend I spent some time with extended family helping confirm for them that their on-line email account got hacked and had been used t...
  • Windows 8 Linkage: A Bit Behind the Ball
    CC attribution: behind the eight ball by Ed Schipul on flickr . OK. Confession time. I’m more than a bit exhausted this weekend. Besides a...
  • Lego MiniFig Extravaganza
    picture clipped from Wired’s clip from Gizmodo clip… Thanks in no small part to the Windows 7 RC release, XPM mode research, and a big “l...
  • This Week in Security and Forensics: Beware the cake!
    Cube Party! image used with permission from John Walker at "rockpapershotgun.com" Yeah, the cake is a Portal thing.  Let’s d...

Categories

  • Active Directory
  • anti-virus software
  • Apple
  • architecture
  • art
  • AVG
  • Blogger
  • blogging
  • books
  • boot-cd's
  • browsers
  • cars
  • cell-phones
  • cheat sheets
  • Chrome/Chromium
  • command-line interface
  • cooking
  • crafts
  • crazy
  • curmudgeon
  • DHC
  • Dr. Who
  • E-P1
  • Education
  • family
  • Firefox
  • firewalls
  • For the Gentleman
  • forensics
  • Gmail
  • Google
  • graphics
  • hacks
  • hardware
  • humor
  • hurricanes
  • imagex
  • Internet Explorer
  • iOS
  • iPhone
  • iPod
  • iTunes
  • Kindle
  • Learning
  • Link Fest
  • Linux
  • malware tools
  • Microsoft
  • movies
  • music
  • networking
  • NewsFox
  • NFAT
  • Nook
  • Opera
  • organization
  • PDF's
  • photography
  • politics
  • PowerShell
  • recipes
  • Remote Support
  • RSS
  • science
  • Scripting
  • search engines
  • security
  • Shuttle SFF
  • software
  • Texana
  • Thunderbird
  • troubleshooting
  • TrueCrypt
  • tutorials
  • utilities
  • VBscript
  • video
  • Virtual PC
  • virtualization
  • viruses
  • Vista
  • Vista mods
  • wallpapers
  • Win FE
  • Win PE
  • Win RE
  • Windows 7
  • Windows 8
  • Windows Home Server
  • Windows Live Writer
  • Windows Phone
  • writing
  • XP
  • XP mods
  • Xplico

Blog Archive

  • ►  2013 (83)
    • ►  November (8)
    • ►  October (8)
    • ►  September (14)
    • ►  August (6)
    • ►  July (10)
    • ►  June (10)
    • ►  April (11)
    • ►  March (6)
    • ►  February (7)
    • ►  January (3)
  • ►  2012 (96)
    • ►  December (8)
    • ►  November (4)
    • ►  October (9)
    • ►  September (8)
    • ►  August (12)
    • ►  July (4)
    • ►  June (3)
    • ►  May (7)
    • ►  April (13)
    • ►  March (3)
    • ►  February (5)
    • ►  January (20)
  • ►  2011 (41)
    • ►  December (8)
    • ►  November (7)
    • ►  September (4)
    • ►  August (4)
    • ►  July (2)
    • ►  June (6)
    • ►  March (5)
    • ►  February (1)
    • ►  January (4)
  • ▼  2010 (69)
    • ►  December (1)
    • ►  October (3)
    • ►  September (2)
    • ►  August (13)
    • ►  July (17)
    • ►  June (3)
    • ►  May (3)
    • ►  April (3)
    • ►  March (11)
    • ►  February (1)
    • ▼  January (12)
      • Rapid-Strike Linkfest: Micro Edition
      • One day only deal: WinPatrol PLUS $0.99 – January ...
      • Security and Forensics Roundup: Heavy Version #6
      • Mega Linkfest – Dog-pile Style
      • Forensic Memory Capture roundup
      • Windows Firewall, the netsh command, and verbose =...
      • How I banished YouTube pink-psychedelic-dust casti...
      • A Valca Oops! How to REALLY enable (hack) Windows ...
      • Lavie’s Laptop Teardown
      • Windows Process Tools – Freeware Linkfest
      • Windows Things…
      • Opening Ports in Windows Firewall from Batch files
  • ►  2009 (177)
    • ►  December (20)
    • ►  November (11)
    • ►  October (7)
    • ►  September (7)
    • ►  August (21)
    • ►  July (17)
    • ►  June (7)
    • ►  May (18)
    • ►  April (9)
    • ►  March (17)
    • ►  February (23)
    • ►  January (20)
  • ►  2008 (35)
    • ►  December (23)
    • ►  November (12)
Powered by Blogger.

About Me

Unknown
View my complete profile