[python-win32] python vs vbs with parental controls (security issue?)
Ross Boylan
RossBoylan at stanfordalumni.org
Wed Dec 16 09:46:46 CET 2009
Tim Golden wrote:
>
>
> <code>
> import wmi
>
> c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls")
> rules = c.WpcURLOverride (Sid=kelsey.SID)
> print len (rules)
>
> </code>
I've encountered a glitch: I can't seem to update the values in the
rules I retrieve. The relevant snippet is
<python>
con = wmi.WMI(namespace=wpcns)
rules = con.WpcURLOverride (Sid=kelsey.SID)
for r in rules:
if r.URL.endswith("facebook.com/"):
# flip whether or not the site is allowed
r.Allowed = 3 - r.Allowed
r.Put_()
print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name
</python>
This never changes the value of Allowed, even between the line where it
is set and printed out, much less between runs.
The comparable VBS does work:
<vbs>
For Each url in urls
If re.Execute(url.URL).Count > 0 Then
url.Allowed = 3-url.Allowed
WScript.Echo url.URL, url.Allowed
url.Put_()
End If
</vbs>
Any ideas (I am running privileged)?
Ross
More information about the python-win32
mailing list