[python-win32] PythonCOM & Windows Firewall

Metz, Bobby W, WWCS bwmetz at att.com
Thu May 18 09:46:01 CEST 2006


Roger, thanks for the code.  I'll give it a try.  Having read a bunch of
the documentation though, I'm concerned it may not work as some of our
users won't have admin rights.  I was hoping this would provide them the
Zone Alarm type prompt so that non-admin could approve the listening app
upon execution.  If all else fails it gives me a starter for checking
for existing exceptions.

Here's to hoping!!!

Bobby

-----Original Message-----
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org]On Behalf Of Roger Upole
Sent: Wednesday, May 17, 2006 7:07 PM
To: python-win32 at python.org
Subject: [python-win32] Re: PythonCOM & Windows Firewall


I've used it to list firewall exceptions, and it wasn't too much
more work to add an application: 

import win32com.client
fw=win32com.client.gencache.EnsureDispatch('HNetCfg.FwMgr',0)
apps=fw.LocalPolicy.CurrentProfile.AuthorizedApplications
for app in apps:
    print app.Name, app.ProcessImageFileName
    
newapp=win32com.client.Dispatch('HNetCfg.FwAuthorizedApplication')
newapp.Name='python_d.exe'
newapp.ProcessImageFileName='j:\\python24\\python_d.exe'
newapp.Enabled=True
apps.Add(newapp)


    hth
         Roger

_______________________________________________
Python-win32 mailing list
Python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32


More information about the Python-win32 mailing list