Advertisement
Guest User

Untitled

a guest
Aug 13th, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. async def get_group_details(name, domain=domain_name, username =username, password=password,
  2. domain_name=domain_name):
  3. compiled_search_base = 'DC='+domain+',DC=abc,DC=com'
  4. compiled_search_filter = "(&(objectClass=group)(samaccountname=%s))" % name
  5. server = Server(server_name, get_info=ALL)
  6. connectionusername = 'CN=' + username + ',OU=SelfService,OU=Service Accounts,OU=FISC,OU=SystemsCo,DC=%s,DC=abc,'
  7. 'DC=com' %(domain_name)
  8. c = Connection(server, connectionusername, password, authentication='SIMPLE', auto_bind=True)
  9. c.search(search_base=compiled_search_base, search_filter=compiled_search_filter,search_scope=SUBTREE, attributes=['cn', 'member'], size_limit=0)
  10. member_list=[]
  11. for entry in c.response:
  12. member_list.extend(entry['attributes']['member'])
  13. return member_list
  14.  
  15. task_list =[]
  16. for group in list_of_groups:
  17. task = asyncio.ensure_future(get_group_details(group))
  18. task_list.append(task)
  19.  
  20. master_out = await asyncio.gather(*task_list)
  21.  
  22. Traceback (most recent call last):
  23. File "/usr/local/lib/python3.7/site-packages/ldap3/strategy/base.py", line 823, in sending
  24. self.connection.socket.sendall(encoded_message)
  25. File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1015, in sendall
  26. v = self.send(byte_view[count:])
  27. File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 984, in send
  28. return self._sslobj.write(data)
  29. BrokenPipeError: [Errno 32] Broken pipe
  30. During handling of the above exception, another exception occurred:
  31. Traceback (most recent call last):
  32. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  33. last_expr = (await self._async_exec(code_obj, self.user_ns))
  34. File "<ipython-input-233-5497fdd3fed2>", line 4, in async-def-wrapper
  35. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  36. last_expr = (await self._async_exec(code_obj, self.user_ns))
  37. File "<ipython-input-228-5497fdd3fed2>", line 4, in async-def-wrapper
  38. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  39. last_expr = (await self._async_exec(code_obj, self.user_ns))
  40. File "<ipython-input-225-5497fdd3fed2>", line 4, in async-def-wrapper
  41. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  42. last_expr = (await self._async_exec(code_obj, self.user_ns))
  43. File "<ipython-input-215-5497fdd3fed2>", line 4, in async-def-wrapper
  44. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  45. last_expr = (await self._async_exec(code_obj, self.user_ns))
  46. File "<ipython-input-202-5497fdd3fed2>", line 4, in async-def-wrapper
  47. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  48. last_expr = (await self._async_exec(code_obj, self.user_ns))
  49. File "<ipython-input-194-5497fdd3fed2>", line 4, in async-def-wrapper
  50. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  51. last_expr = (await self._async_exec(code_obj, self.user_ns))
  52. File "<ipython-input-190-5497fdd3fed2>", line 4, in async-def-wrapper
  53. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  54. last_expr = (await self._async_exec(code_obj, self.user_ns))
  55. File "<ipython-input-187-5497fdd3fed2>", line 4, in async-def-wrapper
  56. File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
  57. last_expr = (await self._async_exec(code_obj, self.user_ns))
  58. File "<ipython-input-185-5497fdd3fed2>", line 4, in async-def-wrapper
  59. File "/Users/a567847/OneDrive - Fidelity Technology Group, LLC/Automation/Git/ap129976-auditportal/Active_directory_async.py", line 249, in get_group_details_2
  60. compiled_search_filter = "(&(objectClass=group)(samaccountname=%s))" % name
  61. File "/usr/local/lib/python3.7/site-packages/ldap3/core/connection.py", line 788, in search
  62. response = self.post_send_search(self.send('searchRequest', request, controls))
  63. File "/usr/local/lib/python3.7/site-packages/ldap3/strategy/base.py", line 299, in send
  64. self.sending(ldap_message)
  65. File "/usr/local/lib/python3.7/site-packages/ldap3/strategy/base.py", line 834, in sending
  66. raise communication_exception_factory(LDAPSocketSendError, type(e)(str(e)))(self.connection.last_error)
  67. ldap3.core.exceptions.LDAPSocketSendError: socket sending error[Errno 32] Broken pipe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement