Найти - Пользователи
Полная версия: Python и Active Directory
Начало » Python для экспертов » Python и Active Directory
1 2
well
Всем привет. Столкнулся с такой проблемой: надо пробежать по домену и проверить, кто на какой машине залогинен. Так как проблему надо было решить в ближайшие сроки, то воспользовался программами psloggedon.exe и dsquery.exe. Получал с помощью них значения, парсил и был определенный результат. Но хочется это реализовать на питоне без сторонних утилит. Не подскажете, куда копать?
well
lorien
На этой теме уже проскакивала ссылка на примеры работы со всяческими windows-фичами. Поищите в поиске.
если я правильно понял, то речь идет про win32api? Как это можно тогда реализовать на нем (как просмотреть список фунций для работы с Active Directiry)?
Все ники заняты
http://forum.script-coding.info/viewtopic.php?id=500
well
Все ники заняты
http://forum.script-coding.info/viewtopic.php?id=500
Спасибо большое, отличный портал, много еще интересного нашел там :).
well
Всем привет. Накатал небольшой скрипт, который должен в несколько потоков смотреть, кто на какой машине залогинен:

def loggedOn (pcArr):
print “ok”
for name in pcArr:
try:
conn = wmi.WMI (name)
cs = conn.Win32_ComputerSystem()
print “%s - %s” % (name, cs.UserName)
except:
print u“%s - Не в сети” % name

j = 0
for i in new:
s = “th_” + str (j)
whoIs = threading.Thread (target = loggedOn, name = s, args = new )
whoIs.start ()
j = j + 1

я получаю следующую ошибку:
Exception in thread th_0:
Traceback (most recent call last):
File “C:\Program Files\Python25\lib\threading.py”, line 460, in __bootstrap
self.run()
File “C:\Program Files\Python25\lib\threading.py”, line 440, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: loggedOn() takes exactly 1 argument (240 given)

Exception in Tkinter callback
Traceback (most recent call last):
File “C:\Program files\Python25\lib\lib-tk\Tkinter.py”, line 1403, in __call__
return self.func(*args)
File “C:\Program files\Python25\lib\idlelib\MultiCall.py”, line 151, in handler
r = l(event)
File “C:\Program files\Python25\lib\idlelib\ScriptBinding.py”, line 168, in run_module_event
interp.runcode(code)
File “C:\Program files\Python25\lib\idlelib\PyShell.py”, line 739, in runcode
self.tkconsole.endexecuting()
File “C:\Program files\Python25\lib\idlelib\PyShell.py”, line 922, in endexecuting
self.showprompt()
File “C:\Program files\Python25\lib\idlelib\PyShell.py”, line 1207, in showprompt
self.resetoutput()
File “C:\Program files\Python25\lib\idlelib\PyShell.py”, line 1222, in resetoutput
self.text.insert(“end-1c”, “\n”)
File “C:\Program files\Python25\lib\idlelib\Percolator.py”, line 25, in insert
self.top.insert(index, chars, tags)
File “C:\Program files\Python25\lib\idlelib\PyShell.py”, line 315, in insert
UndoDelegator.insert(self, index, chars, tags)
File “C:\Program files\Python25\lib\idlelib\UndoDelegator.py”, line 81, in insert
self.addcmd(InsertCommand(index, chars, tags))
File “C:\Program files\Python25\lib\idlelib\UndoDelegator.py”, line 116, in addcmd
cmd.do(self.delegate)
File “C:\Program files\Python25\lib\idlelib\UndoDelegator.py”, line 216, in do
if text.compare(self.index1, “>”, “end-1c”):
File “C:\Program files\Python25\lib\lib-tk\Tkinter.py”, line 2846, in compare
self._w, ‘compare’, index1, op, index2))
TclError: expected boolean value but got “”
Если делаю так:

loggedOn (new )

то все работает нормально. Не подскажите, в чем проблема?
Viper
А если так:

def loggedOn (pcArr):
print “ok”
for name in pcArr:
try:
conn = wmi.WMI (name)
cs = conn.Win32_ComputerSystem()
print “%s - %s” % (name, cs.UserName)
except:
print u“%s - Не в сети” % name

j = 0
for i in new:
s = “th_” + str (j)
whoIs = threading.Thread (target = loggedOn, name = s, args = (new , ))
whoIs.start ()
j = j + 1
well
Viper
А если так:

def loggedOn (pcArr):
print “ok”
for name in pcArr:
try:
conn = wmi.WMI (name)
cs = conn.Win32_ComputerSystem()
print “%s - %s” % (name, cs.UserName)
except:
print u“%s - Не в сети” % name

j = 0
for i in new:
s = “th_” + str (j)
whoIs = threading.Thread (target = loggedOn, name = s, args = (new , ))
whoIs.start ()
j = j + 1
Тут Питон сильно задумывается, а потом вылетает сообщение винды: в приложении возникла ошибка извините … Вот лог ошибки:
<?xml version=“1.0” encoding=“UTF-16”?>
<DATABASE>
<EXE NAME=“pythonw.exe” FILTER=“GRABMI_FILTER_PRIVACY”>
<MATCHING_FILE NAME=“python.exe” SIZE=“24064” CHECKSUM=“0xAA11C1ED” MODULE_TYPE=“WIN32” PE_CHECKSUM=“0x0”
LINKER_VERSION=“0x0” LINK_DATE=“04/18/2007 06:51:26” UPTO_LINK_DATE=“04/18/2007 06:51:26” />
<MATCHING_FILE NAME=“pythonw.exe” SIZE=“24576” CHECKSUM=“0xA6D58495” MODULE_TYPE=“WIN32” PE_CHECKSUM=“0x0”
LINKER_VERSION=“0x0” LINK_DATE=“04/18/2007 06:51:40” UPTO_LINK_DATE=“04/18/2007 06:51:40” />
<MATCHING_FILE NAME=“RemoveMySQL-python.exe” SIZE=“61440” CHECKSUM=“0x538175D5” MODULE_TYPE=“WIN32”
PE_CHECKSUM=“0x0” LINKER_VERSION=“0x0” LINK_DATE=“02/03/2005 20:46:47” UPTO_LINK_DATE=“02/03/2005 20:46:47” />
<MATCHING_FILE NAME=“Removepywin32.exe” SIZE=“61440” CHECKSUM=“0x538175D5” MODULE_TYPE=“WIN32” PE_CHECKSUM=“0x0”
LINKER_VERSION=“0x0” LINK_DATE=“02/03/2005 20:46:47” UPTO_LINK_DATE=“02/03/2005 20:46:47” />
<MATCHING_FILE NAME=“RemoveWinReg.exe” SIZE=“18944” CHECKSUM=“0xB390DB05” MODULE_TYPE=“WIN32” PE_CHECKSUM=“0x0”
LINKER_VERSION=“0x0” LINK_DATE=“12/18/2001 21:01:08” UPTO_LINK_DATE=“12/18/2001 21:01:08” />
<MATCHING_FILE NAME=“w9xpopen.exe” SIZE=“4608” CHECKSUM=“0xA449D0AE” MODULE_TYPE=“WIN32” PE_CHECKSUM=“0x0”
LINKER_VERSION=“0x0” LINK_DATE=“04/18/2007 06:51:27” UPTO_LINK_DATE=“04/18/2007 06:51:27” />
<MATCHING_FILE NAME=“DLLs\sqlite3.dll” SIZE=“260096” CHECKSUM=“0x7DB98CF1” MODULE_TYPE=“WIN32” PE_CHECKSUM=“0x0”
LINKER_VERSION=“0x10000” LINK_DATE=“02/11/2006 02:10:31” UPTO_LINK_DATE=“02/11/2006 02:10:31” />
<MATCHING_FILE NAME=“DLLs\tcl84.dll” SIZE=“576000” CHECKSUM=“0x9596D17A” BIN_FILE_VERSION=“8.4.2.12”
BIN_PRODUCT_VERSION=“8.4.2.12” PRODUCT_VERSION=“8.4.12” FILE_DESCRIPTION=“Tcl DLL” COMPANY_NAME=“ActiveState
Corporation” PRODUCT_NAME=“Tcl 8.4 for Windows” FILE_VERSION=“8.4.12” ORIGINAL_FILENAME=“tcl84.dll”
LEGAL_COPYRIGHT=“Copyright © 2001 by ActiveState Corporation, et al” VERFILEDATEHI=“0x0” VERFILEDATELO=“0x0”
VERFILEOS=“0x4” VERFILETYPE=“0x2” MODULE_TYPE=“WIN32” PE_CHECKSUM=“0x9C3D6” LINKER_VERSION=“0x0”
UPTO_BIN_FILE_VERSION=“8.4.2.12” UPTO_BIN_PRODUCT_VERSION=“8.4.2.12” LINK_DATE=“03/27/2006 15:22:59”
UPTO_LINK_DATE=“03/27/2006 15:22:59” VER_LANGUAGE="Английский (США) “ />
<MATCHING_FILE NAME=”DLLs\tclpip84.dll“ SIZE=”5120“ CHECKSUM=”0xB489B43B“ MODULE_TYPE=”WIN32“
PE_CHECKSUM=”0x1013F“ LINKER_VERSION=”0x0“ LINK_DATE=”03/27/2006 15:22:59“ UPTO_LINK_DATE=”03/27/2006 15:22:59“ />
<MATCHING_FILE NAME=”DLLs\tix84.dll“ SIZE=”266240“ CHECKSUM=”0xB57990A4“ MODULE_TYPE=”WIN32“
PE_CHECKSUM=”0x45DBA“ LINKER_VERSION=”0x0“ LINK_DATE=”01/19/2007 18:38:54“ UPTO_LINK_DATE=”01/19/2007 18:38:54“ />
<MATCHING_FILE NAME=”DLLs\tk84.dll“ SIZE=”1038848“ CHECKSUM=”0xBFD75423“ BIN_FILE_VERSION=”8.4.2.12“
BIN_PRODUCT_VERSION=”8.4.2.12“ PRODUCT_VERSION=”8.4.12“ FILE_DESCRIPTION=”Tk DLL“ COMPANY_NAME=”ActiveState
Corporation“ PRODUCT_NAME=”Tk 8.4 for Windows“ FILE_VERSION=”8.4.12“ ORIGINAL_FILENAME=”tk84.dll“
LEGAL_COPYRIGHT=”Copyright © 2001 by ActiveState Corporation, et al“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“
VERFILEOS=”0x4“ VERFILETYPE=”0x2“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x106AF9“ LINKER_VERSION=”0x0“
UPTO_BIN_FILE_VERSION=”8.4.2.12“ UPTO_BIN_PRODUCT_VERSION=”8.4.2.12“ LINK_DATE=”03/27/2006 15:44:07“
UPTO_LINK_DATE=”03/27/2006 15:44:07“ VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\distutils\command\wininst-6.exe“ SIZE=”61440“ CHECKSUM=”0xF0A3B1E4“ MODULE_TYPE=”WIN32“
PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ LINK_DATE=”02/03/2005 20:37:43“ UPTO_LINK_DATE=”02/03/2005 20:37:43“ />
<MATCHING_FILE NAME=”Lib\distutils\command\wininst-7.1.exe“ SIZE=”61440“ CHECKSUM=”0x538175D5“
MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ LINK_DATE=”02/03/2005 20:46:47“
UPTO_LINK_DATE=”02/03/2005 20:46:47“ />
<MATCHING_FILE NAME=”Lib\site-packages\isapi\PyISAPI_loader.dll“ SIZE=”40960“ CHECKSUM=”0x5C067EE2“
BIN_FILE_VERSION=”2.5.210.0“ BIN_PRODUCT_VERSION=”2.5.210.0“ PRODUCT_VERSION=”2.5.210.0“ FILE_DESCRIPTION=”“
COMPANY_NAME=”“ PRODUCT_NAME=”PyWin32“ FILE_VERSION=”2.5.210.0“ ORIGINAL_FILENAME=”PyISAPI_loader.dll“
INTERNAL_NAME=”PyISAPI_loader.dll“ LEGAL_COPYRIGHT=”“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“
VERFILETYPE=”0x2“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”2.5.210.0“
UPTO_BIN_PRODUCT_VERSION=”2.5.210.0“ LINK_DATE=”09/22/2006 15:34:27“ UPTO_LINK_DATE=”09/22/2006 15:34:27“
VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\site-packages\pythonwin\Pythonwin.exe“ SIZE=”15360“ CHECKSUM=”0x62FF0184“
BIN_FILE_VERSION=”2.5.210.0“ BIN_PRODUCT_VERSION=”2.5.210.0“ PRODUCT_VERSION=”2.5.210.0“ FILE_DESCRIPTION=”“
COMPANY_NAME=”“ PRODUCT_NAME=”PyWin32“ FILE_VERSION=”2.5.210.0“ ORIGINAL_FILENAME=”Pythonwin.exe“
INTERNAL_NAME=”Pythonwin.exe“ LEGAL_COPYRIGHT=”“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“
VERFILETYPE=”0x1“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”2.5.210.0“
UPTO_BIN_PRODUCT_VERSION=”2.5.210.0“ LINK_DATE=”09/22/2006 15:34:36“ UPTO_LINK_DATE=”09/22/2006 15:34:36“
VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\site-packages\pythonwin\scintilla.dll“ SIZE=”247808“ CHECKSUM=”0xA219BADB“
BIN_FILE_VERSION=”1.5.6.0“ BIN_PRODUCT_VERSION=”1.5.6.0“ PRODUCT_VERSION=”1.56“ FILE_DESCRIPTION=”Scintilla.DLL - a
Source Editing Component“ COMPANY_NAME=”Neil Hodgson neilh@scintilla.org“ PRODUCT_NAME=”Scintilla“
FILE_VERSION=”1.56“ ORIGINAL_FILENAME=”Scintilla.DLL“ INTERNAL_NAME=”Scintilla“ LEGAL_COPYRIGHT=”Copyright 1998-2003
by Neil Hodgson“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“ VERFILETYPE=”0x1“ MODULE_TYPE=”WIN32“
PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”1.5.6.0“ UPTO_BIN_PRODUCT_VERSION=”1.5.6.0“
LINK_DATE=”09/22/2006 15:35:09“ UPTO_LINK_DATE=”09/22/2006 15:35:09“ VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\site-packages\pywin32_system32\pythoncom25.dll“ SIZE=”327680“ CHECKSUM=”0xC1DE1AB4“
BIN_FILE_VERSION=”2.5.210.0“ BIN_PRODUCT_VERSION=”2.5.210.0“ PRODUCT_VERSION=”2.5.210.0“ FILE_DESCRIPTION=”“
COMPANY_NAME=”“ PRODUCT_NAME=”PyWin32“ FILE_VERSION=”2.5.210.0“ ORIGINAL_FILENAME=”pythoncom25.dll“
INTERNAL_NAME=”pythoncom25.dll“ LEGAL_COPYRIGHT=”“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“
VERFILETYPE=”0x2“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”2.5.210.0“
UPTO_BIN_PRODUCT_VERSION=”2.5.210.0“ LINK_DATE=”09/22/2006 15:30:22“ UPTO_LINK_DATE=”09/22/2006 15:30:22“
VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\site-packages\pywin32_system32\pywintypes25.dll“ SIZE=”102400“ CHECKSUM=”0xBCEB1340“
BIN_FILE_VERSION=”2.5.210.0“ BIN_PRODUCT_VERSION=”2.5.210.0“ PRODUCT_VERSION=”2.5.210.0“ FILE_DESCRIPTION=”“
COMPANY_NAME=”“ PRODUCT_NAME=”PyWin32“ FILE_VERSION=”2.5.210.0“ ORIGINAL_FILENAME=”pywintypes25.dll“
INTERNAL_NAME=”pywintypes25.dll“ LEGAL_COPYRIGHT=”“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“
VERFILETYPE=”0x2“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”2.5.210.0“
UPTO_BIN_PRODUCT_VERSION=”2.5.210.0“ LINK_DATE=”09/22/2006 15:17:59“ UPTO_LINK_DATE=”09/22/2006 15:17:59“
VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\site-packages\win32\perfmondata.dll“ SIZE=”9216“ CHECKSUM=”0xD3E68D48“
BIN_FILE_VERSION=”2.5.210.0“ BIN_PRODUCT_VERSION=”2.5.210.0“ PRODUCT_VERSION=”2.5.210.0“ FILE_DESCRIPTION=”“
COMPANY_NAME=”“ PRODUCT_NAME=”PyWin32“ FILE_VERSION=”2.5.210.0“ ORIGINAL_FILENAME=”perfmondata.dll“
INTERNAL_NAME=”perfmondata.dll“ LEGAL_COPYRIGHT=”“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“
VERFILETYPE=”0x2“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”2.5.210.0“
UPTO_BIN_PRODUCT_VERSION=”2.5.210.0“ LINK_DATE=”09/22/2006 15:18:01“ UPTO_LINK_DATE=”09/22/2006 15:18:01“
VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\site-packages\win32\pythonservice.exe“ SIZE=”9728“ CHECKSUM=”0xCBDB99B4“
BIN_FILE_VERSION=”2.5.210.0“ BIN_PRODUCT_VERSION=”2.5.210.0“ PRODUCT_VERSION=”2.5.210.0“ FILE_DESCRIPTION=”“
COMPANY_NAME=”“ PRODUCT_NAME=”PyWin32“ FILE_VERSION=”2.5.210.0“ ORIGINAL_FILENAME=”pythonservice.exe“
INTERNAL_NAME=”pythonservice.exe“ LEGAL_COPYRIGHT=”“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“
VERFILETYPE=”0x1“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”2.5.210.0“
UPTO_BIN_PRODUCT_VERSION=”2.5.210.0“ LINK_DATE=”09/22/2006 15:34:31“ UPTO_LINK_DATE=”09/22/2006 15:34:31“
VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”Lib\site-packages\win32\win32popenWin9x.exe“ SIZE=”4608“ CHECKSUM=”0x655C5705“
BIN_FILE_VERSION=”2.5.210.0“ BIN_PRODUCT_VERSION=”2.5.210.0“ PRODUCT_VERSION=”2.5.210.0“ FILE_DESCRIPTION=”“
COMPANY_NAME=”“ PRODUCT_NAME=”PyWin32“ FILE_VERSION=”2.5.210.0“ ORIGINAL_FILENAME=”win32popenWin9x.exe“
INTERNAL_NAME=”win32popenWin9x.exe“ LEGAL_COPYRIGHT=”“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“ VERFILEOS=”0x40004“
VERFILETYPE=”0x1“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x0“ LINKER_VERSION=”0x0“ UPTO_BIN_FILE_VERSION=”2.5.210.0“
UPTO_BIN_PRODUCT_VERSION=”2.5.210.0“ LINK_DATE=”09/22/2006 15:34:29“ UPTO_LINK_DATE=”09/22/2006 15:34:29“
VER_LANGUAGE=”Английский (США) “ />
<MATCHING_FILE NAME=”tcl\dde1.2\tcldde12.dll“ SIZE=”13312“ CHECKSUM=”0xB5E1E773“ MODULE_TYPE=”WIN32“
PE_CHECKSUM=”0xDC3F“ LINKER_VERSION=”0x0“ LINK_DATE=”03/27/2006 15:23:00“ UPTO_LINK_DATE=”03/27/2006 15:23:00“ />
<MATCHING_FILE NAME=”tcl\reg1.1\tclreg11.dll“ SIZE=”12800“ CHECKSUM=”0xF28953E2“ MODULE_TYPE=”WIN32“
PE_CHECKSUM=”0x55EB“ LINKER_VERSION=”0x0“ LINK_DATE=”03/27/2006 15:23:00“ UPTO_LINK_DATE=”03/27/2006 15:23:00“ />
</EXE>
<EXE NAME=”tcl84.dll“ FILTER=”GRABMI_FILTER_THISFILEONLY“>
<MATCHING_FILE NAME=”tcl84.dll“ SIZE=”576000“ CHECKSUM=”0x9596D17A“ BIN_FILE_VERSION=”8.4.2.12“
BIN_PRODUCT_VERSION=”8.4.2.12“ PRODUCT_VERSION=”8.4.12“ FILE_DESCRIPTION=”Tcl DLL“ COMPANY_NAME=”ActiveState
Corporation“ PRODUCT_NAME=”Tcl 8.4 for Windows“ FILE_VERSION=”8.4.12“ ORIGINAL_FILENAME=”tcl84.dll“
LEGAL_COPYRIGHT=”Copyright © 2001 by ActiveState Corporation, et al“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“
VERFILEOS=”0x4“ VERFILETYPE=”0x2“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0x9C3D6“ LINKER_VERSION=”0x0“
UPTO_BIN_FILE_VERSION=”8.4.2.12“ UPTO_BIN_PRODUCT_VERSION=”8.4.2.12“ LINK_DATE=”03/27/2006 15:22:59“
UPTO_LINK_DATE=”03/27/2006 15:22:59“ VER_LANGUAGE=”Английский (США) “ />
</EXE>
<EXE NAME=”kernel32.dll“ FILTER=”GRABMI_FILTER_THISFILEONLY“>
<MATCHING_FILE NAME=”kernel32.dll“ SIZE=”992256“ CHECKSUM=”0x10F48727“ BIN_FILE_VERSION=”5.1.2600.3119“
BIN_PRODUCT_VERSION=”5.1.2600.3119“ PRODUCT_VERSION=”5.1.2600.3119“ FILE_DESCRIPTION=”Библиотека клиента Windows NT
BASE API“ COMPANY_NAME=”Корпорация Майкрософт“ PRODUCT_NAME=”Операционная система Microsoft® Windows®“
FILE_VERSION=”5.1.2600.3119 (xpsp_sp2_qfe.070416-1259)“ ORIGINAL_FILENAME=”kernel32“ INTERNAL_NAME=”kernel32“
LEGAL_COPYRIGHT=”© Корпорация Майкрософт. Все права защищены.“ VERFILEDATEHI=”0x0“ VERFILEDATELO=”0x0“
VERFILEOS=”0x40004“ VERFILETYPE=”0x2“ MODULE_TYPE=”WIN32“ PE_CHECKSUM=”0xF2970“ LINKER_VERSION=”0x50001“
UPTO_BIN_FILE_VERSION=”5.1.2600.3119“ UPTO_BIN_PRODUCT_VERSION=”5.1.2600.3119“ LINK_DATE=”04/16/2007 16:11:16“
UPTO_LINK_DATE=”04/16/2007 16:11:16“ VER_LANGUAGE=”Русский " />
</EXE>
</DATABASE>
Андрей Светлов
Незачем полученное имя pcArr на буковки разваливать

def loggedOn (name):
print “ok”
try:
conn = wmi.WMI (name)
cs = conn.Win32_ComputerSystem()
print “%s - %s” % (name, cs.UserName)
except:
print u“%s - Не в сети” % name

j = 0
for i in new:
s = “th_” + str (j)
whoIs = threading.Thread (target = loggedOn, name = s, args = (new , ))
whoIs.start ()
j = j + 1
well
Андрей Светлов
Незачем полученное имя pcArr на буковки разваливать

def loggedOn (name):
print “ok”
try:
conn = wmi.WMI (name)
cs = conn.Win32_ComputerSystem()
print “%s - %s” % (name, cs.UserName)
except:
print u“%s - Не в сети” % name

j = 0
for i in new:
s = “th_” + str (j)
whoIs = threading.Thread (target = loggedOn, name = s, args = (new , ))
whoIs.start ()
j = j + 1
Извините, чот не уточнил: new - это список, элементами которого являются тоже списки, слдеовательно pcArr - это список, состоящий из имен компов.
Андрей Светлов
Или давай более полный пример - с этим самым new, или ничем помочь не получится. Желательно, чтобы пример можно было запустить без особых проблем.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB