[python-win32] python vs vbs with parental controls (security issue?)
Tim Golden
mail at timgolden.me.uk
Sun Dec 20 11:58:50 CET 2009
Tim Golden wrote:
> Ross Boylan wrote:
>> 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.
>
>
> Just occurs to me: there was a bug in versions < 1.4.6 which would have
> caused this. Are you using the latest version? (I'll still try to get
> hold of a Vista/W7 machine to try out on...)
Finally managed to persuade someone to lend me a Vista machine to
put Python etc. on. Installed virgin copy of Python 2.6, pywin32-214
and wmi 1.4.6 (all from the net). Created dummy non-admin account to
which to apply parental controls. Randomly "Allowed" google.com and
"Blocked" facebook.com.
cmd run as administrator
Ad-hoc Python session more-or-less as follows:
<non-verbatim Python session>
import wmi
sid = "...."
c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls")
for i in c.WpcURLOverride (SID=sid):
print i.URL, i.Allowed
#
# http://google.com 1
# http://facebook.com 2
#
for i in c.WpcURLOverride (SID=sid):
i.Allowed = 3 - i.Allowed
for i in c.WpcURLOverride (SID=sid):
print i.URL, i.Allowed
#
# http://google.com 2
# http://facebook.com 1
#
</Python session>
Back to Parental controls admin panel and Google is now forbidden,
Facebook allowed.
I realise that this doesn't really help you very much if it actually
doesn't work for you, but I really wanted to make sure I didn't have
a lingering bug in the code there.
Not sure what else I can offer at this point but very happy to
answer more questions / try more things if it will help.
TJG
More information about the python-win32
mailing list