| 1 | DCOM/WMI client implementation for Linux. |
|---|
| 2 | andrzej.hajda@wp.pl, 2006-2007 |
|---|
| 3 | |
|---|
| 4 | ABOUT |
|---|
| 5 | |
|---|
| 6 | This implementation of DCOM/WMI client is based on Samba4 sources. |
|---|
| 7 | It uses RPC/DCOM mechanism to interact with WMI services on |
|---|
| 8 | Windows 2000/XP/2003 machines. |
|---|
| 9 | It contains also winexe - program to remote execution Windows commands remotely from Linux box. |
|---|
| 10 | Additional info about winexe at http://eol.ovh.org/winexe/. |
|---|
| 11 | |
|---|
| 12 | REQUIREMENTS |
|---|
| 13 | |
|---|
| 14 | The same as for Samba (gcc ???, autoconf ???). |
|---|
| 15 | For python bindings: |
|---|
| 16 | - SWIG >= 1.3 (I am using version 1.3.25). |
|---|
| 17 | - Python >= 2.3. |
|---|
| 18 | For winexe: |
|---|
| 19 | - crossmingw32-binutils |
|---|
| 20 | - crossmingw32-gcc |
|---|
| 21 | - crossmingw32-gcc-c++ |
|---|
| 22 | - crossmingw32-w32api |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | COMPILATION |
|---|
| 26 | |
|---|
| 27 | Simple steps(change python path if necessary): |
|---|
| 28 | $ cd Samba/source |
|---|
| 29 | $ ./autogen.sh |
|---|
| 30 | $ CPPFLAGS="-I/usr/include/python2.4" ./configure |
|---|
| 31 | $ make proto bin/wmic bin/wmis wmi/_pywmi.so bin/winexe |
|---|
| 32 | |
|---|
| 33 | BUILDING ON MAC |
|---|
| 34 | |
|---|
| 35 | $ cd Samba/source |
|---|
| 36 | $ ./autogen.sh |
|---|
| 37 | $ CPPFLAGS="-I/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4/" ./configure |
|---|
| 38 | $ make proto bin/wmic bin/wmis wmi/_pywmi.dylib bin/winexe |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | For details check Samba documentation in Samba/howto.txt. |
|---|
| 42 | |
|---|
| 43 | INSTALLATION |
|---|
| 44 | |
|---|
| 45 | Currently there is no install procedure. Generated binaries are located |
|---|
| 46 | in Samba/source: |
|---|
| 47 | bin/wmic - WMI simple client, it queries server using ExecQuery WMI method, |
|---|
| 48 | sample usage: |
|---|
| 49 | wmic -U domain/user%password //host "select Name from Win32_Process" |
|---|
| 50 | Program is at early stage of development and there are many bugs. |
|---|
| 51 | To retrieve more debug info use switch "-d number", where bigger number |
|---|
| 52 | corresponds to bigger output (I am using "-d 99" :) ) |
|---|
| 53 | bin/wmis - WMI test suite. Currently it does only following things: |
|---|
| 54 | - Creates directory remotely using Win32_Process.Create("cmd.exe /C mkdir C:\wmi_test_dir_tmp"). |
|---|
| 55 | - Executes ExecNotificationQuery for monitoring file create/delete events in this directory. |
|---|
| 56 | - Waits for 4 notifications and display their types. |
|---|
| 57 | wmi/_pywmi.so - Samba wrapper for python, together with wmi/pywmi.py and ../pycom/* modules can be used |
|---|
| 58 | to run zenwin on Linux. |
|---|
| 59 | bin/winexe - Remote windows commands execution. |
|---|
| 60 | Sample usage: |
|---|
| 61 | winexe -U domain/user%password //192.168.0.3 "ipconfig /all" |
|---|
| 62 | |
|---|
| 63 | PYTHON MODULES (early stage, experimental, for zenwin) |
|---|
| 64 | |
|---|
| 65 | There are two locations of python modules required to run zenwin: |
|---|
| 66 | - ./pycom - modules providing api of pywin32 library used in zenwin. |
|---|
| 67 | - ./Samba/source/wmi - SWIG generated Samba binding modules (pywmi.py, _pywmi.so), used by ./pycom. |
|---|
| 68 | To run zenwin you should: |
|---|
| 69 | 0. Compile _pywmi.so module, see COMPILATION section. |
|---|
| 70 | 1. Download zenwin: svn co http://dev.zenoss.org/svn/trunk/zenwin. |
|---|
| 71 | 2. Edit zenwin config files if necessary. |
|---|
| 72 | 3. Configure/run zenoss. |
|---|
| 73 | 4. Run zenwin components, with properly set env variable PYTHONPATH, for example in bash/sh: |
|---|
| 74 | cd $ZENWINPATH |
|---|
| 75 | PYTHONPATH="$WMIPATH/pycom:$WMIPATH/Samba/source/wmi" python ./$PROG.py -C etc/$PROG.cfg -v 10 --cycle=5 |
|---|
| 76 | where: |
|---|
| 77 | ZENWINPATH - path to zenwin directory |
|---|
| 78 | WMIPATH - path to wmi directory |
|---|
| 79 | PROG - one of zenwin components (zenwin, zenwinmodeler, zeneventlog) |
|---|
| 80 | |
|---|
| 81 | TODO |
|---|
| 82 | |
|---|
| 83 | - Implement handling of all CIM types, |
|---|
| 84 | - Free unused memory, |
|---|
| 85 | - Release DCOM objects |
|---|
| 86 | |
|---|
| 87 | General: |
|---|
| 88 | - Create async version |
|---|