python-win-ad 0.6.2__py3-none-any.whl → 0.6.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyad/__init__.py +73 -67
- pyad/adbase.py +6 -3
- pyad/adcontainer.py +238 -238
- pyad/adobject.py +4 -2
- {python_win_ad-0.6.2.dist-info → python_win_ad-0.6.4.dist-info}/METADATA +18 -23
- {python_win_ad-0.6.2.dist-info → python_win_ad-0.6.4.dist-info}/RECORD +8 -9
- {python_win_ad-0.6.2.dist-info → python_win_ad-0.6.4.dist-info}/WHEEL +1 -2
- {python_win_ad-0.6.2.dist-info → python_win_ad-0.6.4.dist-info/licenses}/LICENSE +201 -201
- python_win_ad-0.6.2.dist-info/top_level.txt +0 -1
pyad/__init__.py
CHANGED
|
@@ -1,67 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
from .
|
|
51
|
-
from .
|
|
52
|
-
from .
|
|
53
|
-
from .
|
|
54
|
-
from .
|
|
55
|
-
from .
|
|
56
|
-
from .
|
|
57
|
-
from .
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
1
|
+
|
|
2
|
+
__all__ = [
|
|
3
|
+
"set_defaults",
|
|
4
|
+
"ADQuery",
|
|
5
|
+
"ADComputer",
|
|
6
|
+
"ADContainer",
|
|
7
|
+
"ADDomain",
|
|
8
|
+
"ADGroup",
|
|
9
|
+
"ADUser",
|
|
10
|
+
"from_cn",
|
|
11
|
+
"from_dn",
|
|
12
|
+
"from_guid",
|
|
13
|
+
"comException",
|
|
14
|
+
"genericADSIException",
|
|
15
|
+
"win32Exception",
|
|
16
|
+
"invalidOwnerException",
|
|
17
|
+
"noObjectFoundException",
|
|
18
|
+
"InvalidObjectException",
|
|
19
|
+
"InvalidAttribute",
|
|
20
|
+
"noExecutedQuery",
|
|
21
|
+
"invalidResults",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _check_requirements():
|
|
26
|
+
import sys
|
|
27
|
+
import importlib
|
|
28
|
+
|
|
29
|
+
required_version = (3, 6)
|
|
30
|
+
cont = True
|
|
31
|
+
msg = []
|
|
32
|
+
if sys.version_info < required_version:
|
|
33
|
+
raise ImportError("Requires at least Python 3.6")
|
|
34
|
+
if sys.platform != "win32":
|
|
35
|
+
raise Exception("Must be running Windows in order to use pyad.")
|
|
36
|
+
for x in ["win32api", "pywintypes", "win32com", "win32security"]:
|
|
37
|
+
try:
|
|
38
|
+
importlib.import_module(x)
|
|
39
|
+
except ModuleNotFoundError:
|
|
40
|
+
cont = False
|
|
41
|
+
msg.append(f"{x}")
|
|
42
|
+
if not cont:
|
|
43
|
+
raise ImportError(
|
|
44
|
+
"Please ensure the following packages are installed: " + ", ".join(msg)
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
_check_requirements()
|
|
49
|
+
|
|
50
|
+
from .adbase import set_defaults
|
|
51
|
+
from .adquery import ADQuery
|
|
52
|
+
from .adcomputer import ADComputer
|
|
53
|
+
from .adcontainer import ADContainer
|
|
54
|
+
from .addomain import ADDomain
|
|
55
|
+
from .adgroup import ADGroup
|
|
56
|
+
from .aduser import ADUser
|
|
57
|
+
from .pyad import from_cn, from_dn, from_guid
|
|
58
|
+
from .pyadexceptions import (
|
|
59
|
+
comException,
|
|
60
|
+
genericADSIException,
|
|
61
|
+
win32Exception,
|
|
62
|
+
invalidOwnerException,
|
|
63
|
+
noObjectFoundException,
|
|
64
|
+
InvalidObjectException,
|
|
65
|
+
InvalidAttribute,
|
|
66
|
+
noExecutedQuery,
|
|
67
|
+
invalidResults,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if __name__ == "__main__":
|
|
72
|
+
import logging
|
|
73
|
+
logging.basicConfig(level=logging.WARNING)
|
pyad/adbase.py
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
import sys
|
|
2
3
|
import win32com.client
|
|
3
4
|
|
|
4
5
|
from .pyadexceptions import SetupError
|
|
5
6
|
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
6
8
|
_adsi_provider = win32com.client.Dispatch("ADsNameSpaces")
|
|
7
9
|
|
|
8
10
|
try:
|
|
9
11
|
# Discover default domain and forest information
|
|
10
12
|
__default_domain_obj = _adsi_provider.GetObject("", "LDAP://rootDSE")
|
|
11
13
|
except:
|
|
12
|
-
# If there was an error, this
|
|
13
|
-
|
|
14
|
-
"
|
|
14
|
+
# If there was an error, this computer might not be on a domain.
|
|
15
|
+
logger.debug(
|
|
16
|
+
"Unable to connect to default domain. "
|
|
17
|
+
"Computer is likely not attached to an AD domain."
|
|
15
18
|
)
|
|
16
19
|
__default_domain_obj = None
|
|
17
20
|
_default_detected_forest = None
|
pyad/adcontainer.py
CHANGED
|
@@ -1,238 +1,238 @@
|
|
|
1
|
-
import pywintypes
|
|
2
|
-
|
|
3
|
-
from typing import Any, Dict, List
|
|
4
|
-
from .adobject import ADObject
|
|
5
|
-
from .aduser import ADUser
|
|
6
|
-
from .adcomputer import ADComputer
|
|
7
|
-
from .adgroup import ADGroup
|
|
8
|
-
from . import pyadconstants
|
|
9
|
-
from . import pyadutils
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class ADContainer(ADObject):
|
|
13
|
-
def get_children_iter(
|
|
14
|
-
self, recursive: bool = False, filter: List[ADObject] = None
|
|
15
|
-
) -> ADObject:
|
|
16
|
-
"""
|
|
17
|
-
Iterate over the children objects in the container.
|
|
18
|
-
|
|
19
|
-
:param recursive: enumerate all containers with in the object,
|
|
20
|
-
defaults to False
|
|
21
|
-
:type recursive: bool, optional
|
|
22
|
-
:param filter: filter to only specific object classes ie ADUser,
|
|
23
|
-
defaults to None
|
|
24
|
-
:type filter: List[ADObject], optional
|
|
25
|
-
:yield: _description_
|
|
26
|
-
:rtype: _type_
|
|
27
|
-
"""
|
|
28
|
-
for com_object in self._ldap_adsi_obj:
|
|
29
|
-
q = ADObject.from_com_object(com_object)
|
|
30
|
-
q.adjust_pyad_type()
|
|
31
|
-
if q.type == "organizationalUnit" and recursive:
|
|
32
|
-
for c in q.get_children_iter(recursive=recursive):
|
|
33
|
-
if not filter or c.__class__ in filter:
|
|
34
|
-
yield c
|
|
35
|
-
if not filter or q.__class__ in filter:
|
|
36
|
-
yield q
|
|
37
|
-
|
|
38
|
-
def get_children(
|
|
39
|
-
self, recursive: bool = False, filter: List[ADObject] = None
|
|
40
|
-
) -> list:
|
|
41
|
-
"""
|
|
42
|
-
returns a list of child containers with in the current container. Optionally
|
|
43
|
-
the list can be filtered to specific object classes and search through child
|
|
44
|
-
containers recursively.
|
|
45
|
-
|
|
46
|
-
:param recursive: include children from sub-containers, defaults to False
|
|
47
|
-
:type recursive: bool, optional
|
|
48
|
-
:param filter: filter to only specific object classes ie ADUser, defaults to None
|
|
49
|
-
:type filter: List[ADObject], optional
|
|
50
|
-
:return: a list of all child objects
|
|
51
|
-
:rtype: list
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
return list(self.get_children_iter(recursive=recursive, filter=filter))
|
|
55
|
-
|
|
56
|
-
def __create_object(self, type_: str, name: str) -> ADObject:
|
|
57
|
-
prefix = "ou" if type_ == "organizationalUnit" else "cn"
|
|
58
|
-
prefixed_name = "=".join((prefix, name))
|
|
59
|
-
return self._ldap_adsi_obj.Create(type_, prefixed_name)
|
|
60
|
-
|
|
61
|
-
def create_user(
|
|
62
|
-
self,
|
|
63
|
-
name: str,
|
|
64
|
-
password: str = None,
|
|
65
|
-
upn_suffix: str = None,
|
|
66
|
-
enable: bool = True,
|
|
67
|
-
optional_attributes: dict = {},
|
|
68
|
-
) -> ADUser:
|
|
69
|
-
"""
|
|
70
|
-
Create a new user object in the container.
|
|
71
|
-
|
|
72
|
-
:param name: The name of the user
|
|
73
|
-
:type name: str
|
|
74
|
-
:param password: The password for the user it is strongly recommended to
|
|
75
|
-
populate this parameter as the account will be created with password
|
|
76
|
-
not required which will not get clear within AD leading to a security
|
|
77
|
-
vulnerability.
|
|
78
|
-
:type password: str, optional
|
|
79
|
-
:param upn_suffix: The upn suffix for the user, defaults to default upn
|
|
80
|
-
suffix for the domain.
|
|
81
|
-
:type upn_suffix: str, optional
|
|
82
|
-
:param enable: Whether the user should be enabled or disabled, defaults to True
|
|
83
|
-
:type enable: bool, optional
|
|
84
|
-
:param optional_attributes: List of additional attribute to set, defaults to {}
|
|
85
|
-
:type optional_attributes: dict, optional
|
|
86
|
-
:return: the created user object
|
|
87
|
-
:rtype: ADUser
|
|
88
|
-
"""
|
|
89
|
-
|
|
90
|
-
pyadobj = None
|
|
91
|
-
|
|
92
|
-
try:
|
|
93
|
-
if not upn_suffix:
|
|
94
|
-
upn_suffix = self.get_domain().get_default_upn()
|
|
95
|
-
upn = "@".join((name, upn_suffix))
|
|
96
|
-
obj = self.__create_object("user", name)
|
|
97
|
-
obj.Put("sAMAccountName", optional_attributes.get("sAMAccountName", name))
|
|
98
|
-
obj.Put("userPrincipalName", upn)
|
|
99
|
-
obj.SetInfo()
|
|
100
|
-
pyadobj = ADUser.from_com_object(obj)
|
|
101
|
-
|
|
102
|
-
if enable:
|
|
103
|
-
pyadobj.enable()
|
|
104
|
-
|
|
105
|
-
if password:
|
|
106
|
-
pyadobj.set_password(password)
|
|
107
|
-
pyadobj.set_user_account_control_setting("PASSWD_NOTREQD", False)
|
|
108
|
-
|
|
109
|
-
pyadobj.set_user_account_control_setting("NORMAL_ACCOUNT", True)
|
|
110
|
-
pyadobj.update_attributes(optional_attributes)
|
|
111
|
-
return pyadobj
|
|
112
|
-
except pywintypes.com_error as e:
|
|
113
|
-
if pyadobj:
|
|
114
|
-
# clean up the object if it was created
|
|
115
|
-
pyadobj.delete()
|
|
116
|
-
pyadutils.pass_up_com_exception(e)
|
|
117
|
-
|
|
118
|
-
def create_group(
|
|
119
|
-
self,
|
|
120
|
-
name: str,
|
|
121
|
-
security_enabled: bool = True,
|
|
122
|
-
scope: str = "GLOBAL",
|
|
123
|
-
optional_attributes: Dict[str, Any] = {},
|
|
124
|
-
) -> ADGroup:
|
|
125
|
-
"""
|
|
126
|
-
Create a new group object in the container
|
|
127
|
-
|
|
128
|
-
:param name: The Group Name
|
|
129
|
-
:type name: str
|
|
130
|
-
:param security_enabled: If this is a security enabled group or a distribution
|
|
131
|
-
group, defaults to True
|
|
132
|
-
:type security_enabled: bool, optional
|
|
133
|
-
:param scope: The scope of group. Must be one of [GLOBAL, LOCAL, UNIVERSAL].
|
|
134
|
-
Defaults to "GLOBAL"
|
|
135
|
-
:type scope: str, optional
|
|
136
|
-
:param optional_attributes: Additional attributes to set when creating the
|
|
137
|
-
object, defaults to {}
|
|
138
|
-
:type optional_attributes: Dict[str,Any], optional
|
|
139
|
-
:return: The created group object
|
|
140
|
-
:rtype: ADGroup
|
|
141
|
-
"""
|
|
142
|
-
|
|
143
|
-
obj = None
|
|
144
|
-
|
|
145
|
-
try:
|
|
146
|
-
obj = self.__create_object("group", name)
|
|
147
|
-
obj.Put("sAMAccountName", name)
|
|
148
|
-
val = pyadconstants.ADS_GROUP_TYPE[scope]
|
|
149
|
-
if security_enabled:
|
|
150
|
-
val = val | pyadconstants.ADS_GROUP_TYPE["SECURITY_ENABLED"]
|
|
151
|
-
obj.Put("groupType", val)
|
|
152
|
-
obj.SetInfo()
|
|
153
|
-
pyadobj = ADGroup.from_com_object(obj)
|
|
154
|
-
pyadobj.update_attributes(optional_attributes)
|
|
155
|
-
return pyadobj
|
|
156
|
-
except pywintypes.com_error as e:
|
|
157
|
-
if obj:
|
|
158
|
-
obj.delete()
|
|
159
|
-
pyadutils.pass_up_com_exception(e)
|
|
160
|
-
except KeyError:
|
|
161
|
-
if obj:
|
|
162
|
-
obj.delete()
|
|
163
|
-
raise ValueError(f"Invalid scope: {scope}")
|
|
164
|
-
|
|
165
|
-
def create_container(
|
|
166
|
-
self, name: str, optional_attributes: Dict[str, Any] = {}
|
|
167
|
-
) -> "ADContainer":
|
|
168
|
-
"""
|
|
169
|
-
Create a new organizational unit in the container
|
|
170
|
-
|
|
171
|
-
:param name: The name of the container
|
|
172
|
-
:type name: str
|
|
173
|
-
:param optional_attributes: Additional attributes to set when creating the
|
|
174
|
-
object, defaults to {}
|
|
175
|
-
:type optional_attributes: Dict[str,Any], optional
|
|
176
|
-
:return: the created container object
|
|
177
|
-
:rtype: ADContainer
|
|
178
|
-
"""
|
|
179
|
-
|
|
180
|
-
obj = None
|
|
181
|
-
|
|
182
|
-
try:
|
|
183
|
-
obj = self.__create_object("organizationalUnit", name)
|
|
184
|
-
obj.SetInfo()
|
|
185
|
-
pyadobj = ADContainer.from_com_object(obj)
|
|
186
|
-
pyadobj.update_attributes(optional_attributes)
|
|
187
|
-
return pyadobj
|
|
188
|
-
except pywintypes.com_error as e:
|
|
189
|
-
if obj:
|
|
190
|
-
obj.delete()
|
|
191
|
-
pyadutils.pass_up_com_exception(e)
|
|
192
|
-
|
|
193
|
-
def create_computer(
|
|
194
|
-
self, name: str, enable: bool = True, optional_attributes: Dict[str, Any] = {}
|
|
195
|
-
) -> ADComputer:
|
|
196
|
-
"""
|
|
197
|
-
Create a new computer object in the container
|
|
198
|
-
|
|
199
|
-
:param name: The computer name
|
|
200
|
-
:type name: str
|
|
201
|
-
:param enable: Whether the computer should be enabled or disabled,
|
|
202
|
-
defaults to True
|
|
203
|
-
:type enable: bool, optional
|
|
204
|
-
:param optional_attributes: Additional attributes to set when creating the
|
|
205
|
-
object, defaults to {}
|
|
206
|
-
:type optional_attributes: Dict[str,Any], optional
|
|
207
|
-
:return: the created computer object
|
|
208
|
-
:rtype: ADComputer
|
|
209
|
-
"""
|
|
210
|
-
|
|
211
|
-
obj = None
|
|
212
|
-
|
|
213
|
-
try:
|
|
214
|
-
obj = self.__create_object("computer", name)
|
|
215
|
-
obj.Put("sAMAccountName", name + "$")
|
|
216
|
-
if enable:
|
|
217
|
-
obj.Put("userAccountControl", 4128)
|
|
218
|
-
else:
|
|
219
|
-
obj.Put("userAccountControl", 4130)
|
|
220
|
-
obj.SetInfo()
|
|
221
|
-
pyadobj = ADComputer.from_com_object(obj)
|
|
222
|
-
if enable:
|
|
223
|
-
pyadobj.enable()
|
|
224
|
-
pyadobj.update_attributes(optional_attributes)
|
|
225
|
-
return pyadobj
|
|
226
|
-
except pywintypes.com_error as e:
|
|
227
|
-
if obj:
|
|
228
|
-
obj.delete()
|
|
229
|
-
pyadutils.pass_up_com_exception(e)
|
|
230
|
-
|
|
231
|
-
def remove_child(self, child: ADObject) -> None:
|
|
232
|
-
"""Removes the child object from the domain"""
|
|
233
|
-
|
|
234
|
-
self._ldap_adsi_obj.Delete(child.type, child.prefixed_cn)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
ADObject._py_ad_object_mappings["organizationalUnit"] = ADContainer
|
|
238
|
-
ADObject._py_ad_object_mappings["container"] = ADContainer
|
|
1
|
+
import pywintypes
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List
|
|
4
|
+
from .adobject import ADObject
|
|
5
|
+
from .aduser import ADUser
|
|
6
|
+
from .adcomputer import ADComputer
|
|
7
|
+
from .adgroup import ADGroup
|
|
8
|
+
from . import pyadconstants
|
|
9
|
+
from . import pyadutils
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ADContainer(ADObject):
|
|
13
|
+
def get_children_iter(
|
|
14
|
+
self, recursive: bool = False, filter: List[ADObject] = None
|
|
15
|
+
) -> ADObject:
|
|
16
|
+
"""
|
|
17
|
+
Iterate over the children objects in the container.
|
|
18
|
+
|
|
19
|
+
:param recursive: enumerate all containers with in the object,
|
|
20
|
+
defaults to False
|
|
21
|
+
:type recursive: bool, optional
|
|
22
|
+
:param filter: filter to only specific object classes ie ADUser,
|
|
23
|
+
defaults to None
|
|
24
|
+
:type filter: List[ADObject], optional
|
|
25
|
+
:yield: _description_
|
|
26
|
+
:rtype: _type_
|
|
27
|
+
"""
|
|
28
|
+
for com_object in self._ldap_adsi_obj:
|
|
29
|
+
q = ADObject.from_com_object(com_object)
|
|
30
|
+
q.adjust_pyad_type()
|
|
31
|
+
if q.type == "organizationalUnit" and recursive:
|
|
32
|
+
for c in q.get_children_iter(recursive=recursive):
|
|
33
|
+
if not filter or c.__class__ in filter:
|
|
34
|
+
yield c
|
|
35
|
+
if not filter or q.__class__ in filter:
|
|
36
|
+
yield q
|
|
37
|
+
|
|
38
|
+
def get_children(
|
|
39
|
+
self, recursive: bool = False, filter: List[ADObject] = None
|
|
40
|
+
) -> list:
|
|
41
|
+
"""
|
|
42
|
+
returns a list of child containers with in the current container. Optionally
|
|
43
|
+
the list can be filtered to specific object classes and search through child
|
|
44
|
+
containers recursively.
|
|
45
|
+
|
|
46
|
+
:param recursive: include children from sub-containers, defaults to False
|
|
47
|
+
:type recursive: bool, optional
|
|
48
|
+
:param filter: filter to only specific object classes ie ADUser, defaults to None
|
|
49
|
+
:type filter: List[ADObject], optional
|
|
50
|
+
:return: a list of all child objects
|
|
51
|
+
:rtype: list
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
return list(self.get_children_iter(recursive=recursive, filter=filter))
|
|
55
|
+
|
|
56
|
+
def __create_object(self, type_: str, name: str) -> ADObject:
|
|
57
|
+
prefix = "ou" if type_ == "organizationalUnit" else "cn"
|
|
58
|
+
prefixed_name = "=".join((prefix, name))
|
|
59
|
+
return self._ldap_adsi_obj.Create(type_, prefixed_name)
|
|
60
|
+
|
|
61
|
+
def create_user(
|
|
62
|
+
self,
|
|
63
|
+
name: str,
|
|
64
|
+
password: str = None,
|
|
65
|
+
upn_suffix: str = None,
|
|
66
|
+
enable: bool = True,
|
|
67
|
+
optional_attributes: dict = {},
|
|
68
|
+
) -> ADUser:
|
|
69
|
+
"""
|
|
70
|
+
Create a new user object in the container.
|
|
71
|
+
|
|
72
|
+
:param name: The name of the user
|
|
73
|
+
:type name: str
|
|
74
|
+
:param password: The password for the user it is strongly recommended to
|
|
75
|
+
populate this parameter as the account will be created with password
|
|
76
|
+
not required which will not get clear within AD leading to a security
|
|
77
|
+
vulnerability.
|
|
78
|
+
:type password: str, optional
|
|
79
|
+
:param upn_suffix: The upn suffix for the user, defaults to default upn
|
|
80
|
+
suffix for the domain.
|
|
81
|
+
:type upn_suffix: str, optional
|
|
82
|
+
:param enable: Whether the user should be enabled or disabled, defaults to True
|
|
83
|
+
:type enable: bool, optional
|
|
84
|
+
:param optional_attributes: List of additional attribute to set, defaults to {}
|
|
85
|
+
:type optional_attributes: dict, optional
|
|
86
|
+
:return: the created user object
|
|
87
|
+
:rtype: ADUser
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
pyadobj = None
|
|
91
|
+
|
|
92
|
+
try:
|
|
93
|
+
if not upn_suffix:
|
|
94
|
+
upn_suffix = self.get_domain().get_default_upn()
|
|
95
|
+
upn = "@".join((name, upn_suffix))
|
|
96
|
+
obj = self.__create_object("user", name)
|
|
97
|
+
obj.Put("sAMAccountName", optional_attributes.get("sAMAccountName", name))
|
|
98
|
+
obj.Put("userPrincipalName", upn)
|
|
99
|
+
obj.SetInfo()
|
|
100
|
+
pyadobj = ADUser.from_com_object(obj)
|
|
101
|
+
|
|
102
|
+
if enable:
|
|
103
|
+
pyadobj.enable()
|
|
104
|
+
|
|
105
|
+
if password:
|
|
106
|
+
pyadobj.set_password(password)
|
|
107
|
+
pyadobj.set_user_account_control_setting("PASSWD_NOTREQD", False)
|
|
108
|
+
|
|
109
|
+
pyadobj.set_user_account_control_setting("NORMAL_ACCOUNT", True)
|
|
110
|
+
pyadobj.update_attributes(optional_attributes)
|
|
111
|
+
return pyadobj
|
|
112
|
+
except pywintypes.com_error as e:
|
|
113
|
+
if pyadobj:
|
|
114
|
+
# clean up the object if it was created
|
|
115
|
+
pyadobj.delete()
|
|
116
|
+
pyadutils.pass_up_com_exception(e)
|
|
117
|
+
|
|
118
|
+
def create_group(
|
|
119
|
+
self,
|
|
120
|
+
name: str,
|
|
121
|
+
security_enabled: bool = True,
|
|
122
|
+
scope: str = "GLOBAL",
|
|
123
|
+
optional_attributes: Dict[str, Any] = {},
|
|
124
|
+
) -> ADGroup:
|
|
125
|
+
"""
|
|
126
|
+
Create a new group object in the container
|
|
127
|
+
|
|
128
|
+
:param name: The Group Name
|
|
129
|
+
:type name: str
|
|
130
|
+
:param security_enabled: If this is a security enabled group or a distribution
|
|
131
|
+
group, defaults to True
|
|
132
|
+
:type security_enabled: bool, optional
|
|
133
|
+
:param scope: The scope of group. Must be one of [GLOBAL, LOCAL, UNIVERSAL].
|
|
134
|
+
Defaults to "GLOBAL"
|
|
135
|
+
:type scope: str, optional
|
|
136
|
+
:param optional_attributes: Additional attributes to set when creating the
|
|
137
|
+
object, defaults to {}
|
|
138
|
+
:type optional_attributes: Dict[str,Any], optional
|
|
139
|
+
:return: The created group object
|
|
140
|
+
:rtype: ADGroup
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
obj = None
|
|
144
|
+
|
|
145
|
+
try:
|
|
146
|
+
obj = self.__create_object("group", name)
|
|
147
|
+
obj.Put("sAMAccountName", name)
|
|
148
|
+
val = pyadconstants.ADS_GROUP_TYPE[scope]
|
|
149
|
+
if security_enabled:
|
|
150
|
+
val = val | pyadconstants.ADS_GROUP_TYPE["SECURITY_ENABLED"]
|
|
151
|
+
obj.Put("groupType", val)
|
|
152
|
+
obj.SetInfo()
|
|
153
|
+
pyadobj = ADGroup.from_com_object(obj)
|
|
154
|
+
pyadobj.update_attributes(optional_attributes)
|
|
155
|
+
return pyadobj
|
|
156
|
+
except pywintypes.com_error as e:
|
|
157
|
+
if obj:
|
|
158
|
+
obj.delete()
|
|
159
|
+
pyadutils.pass_up_com_exception(e)
|
|
160
|
+
except KeyError:
|
|
161
|
+
if obj:
|
|
162
|
+
obj.delete()
|
|
163
|
+
raise ValueError(f"Invalid scope: {scope}")
|
|
164
|
+
|
|
165
|
+
def create_container(
|
|
166
|
+
self, name: str, optional_attributes: Dict[str, Any] = {}
|
|
167
|
+
) -> "ADContainer":
|
|
168
|
+
"""
|
|
169
|
+
Create a new organizational unit in the container
|
|
170
|
+
|
|
171
|
+
:param name: The name of the container
|
|
172
|
+
:type name: str
|
|
173
|
+
:param optional_attributes: Additional attributes to set when creating the
|
|
174
|
+
object, defaults to {}
|
|
175
|
+
:type optional_attributes: Dict[str,Any], optional
|
|
176
|
+
:return: the created container object
|
|
177
|
+
:rtype: ADContainer
|
|
178
|
+
"""
|
|
179
|
+
|
|
180
|
+
obj = None
|
|
181
|
+
|
|
182
|
+
try:
|
|
183
|
+
obj = self.__create_object("organizationalUnit", name)
|
|
184
|
+
obj.SetInfo()
|
|
185
|
+
pyadobj = ADContainer.from_com_object(obj)
|
|
186
|
+
pyadobj.update_attributes(optional_attributes)
|
|
187
|
+
return pyadobj
|
|
188
|
+
except pywintypes.com_error as e:
|
|
189
|
+
if obj:
|
|
190
|
+
obj.delete()
|
|
191
|
+
pyadutils.pass_up_com_exception(e)
|
|
192
|
+
|
|
193
|
+
def create_computer(
|
|
194
|
+
self, name: str, enable: bool = True, optional_attributes: Dict[str, Any] = {}
|
|
195
|
+
) -> ADComputer:
|
|
196
|
+
"""
|
|
197
|
+
Create a new computer object in the container
|
|
198
|
+
|
|
199
|
+
:param name: The computer name
|
|
200
|
+
:type name: str
|
|
201
|
+
:param enable: Whether the computer should be enabled or disabled,
|
|
202
|
+
defaults to True
|
|
203
|
+
:type enable: bool, optional
|
|
204
|
+
:param optional_attributes: Additional attributes to set when creating the
|
|
205
|
+
object, defaults to {}
|
|
206
|
+
:type optional_attributes: Dict[str,Any], optional
|
|
207
|
+
:return: the created computer object
|
|
208
|
+
:rtype: ADComputer
|
|
209
|
+
"""
|
|
210
|
+
|
|
211
|
+
obj = None
|
|
212
|
+
|
|
213
|
+
try:
|
|
214
|
+
obj = self.__create_object("computer", name)
|
|
215
|
+
obj.Put("sAMAccountName", name + "$")
|
|
216
|
+
if enable:
|
|
217
|
+
obj.Put("userAccountControl", 4128)
|
|
218
|
+
else:
|
|
219
|
+
obj.Put("userAccountControl", 4130)
|
|
220
|
+
obj.SetInfo()
|
|
221
|
+
pyadobj = ADComputer.from_com_object(obj)
|
|
222
|
+
if enable:
|
|
223
|
+
pyadobj.enable()
|
|
224
|
+
pyadobj.update_attributes(optional_attributes)
|
|
225
|
+
return pyadobj
|
|
226
|
+
except pywintypes.com_error as e:
|
|
227
|
+
if obj:
|
|
228
|
+
obj.delete()
|
|
229
|
+
pyadutils.pass_up_com_exception(e)
|
|
230
|
+
|
|
231
|
+
def remove_child(self, child: ADObject) -> None:
|
|
232
|
+
"""Removes the child object from the domain"""
|
|
233
|
+
|
|
234
|
+
self._ldap_adsi_obj.Delete(child.type, child.prefixed_cn)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
ADObject._py_ad_object_mappings["organizationalUnit"] = ADContainer
|
|
238
|
+
ADObject._py_ad_object_mappings["container"] = ADContainer
|
pyad/adobject.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
import win32com
|
|
2
3
|
import pywintypes
|
|
3
4
|
import time
|
|
@@ -16,6 +17,7 @@ from .pyadconstants import (
|
|
|
16
17
|
ADS_USER_FLAG,
|
|
17
18
|
)
|
|
18
19
|
|
|
20
|
+
logger = logging.getLogger(__name__)
|
|
19
21
|
|
|
20
22
|
@total_ordering
|
|
21
23
|
class ADObject(ADBase):
|
|
@@ -664,7 +666,7 @@ class ADObject(ADBase):
|
|
|
664
666
|
)
|
|
665
667
|
node.appendChild(text)
|
|
666
668
|
except:
|
|
667
|
-
|
|
669
|
+
logger.error("attribute: %s not xml-able" % attribute)
|
|
668
670
|
else:
|
|
669
671
|
node.setAttribute("type", "multiValued")
|
|
670
672
|
ok_elem = False
|
|
@@ -684,7 +686,7 @@ class ADObject(ADBase):
|
|
|
684
686
|
node.appendChild(valnode)
|
|
685
687
|
ok_elem = True
|
|
686
688
|
except:
|
|
687
|
-
|
|
689
|
+
logger.error("attribute: %s not xml-able" % attribute)
|
|
688
690
|
if ok_elem:
|
|
689
691
|
adobj_xml_doc.appendChild(node)
|
|
690
692
|
return doc.toxml(encoding="UTF-8")
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-win-ad
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
4
4
|
Summary: An Object-Oriented Active Directory management framework built on ADSI
|
|
5
|
-
|
|
6
|
-
Author: Zakir Durumeric
|
|
7
|
-
Author-email: zakird@gmail.com
|
|
8
|
-
Maintainer: Josh Carswell
|
|
9
|
-
Maintainer-email: Josh.Carswell@thecarswells.ca
|
|
10
|
-
License: Apache License, Version 2.0
|
|
11
|
-
Project-URL: Documentation, https://jcarswell.github.io/pyad/
|
|
5
|
+
Project-URL: Homepage, https://github.com/jcarswell/pyad/
|
|
12
6
|
Project-URL: Issues, https://github.com/jcarswell/pyad/issues/
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
Project-URL: Documentation, https://jcarswell.github.io/pyad/
|
|
8
|
+
Project-URL: Changelog, https://github.com/jcarswell/pyad/blob/main/CHANGELOG
|
|
9
|
+
Author-email: Zakir Durumeric <zakird@gmail.com>
|
|
10
|
+
Maintainer-email: Josh Carswell <Josh.Carswell@thecarswells.ca>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: AD,active directory,adsi,microsoft,pyad,python,windows active directory
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
17
|
Classifier: Natural Language :: English
|
|
17
18
|
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
-
Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP
|
|
19
19
|
Classifier: Programming Language :: Python :: 3
|
|
20
|
-
Classifier:
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
-
Obsoletes: pyad
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP
|
|
26
21
|
Requires-Python: >=3.6
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Requires-Dist: pywin32
|
|
22
|
+
Requires-Dist: pywin32>=301
|
|
23
|
+
Description-Content-Type: text/x-rst
|
|
30
24
|
|
|
31
25
|
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
|
32
26
|
:align: center
|
|
@@ -38,8 +32,9 @@ Introduction
|
|
|
38
32
|
|
|
39
33
|
pyad is a Python library designed to provide a simple, Pythonic interface to Active Directory
|
|
40
34
|
through ADSI on the Windows platform. Complete documentation can be found at
|
|
41
|
-
http://jcarswell.github.io/pyad/. Code is maintained at https://github.com/jcarswell/pyad.
|
|
42
|
-
|
|
35
|
+
http://jcarswell.github.io/pyad/. Code is maintained at https://github.com/jcarswell/pyad.
|
|
36
|
+
|
|
37
|
+
This library is published on PyPI as python-win-ad.
|
|
43
38
|
|
|
44
39
|
Breaking Changes from upstream
|
|
45
40
|
------------------------------
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
pyad/__init__.py,sha256=
|
|
2
|
-
pyad/adbase.py,sha256=
|
|
1
|
+
pyad/__init__.py,sha256=eZUsDn6j8yJwHX4M0byATQn8gK3r5a8RTYBy7yvgfwY,1720
|
|
2
|
+
pyad/adbase.py,sha256=_VvQiLKqKyuumDoPFv2hpdlAoDVatIQF99B9tlq30Pk,3017
|
|
3
3
|
pyad/adcomputer.py,sha256=Wnsx-aD0ugOsgUyHx__6GWd2ogk3aiv4ARqhI_AoPZk,1109
|
|
4
|
-
pyad/adcontainer.py,sha256=
|
|
4
|
+
pyad/adcontainer.py,sha256=6GA50aQnF4YpdtT88lrfxXOTxadXXfTOOfaUi4aDldU,8579
|
|
5
5
|
pyad/addomain.py,sha256=ppCUyONuNJAFVPxxCl4Z2o1-Lp0XesS3Wo1ao0YEoDg,850
|
|
6
6
|
pyad/adgroup.py,sha256=nevw3ZBAw58o_qYoXn7dN1bnOvIuwfsZMbZH6cF_dlM,11377
|
|
7
|
-
pyad/adobject.py,sha256=
|
|
7
|
+
pyad/adobject.py,sha256=7_497WoGXjdvVGfm5SuszFXEH5rK4R6E7WFFdVM8Rc8,30791
|
|
8
8
|
pyad/adquery.py,sha256=tv0dKkBgcSnhU7Garv6jAEGiUJkwC256I3o2jUpCS7M,10820
|
|
9
9
|
pyad/adsearch.py,sha256=a24vVolTRINQpmuQ3Ldq_2hlHXl9r700vjilINqXk8M,2702
|
|
10
10
|
pyad/aduser.py,sha256=DK0ADC0qXLUodTW0cphvgg8-0iSewaoYw5rSTtje6Dg,3936
|
|
@@ -12,8 +12,7 @@ pyad/pyad.py,sha256=moPUvolc0vI-JIIIjW8otUclgkUov0fT1pym1vufdNs,1091
|
|
|
12
12
|
pyad/pyadconstants.py,sha256=wny29f6aAYhRosWp-lXp_2Rn8HCn3J0BI_G1XFMg5DA,6739
|
|
13
13
|
pyad/pyadexceptions.py,sha256=R8q5dSsqOgULpqVYoz2yvNi6lENZ9wg0PZQnp2Y1sWg,2149
|
|
14
14
|
pyad/pyadutils.py,sha256=0c3wTZEUCv3WE59SO3bzJYfhaO10HsCbQS1D3lo9X10,10486
|
|
15
|
-
python_win_ad-0.6.
|
|
16
|
-
python_win_ad-0.6.
|
|
17
|
-
python_win_ad-0.6.
|
|
18
|
-
python_win_ad-0.6.
|
|
19
|
-
python_win_ad-0.6.2.dist-info/RECORD,,
|
|
15
|
+
python_win_ad-0.6.4.dist-info/METADATA,sha256=daYXP9NCLg4XUIopGKcB49OnEmbWc1VHLzvhvjtmQ3I,3171
|
|
16
|
+
python_win_ad-0.6.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
17
|
+
python_win_ad-0.6.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
18
|
+
python_win_ad-0.6.4.dist-info/RECORD,,
|
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
pyad
|