[python-win32] Win32_NTLogEvent access denied exception

2011-03-10 Thread inf200640
Hello list,

I'm having problems recieving local wmi events from Win32_NTLogEvent class. It 
turns
out
that I want to know which user starts or stops services. I set a watcher for 
that
propose and it raises the following exception:

x_access_denied: x_wmi: Unexpected COM Error (-2147352567, 'Ocurri\xf3 una exce
pci\xf3n.', (0, u'SWbemServicesEx', u'Acceso denegado ', None, 0, -2147217405),
None)

I have done the same with other classes and everything works just fine.

The script is running from the system's administration account. Do I need to 
provide
extra privileges in con = wmi.WMI()?

Could anyone help me figure out what is happening, please?

Thanks a lot for your assistance,
Silvia




---
Free the Cuban Five!
http://www.injusticia.cubaweb.cu/
http://www.antiterroristas.cu/
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Win32_NTLogEvent access denied exception

2011-03-10 Thread Tim Roberts
inf200...@ucf.edu.cu wrote:
 I'm having problems recieving local wmi events from Win32_NTLogEvent class. 
 It turns
 out that I want to know which user starts or stops services. I set a watcher 
 for that
 propose and it raises the following exception:

 x_access_denied: x_wmi: Unexpected COM Error (-2147352567, 'Ocurri\xf3 una 
 exce
 pci\xf3n.', (0, u'SWbemServicesEx', u'Acceso denegado ', None, 0, 
 -2147217405),
 None)

 I have done the same with other classes and everything works just fine.

 The script is running from the system's administration account. Do I need to 
 provide
 extra privileges in con = wmi.WMI()?

 Could anyone help me figure out what is happening, please?

Did you look at the documentation?
http://msdn.microsoft.com/en-us/library/aa394226.aspx
The very first paragraph says:

An application must have SeSecurityPrivilege to receive events from
the security event log, otherwise Access Denied is returned to the
application.

-2147217405 is 0x80041003, which is WBEM_E_ACCESS_DENIED, just like it says.

It takes a surprising amount of code to acquire a privilege.  Here is
some Python code that shows how to do it:
   
http://windows-privesc-check.googlecode.com/svn-history/r10/trunk/windows-privesc-check.py
Check get_extra_privs about half-way through.  You can simplify it a
little bit, since you are looking for exactly one privilege.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Win32_NTLogEvent access denied exception

2011-03-10 Thread Tim Golden

On 10/03/2011 6:24 PM, Tim Roberts wrote:

inf200...@ucf.edu.cu wrote:

I'm having problems recieving local wmi events from Win32_NTLogEvent class. It 
turns
out that I want to know which user starts or stops services. I set a watcher 
for that
propose and it raises the following exception:

x_access_denied:x_wmi: Unexpected COM Error (-2147352567, 'Ocurri\xf3 una exce
pci\xf3n.', (0, u'SWbemServicesEx', u'Acceso denegado ', None, 0, -2147217405),
None)

I have done the same with other classes and everything works just fine.

The script is running from the system's administration account. Do I need to 
provide
extra privileges in con = wmi.WMI()?

Could anyone help me figure out what is happening, please?


Did you look at the documentation?
 http://msdn.microsoft.com/en-us/library/aa394226.aspx
The very first paragraph says:

 An application must have SeSecurityPrivilege to receive events from
 the security event log, otherwise Access Denied is returned to the
 application.

-2147217405 is 0x80041003, which is WBEM_E_ACCESS_DENIED, just like it says.

It takes a surprising amount of code to acquire a privilege.  Here is
some Python code that shows how to do it:


Well, I think I can help out on three fronts here:

1) For WMI purposes, acquiring a privilege is as simple as adding a clause
to the WMI moniker. Using the wmi module, it's even easier:

c = wmi.WMI (privileges=[security])

2) On W7, at least, in a non-elevated command prompt, this wasn't enough
to let me capture eventlog events: I had to run it in an elevated command
prompt.

3) If you did want to apply the priv to the whole process you were in
(as per the code Tim R pointed to) you might do worse than use my
winsys package:

code
from winsys import security

with security.change_privileges ([security]):
  # do stuff

/code

http://timgolden.me.uk/python/winsys/security.html#security.change_privileges


However, I don't believe that's necessary here...
TJG
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Missing adsi.pyd, pwin32-216

2011-03-10 Thread Roger Upole

Tim Golden m...@timgolden.me.uk wrote in message 
news:4d78b66d.9080...@timgolden.me.uk...
 On 10/03/2011 11:29, Tim Golden wrote:
 On 09/03/2011 16:40, Graham Bloice wrote:
 The dll adsi.pyd is missing from the 216 build for Python 3.2. I've
 checked both the 32 and 64 bit variants and it's missing from both.

 Roger Upole can obviously speak for himself, but in a email
 conversation I had with him a while back, he said that they hadn't
 been able to build it because of an issue with the version
 of SWIG they were using (or something). IOW, even if you were
 to build pywin32 yourself, it still won't be there: it's not just
 a distribution issue.

 And, to clarify, I mean that it couldn't be built under Python 3.x;
 ie adsi should be present in all Python 2.x builds and won't be
 present in any python 3.x build.

 TJG

That sums it up pretty well.

Here's the longer version:
The SWIG in Pywin32 had been customised to accomodate
COM objects that inherit from another interface.  Somewhere
along the line, the source code has been lost, so when I ported
SWIG to Python 3, I had to start from a clean source tree.

It should be possible to reverse engineer the custom code from
the output generated for Python 2, but nobody's had time to
do so yet.

 Roger



___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32