Форум сайта python.su
И так начнём с того что нам нужны только логины и пароли AD, входящие в определённую группу.
в статье http://www.lissyara.su/articles/freebsd/programms/squid+ad/ есть описание когда на определ>нного пользователя приходит
uid=604(COLLEGE\squid) gid=601(COLLEGE\пользователи домена) groups=601(COLLEGE\пользователи домена),603(COLLEGE\администраторы домена),649(COLLEGE\inet)
squid$ id akeda
uid=10000(akeda) gid=10000(domain users) groups=10000(domain users)
squid$
squid$ wbinfo -g | wc -l
398
squid$ wbinfo -u | wc -l
1131
squid$
Офлайн
import subprocess
Офлайн
буду пробовать посмотрим :)
Офлайн
Учебник надо больше читать :) или систематизировать :)
Офлайн
зарисовка примерно так будет рр :)
login = raw_input("Insert_LOGIN: ")
login_all = "COLLEGE\\" + login
p = Popen(["/usr/bin/id", login_all], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
grep_stdout = p.communicate(input='')[0]
out_put = split(",",str(grep_stdout))
tested = "649(COLLEGE\\inet)\n" in out_put
###########################
if tested == 1:
print "OK"
else:
print "ERR"
Отредактировано (Апрель 13, 2010 08:44:38)
Офлайн
еще думаю вот это может мне поможет :)
Офлайн
ОШИБКА
test# python setup.py test
running test
running egg_info
writing lib/python_ad.egg-info/PKG-INFO
writing top-level names to lib/python_ad.egg-info/top_level.txt
writing dependency_links to lib/python_ad.egg-info/dependency_links.txt
reading manifest file 'lib/python_ad.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lib/python_ad.egg-info/SOURCES.txt'
running build_ext
copying build/lib.freebsd-7.3-RELEASE-i386-2.6/ad/protocol/krb5.so -> lib/ad/protocol
Failure: ImportError (/usr/home/pit/python-ad-0.9/lib/ad/protocol/krb5.so: Undefined symbol "krb5_cc_copy_creds") ... ERROR
======================================================================
ERROR: Failure: ImportError (/usr/home/pit/python-ad-0.9/lib/ad/protocol/krb5.so: Undefined symbol "krb5_cc_copy_creds")
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/loader.py", line 382, in loadTestsFromName
addr.filename, addr.module)
File "/usr/local/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/local/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/usr/home/pit/python-ad-0.9/lib/ad/__init__.py", line 12, in <module>
from ad.core.client import Client
File "/usr/home/pit/python-ad-0.9/lib/ad/core/client.py", line 20, in <module>
from ad.core.creds import Creds
File "/usr/home/pit/python-ad-0.9/lib/ad/core/creds.py", line 17, in <module>
from ad.protocol import krb5
ImportError: /usr/home/pit/python-ad-0.9/lib/ad/protocol/krb5.so: Undefined symbol "krb5_cc_copy_creds"
----------------------------------------------------------------------
Ran 1 test in 0.047s
FAILED (errors=1)
Офлайн
вот написал скрипт для работы с группами
#!/usr/bin/env python
from re import split
from subprocess import Popen, PIPE, STDOUT
start = 0
while(start) == 0:
inputs = raw_input()
all_string = split(' ', inputs)
group = all_string[1]
user = split("@",all_string[0])[0]
pre_group_namber = Popen(["/usr/local/bin/wbinfo","-n",group], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
groups = pre_group_namber.communicate(input='')[0]
group = split(' ',str(groups))[0]
pre_group_id = Popen(["/usr/local/bin/wbinfo","-Y",group], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
group_id = pre_group_id.communicate(input='')[0]
pre_test = Popen(["/usr/local/bin/wbinfo","-r",user,group_id], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
for_test = pre_test.communicate(input='')[0]
test = group_id in for_test
###########################
if test == 1:
print "OK"
else:
print "ERR"
Офлайн