msad 0.2.0__tar.gz → 0.3.1__tar.gz
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.
- msad-0.3.1/PKG-INFO +113 -0
- msad-0.3.1/README.md +100 -0
- msad-0.3.1/pyproject.toml +30 -0
- msad-0.3.1/setup.cfg +4 -0
- {msad-0.2.0 → msad-0.3.1/src}/msad/command_line.py +35 -23
- {msad-0.2.0 → msad-0.3.1/src}/msad/user.py +6 -10
- msad-0.3.1/src/msad.egg-info/PKG-INFO +113 -0
- msad-0.3.1/src/msad.egg-info/SOURCES.txt +14 -0
- msad-0.3.1/src/msad.egg-info/entry_points.txt +2 -0
- msad-0.2.0/PKG-INFO +0 -64
- msad-0.2.0/README.md +0 -47
- msad-0.2.0/msad.egg-info/PKG-INFO +0 -64
- msad-0.2.0/msad.egg-info/SOURCES.txt +0 -16
- msad-0.2.0/msad.egg-info/entry_points.txt +0 -3
- msad-0.2.0/msad.egg-info/requires.txt +0 -2
- msad-0.2.0/setup.cfg +0 -8
- msad-0.2.0/setup.py +0 -41
- {msad-0.2.0 → msad-0.3.1}/LICENSE +0 -0
- {msad-0.2.0 → msad-0.3.1/src}/msad/__init__.py +0 -0
- {msad-0.2.0 → msad-0.3.1/src}/msad/ad.py +0 -0
- {msad-0.2.0 → msad-0.3.1/src}/msad/group.py +0 -0
- {msad-0.2.0 → msad-0.3.1/src}/msad/search.py +0 -0
- {msad-0.2.0 → msad-0.3.1/src}/msad.egg-info/dependency_links.txt +0 -0
- {msad-0.2.0 → msad-0.3.1/src}/msad.egg-info/top_level.txt +0 -0
msad-0.3.1/PKG-INFO
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: msad
|
3
|
+
Version: 0.3.1
|
4
|
+
Summary: msad is a commandline for interacting with Active Directory
|
5
|
+
Author-email: Matteo Redaelli <matteo.redaelli@gmail.com>
|
6
|
+
License-Expression: GPL-3.0-or-later
|
7
|
+
Project-URL: Homepage, https://github.com/matteoredaelli/msad
|
8
|
+
Project-URL: Issues, https://github.com/matteoredaelli/msad/issues
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.8
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
|
14
|
+
# msAD
|
15
|
+
|
16
|
+
|
17
|
+
msad is a library and command line tool for working with an Active Directory / LDAP server. It can be used for:
|
18
|
+
- search objects (users, groups, computers,..)
|
19
|
+
- search group members
|
20
|
+
- add/remove members to/from AD groups using DN or sAMaccoutName
|
21
|
+
- change AD passwords
|
22
|
+
- check if a user is disabled or locked, group membership
|
23
|
+
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```bash
|
28
|
+
msad --help
|
29
|
+
```
|
30
|
+
|
31
|
+
```text
|
32
|
+
COMMAND is one of the following:
|
33
|
+
|
34
|
+
add_member
|
35
|
+
Adds the user to a group (using DN or sAMAccountName)
|
36
|
+
|
37
|
+
change_password
|
38
|
+
|
39
|
+
check_user
|
40
|
+
Get some info about a user: is it locked? disabled? password expired?
|
41
|
+
|
42
|
+
group_flat_members
|
43
|
+
Extract all the (nested) members of a group
|
44
|
+
|
45
|
+
group_member
|
46
|
+
Check if the user is a member of a group (using DN or sAMAccountName)
|
47
|
+
|
48
|
+
group_members
|
49
|
+
Extract the direct members of a group
|
50
|
+
|
51
|
+
has_expired_password
|
52
|
+
Check is user has the expired password
|
53
|
+
|
54
|
+
has_never_expires_password
|
55
|
+
Check if a user has never expires password
|
56
|
+
|
57
|
+
is_disabled
|
58
|
+
Check if a user is disabled
|
59
|
+
|
60
|
+
is_locked
|
61
|
+
Check if the user is locked
|
62
|
+
|
63
|
+
remove_member
|
64
|
+
Remove the user from a group (using DN or sAMAccountName)
|
65
|
+
|
66
|
+
search
|
67
|
+
|
68
|
+
user_groups
|
69
|
+
Extract the list of groups of a user (using DN or sAMAccountName)
|
70
|
+
|
71
|
+
users
|
72
|
+
Find users inside AD. The filter can be the cn or userPrincipalName or samaccoutnname or mail to be searched. Can contain *
|
73
|
+
|
74
|
+
```
|
75
|
+
|
76
|
+
## Sample
|
77
|
+
|
78
|
+
I find useful to add an alias in my ~/.bash_aliases
|
79
|
+
|
80
|
+
```bash
|
81
|
+
alias msad='/usr/local/bin/msad --host=dmc1it.group.redaelli.org --port=636 --search_base dc=group,dc=redaelli,dc=org'
|
82
|
+
```
|
83
|
+
|
84
|
+
Retreive info about a user
|
85
|
+
|
86
|
+
```bash
|
87
|
+
msad check_user matteo 90 \[qliksense_analyzer,qliksense_professional\] 2>/dev/null
|
88
|
+
```
|
89
|
+
|
90
|
+
```json
|
91
|
+
{"is_disabled": false}
|
92
|
+
{"is_locked": false}
|
93
|
+
{"has_never_expires_password": false}
|
94
|
+
{"has_expired_password": false}
|
95
|
+
{"membership_qliksense_analyzer": false}
|
96
|
+
{"membership_qliksense_professional": true}
|
97
|
+
```
|
98
|
+
|
99
|
+
Getting nested group members (it is a pages search, it can retreive more than 1000 users)
|
100
|
+
|
101
|
+
```bash
|
102
|
+
msad --out_format csv --attributes samaccountname,mail,sn,givenName group_flat_members "dc=group,dc=redaelli,dc=org" --group_name "qliksense_admin"
|
103
|
+
```
|
104
|
+
|
105
|
+
|
106
|
+
## License
|
107
|
+
|
108
|
+
Copyright © 2021 2022 Matteo Redaelli
|
109
|
+
|
110
|
+
This program is free software: you can redistribute it and/or modify
|
111
|
+
it under the terms of the GNU General Public License as published by
|
112
|
+
the Free Software Foundation, either version 3 of the License, or
|
113
|
+
(at your option) any later version.
|
msad-0.3.1/README.md
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# msAD
|
2
|
+
|
3
|
+
|
4
|
+
msad is a library and command line tool for working with an Active Directory / LDAP server. It can be used for:
|
5
|
+
- search objects (users, groups, computers,..)
|
6
|
+
- search group members
|
7
|
+
- add/remove members to/from AD groups using DN or sAMaccoutName
|
8
|
+
- change AD passwords
|
9
|
+
- check if a user is disabled or locked, group membership
|
10
|
+
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
```bash
|
15
|
+
msad --help
|
16
|
+
```
|
17
|
+
|
18
|
+
```text
|
19
|
+
COMMAND is one of the following:
|
20
|
+
|
21
|
+
add_member
|
22
|
+
Adds the user to a group (using DN or sAMAccountName)
|
23
|
+
|
24
|
+
change_password
|
25
|
+
|
26
|
+
check_user
|
27
|
+
Get some info about a user: is it locked? disabled? password expired?
|
28
|
+
|
29
|
+
group_flat_members
|
30
|
+
Extract all the (nested) members of a group
|
31
|
+
|
32
|
+
group_member
|
33
|
+
Check if the user is a member of a group (using DN or sAMAccountName)
|
34
|
+
|
35
|
+
group_members
|
36
|
+
Extract the direct members of a group
|
37
|
+
|
38
|
+
has_expired_password
|
39
|
+
Check is user has the expired password
|
40
|
+
|
41
|
+
has_never_expires_password
|
42
|
+
Check if a user has never expires password
|
43
|
+
|
44
|
+
is_disabled
|
45
|
+
Check if a user is disabled
|
46
|
+
|
47
|
+
is_locked
|
48
|
+
Check if the user is locked
|
49
|
+
|
50
|
+
remove_member
|
51
|
+
Remove the user from a group (using DN or sAMAccountName)
|
52
|
+
|
53
|
+
search
|
54
|
+
|
55
|
+
user_groups
|
56
|
+
Extract the list of groups of a user (using DN or sAMAccountName)
|
57
|
+
|
58
|
+
users
|
59
|
+
Find users inside AD. The filter can be the cn or userPrincipalName or samaccoutnname or mail to be searched. Can contain *
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
## Sample
|
64
|
+
|
65
|
+
I find useful to add an alias in my ~/.bash_aliases
|
66
|
+
|
67
|
+
```bash
|
68
|
+
alias msad='/usr/local/bin/msad --host=dmc1it.group.redaelli.org --port=636 --search_base dc=group,dc=redaelli,dc=org'
|
69
|
+
```
|
70
|
+
|
71
|
+
Retreive info about a user
|
72
|
+
|
73
|
+
```bash
|
74
|
+
msad check_user matteo 90 \[qliksense_analyzer,qliksense_professional\] 2>/dev/null
|
75
|
+
```
|
76
|
+
|
77
|
+
```json
|
78
|
+
{"is_disabled": false}
|
79
|
+
{"is_locked": false}
|
80
|
+
{"has_never_expires_password": false}
|
81
|
+
{"has_expired_password": false}
|
82
|
+
{"membership_qliksense_analyzer": false}
|
83
|
+
{"membership_qliksense_professional": true}
|
84
|
+
```
|
85
|
+
|
86
|
+
Getting nested group members (it is a pages search, it can retreive more than 1000 users)
|
87
|
+
|
88
|
+
```bash
|
89
|
+
msad --out_format csv --attributes samaccountname,mail,sn,givenName group_flat_members "dc=group,dc=redaelli,dc=org" --group_name "qliksense_admin"
|
90
|
+
```
|
91
|
+
|
92
|
+
|
93
|
+
## License
|
94
|
+
|
95
|
+
Copyright © 2021 2022 Matteo Redaelli
|
96
|
+
|
97
|
+
This program is free software: you can redistribute it and/or modify
|
98
|
+
it under the terms of the GNU General Public License as published by
|
99
|
+
the Free Software Foundation, either version 3 of the License, or
|
100
|
+
(at your option) any later version.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
[project]
|
2
|
+
name = "msad"
|
3
|
+
version = "0.3.1"
|
4
|
+
authors = [
|
5
|
+
{ name="Matteo Redaelli", email="matteo.redaelli@gmail.com" },
|
6
|
+
]
|
7
|
+
description = "msad is a commandline for interacting with Active Directory"
|
8
|
+
readme = "README.md"
|
9
|
+
requires-python = ">=3.8"
|
10
|
+
classifiers = [
|
11
|
+
"Programming Language :: Python :: 3",
|
12
|
+
"Operating System :: OS Independent",
|
13
|
+
]
|
14
|
+
license = "GPL-3.0-or-later"
|
15
|
+
#license = {file = "LICENSE"}
|
16
|
+
#license-file = ["LICENSE"]
|
17
|
+
#license-expression = "*"
|
18
|
+
|
19
|
+
license-files = []
|
20
|
+
|
21
|
+
[project.urls]
|
22
|
+
Homepage = "https://github.com/matteoredaelli/msad"
|
23
|
+
Issues = "https://github.com/matteoredaelli/msad/issues"
|
24
|
+
|
25
|
+
[project.scripts]
|
26
|
+
msad = "msad:command_line"
|
27
|
+
|
28
|
+
[build-system]
|
29
|
+
requires = ["setuptools >= 78.1.0"]
|
30
|
+
build-backend = "setuptools.build_meta"
|
msad-0.3.1/setup.cfg
ADDED
@@ -75,7 +75,8 @@ class AD:
|
|
75
75
|
add/remove members to/from groups,
|
76
76
|
change password
|
77
77
|
check if a user is locked, disabled
|
78
|
-
check if a user's password is expired
|
78
|
+
check if a user's password is expired
|
79
|
+
..."""
|
79
80
|
|
80
81
|
def __init__(
|
81
82
|
self,
|
@@ -94,7 +95,9 @@ class AD:
|
|
94
95
|
try:
|
95
96
|
self._conn = _get_connection(host, port, use_ssl, sso, user, password)
|
96
97
|
except:
|
97
|
-
logging.error(
|
98
|
+
logging.error(
|
99
|
+
f"Cannot login to Active Directory (host: {host}, port: {port}). Bye"
|
100
|
+
)
|
98
101
|
sys.exit(1)
|
99
102
|
self._attributes = attributes
|
100
103
|
self._sep = sep
|
@@ -116,9 +119,9 @@ class AD:
|
|
116
119
|
)
|
117
120
|
result = list(filter(lambda e: "attributes" in e, self._conn.response))
|
118
121
|
result = list(map(lambda e: e["attributes"], result))
|
119
|
-
return self.
|
122
|
+
return self._pprint(result)
|
120
123
|
|
121
|
-
def
|
124
|
+
def _pprint(self, ldapresult):
|
122
125
|
if not ldapresult or self._out_format == "default":
|
123
126
|
return ldapresult
|
124
127
|
elif self._out_format == "json1":
|
@@ -142,35 +145,39 @@ class AD:
|
|
142
145
|
return result
|
143
146
|
|
144
147
|
def users(self, user):
|
145
|
-
"""
|
146
|
-
filter
|
148
|
+
"""Find users inside AD. The
|
149
|
+
filter can be the cn or userPrincipalName or samaccoutnname or mail to be searched. Can contain *
|
147
150
|
"""
|
148
151
|
result = msad.users(
|
149
152
|
self._conn, self._search_base, user, attributes=self._attributes
|
150
153
|
)
|
151
|
-
return self.
|
154
|
+
return self._pprint(result)
|
152
155
|
|
153
156
|
def is_disabled(self, user):
|
154
157
|
"""Check if a user is disabled"""
|
155
158
|
return msad.user.is_disabled(self._conn, self._search_base, user)
|
156
159
|
|
157
160
|
def is_locked(self, user):
|
158
|
-
"""
|
161
|
+
"""Check if the user is locked"""
|
159
162
|
return msad.user.is_locked(self._conn, self._search_base, user)
|
160
163
|
|
164
|
+
def password_changed_in_days(self, user):
|
165
|
+
return msad.user.password_changed_in_days(self._conn, self._search_base, user)
|
166
|
+
|
161
167
|
def has_expired_password(self, user, max_age):
|
162
|
-
"""user
|
168
|
+
"""Check is user has the expired password"""
|
163
169
|
return msad.has_expired_password(self._conn, self._search_base, user, max_age)
|
164
170
|
|
165
171
|
def has_never_expires_password(self, user):
|
166
|
-
"""user
|
172
|
+
"""Check if a user has never expires password"""
|
167
173
|
return msad.has_never_expires_password(self._conn, self._search_base, user)
|
168
174
|
|
169
175
|
def check_user(self, user, max_age, groups=[]):
|
170
|
-
"""Get info about a user"""
|
176
|
+
"""Get some info about a user: is it locked? disabled? password expired?"""
|
171
177
|
return msad.check_user(self._conn, self._search_base, user, max_age, groups)
|
172
178
|
|
173
179
|
def group_flat_members(self, group_name=None, group_dn=None):
|
180
|
+
"""Extract all the (nested) members of a group"""
|
174
181
|
result = msad.group_flat_members(
|
175
182
|
self._conn,
|
176
183
|
self._search_base,
|
@@ -179,18 +186,18 @@ class AD:
|
|
179
186
|
group_dn,
|
180
187
|
attributes=self._attributes,
|
181
188
|
)
|
182
|
-
return self.
|
189
|
+
return self._pprint(result)
|
183
190
|
|
184
191
|
def group_members(self, group_name=None, group_dn=None):
|
185
|
-
"""
|
192
|
+
"""Extract the direct members of a group"""
|
186
193
|
if group_name is None and group_dn is None:
|
187
194
|
logging.error("group_name or group_dn must be entered")
|
188
195
|
return None
|
189
196
|
result = msad.group_members(self._conn, self._search_base, group_name, group_dn)
|
190
|
-
return self.
|
197
|
+
return self._pprint(result)
|
191
198
|
|
192
199
|
def add_member(self, group_name=None, group_dn=None, user_name=None, user_dn=None):
|
193
|
-
"""
|
200
|
+
"""Adds the user to a group (using DN or sAMAccountName)"""
|
194
201
|
return msad.add_member(
|
195
202
|
conn=self._conn,
|
196
203
|
search_base=self._search_base,
|
@@ -201,7 +208,7 @@ class AD:
|
|
201
208
|
)
|
202
209
|
|
203
210
|
def user_groups(self, user_name=None, user_dn=None):
|
204
|
-
"""groups of a user"""
|
211
|
+
"""Extract the list of groups of a user (using DN or sAMAccountName)"""
|
205
212
|
return msad.user.user_groups(
|
206
213
|
self._conn, self._search_base, self._limit, user_name, user_dn
|
207
214
|
)
|
@@ -209,7 +216,7 @@ class AD:
|
|
209
216
|
def remove_member(
|
210
217
|
self, group_name=None, group_dn=None, user_name=None, user_dn=None
|
211
218
|
):
|
212
|
-
"""Remove
|
219
|
+
"""Remove the user from a group (using DN or sAMAccountName)"""
|
213
220
|
return msad.remove_member(
|
214
221
|
conn=self._conn,
|
215
222
|
search_base=self._search_base,
|
@@ -222,7 +229,7 @@ class AD:
|
|
222
229
|
def group_member(
|
223
230
|
self, group_name=None, group_dn=None, user_name=None, user_dn=None
|
224
231
|
):
|
225
|
-
"""group
|
232
|
+
"""Check if the user is a member of a group (using DN or sAMAccountName)"""
|
226
233
|
return msad.group_member(
|
227
234
|
conn=self._conn,
|
228
235
|
search_base=self._search_base,
|
@@ -234,11 +241,15 @@ class AD:
|
|
234
241
|
|
235
242
|
|
236
243
|
BANNER = """
|
237
|
-
|
238
|
-
/ \
|
239
|
-
/ _ \
|
240
|
-
|
241
|
-
|
244
|
+
__ __ ____ _ ____
|
245
|
+
| \/ |/ ___| / \ | _ \
|
246
|
+
| |\/| |\___ \ / _ \ | | | |
|
247
|
+
| | | | ___) |/ ___ \ | |_| |
|
248
|
+
|_| |_||____//_/ \_\|____/
|
249
|
+
|
250
|
+
https://github.com/matteoredaelli/msad
|
251
|
+
|
252
|
+
https://pypi.org/project/msad/
|
242
253
|
|
243
254
|
"""
|
244
255
|
|
@@ -246,6 +257,7 @@ BANNER = """
|
|
246
257
|
def main():
|
247
258
|
"""main"""
|
248
259
|
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
|
260
|
+
logging.info(BANNER)
|
249
261
|
fire.Fire(AD)
|
250
262
|
|
251
263
|
|
@@ -70,24 +70,20 @@ def has_never_expires_password(conn, search_base, user):
|
|
70
70
|
return True if len(result) == 1 else None
|
71
71
|
|
72
72
|
|
73
|
-
def password_changed_in_days(conn, search_base, user):
|
73
|
+
def password_changed_in_days(conn, search_base, user, limit=1000):
|
74
74
|
search_filter = f"(samaccountname={user})"
|
75
75
|
result = search(
|
76
|
-
conn, search_base, search_filter, limit=
|
76
|
+
conn, search_base, search_filter, limit=limit, attributes=["sAMAccountName","pwdLastSet"]
|
77
77
|
)
|
78
78
|
|
79
79
|
if len(result) == 0:
|
80
80
|
return None
|
81
|
-
|
82
|
-
logging.info(f"Password changed at {result}")
|
81
|
+
|
83
82
|
now = datetime.datetime.now()
|
83
|
+
result = [ {"sAMAccountName": u["sAMAccountName"],
|
84
|
+
"days": (now - u["pwdLastSet"].replace(tzinfo=None)).days} for u in result]
|
84
85
|
|
85
|
-
|
86
|
-
return True
|
87
|
-
else:
|
88
|
-
delta = now - result.replace(tzinfo=None)
|
89
|
-
days = delta.days
|
90
|
-
return days
|
86
|
+
return result
|
91
87
|
|
92
88
|
|
93
89
|
def has_expired_password(conn, search_base, user, max_age):
|
@@ -0,0 +1,113 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: msad
|
3
|
+
Version: 0.3.1
|
4
|
+
Summary: msad is a commandline for interacting with Active Directory
|
5
|
+
Author-email: Matteo Redaelli <matteo.redaelli@gmail.com>
|
6
|
+
License-Expression: GPL-3.0-or-later
|
7
|
+
Project-URL: Homepage, https://github.com/matteoredaelli/msad
|
8
|
+
Project-URL: Issues, https://github.com/matteoredaelli/msad/issues
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.8
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
|
14
|
+
# msAD
|
15
|
+
|
16
|
+
|
17
|
+
msad is a library and command line tool for working with an Active Directory / LDAP server. It can be used for:
|
18
|
+
- search objects (users, groups, computers,..)
|
19
|
+
- search group members
|
20
|
+
- add/remove members to/from AD groups using DN or sAMaccoutName
|
21
|
+
- change AD passwords
|
22
|
+
- check if a user is disabled or locked, group membership
|
23
|
+
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```bash
|
28
|
+
msad --help
|
29
|
+
```
|
30
|
+
|
31
|
+
```text
|
32
|
+
COMMAND is one of the following:
|
33
|
+
|
34
|
+
add_member
|
35
|
+
Adds the user to a group (using DN or sAMAccountName)
|
36
|
+
|
37
|
+
change_password
|
38
|
+
|
39
|
+
check_user
|
40
|
+
Get some info about a user: is it locked? disabled? password expired?
|
41
|
+
|
42
|
+
group_flat_members
|
43
|
+
Extract all the (nested) members of a group
|
44
|
+
|
45
|
+
group_member
|
46
|
+
Check if the user is a member of a group (using DN or sAMAccountName)
|
47
|
+
|
48
|
+
group_members
|
49
|
+
Extract the direct members of a group
|
50
|
+
|
51
|
+
has_expired_password
|
52
|
+
Check is user has the expired password
|
53
|
+
|
54
|
+
has_never_expires_password
|
55
|
+
Check if a user has never expires password
|
56
|
+
|
57
|
+
is_disabled
|
58
|
+
Check if a user is disabled
|
59
|
+
|
60
|
+
is_locked
|
61
|
+
Check if the user is locked
|
62
|
+
|
63
|
+
remove_member
|
64
|
+
Remove the user from a group (using DN or sAMAccountName)
|
65
|
+
|
66
|
+
search
|
67
|
+
|
68
|
+
user_groups
|
69
|
+
Extract the list of groups of a user (using DN or sAMAccountName)
|
70
|
+
|
71
|
+
users
|
72
|
+
Find users inside AD. The filter can be the cn or userPrincipalName or samaccoutnname or mail to be searched. Can contain *
|
73
|
+
|
74
|
+
```
|
75
|
+
|
76
|
+
## Sample
|
77
|
+
|
78
|
+
I find useful to add an alias in my ~/.bash_aliases
|
79
|
+
|
80
|
+
```bash
|
81
|
+
alias msad='/usr/local/bin/msad --host=dmc1it.group.redaelli.org --port=636 --search_base dc=group,dc=redaelli,dc=org'
|
82
|
+
```
|
83
|
+
|
84
|
+
Retreive info about a user
|
85
|
+
|
86
|
+
```bash
|
87
|
+
msad check_user matteo 90 \[qliksense_analyzer,qliksense_professional\] 2>/dev/null
|
88
|
+
```
|
89
|
+
|
90
|
+
```json
|
91
|
+
{"is_disabled": false}
|
92
|
+
{"is_locked": false}
|
93
|
+
{"has_never_expires_password": false}
|
94
|
+
{"has_expired_password": false}
|
95
|
+
{"membership_qliksense_analyzer": false}
|
96
|
+
{"membership_qliksense_professional": true}
|
97
|
+
```
|
98
|
+
|
99
|
+
Getting nested group members (it is a pages search, it can retreive more than 1000 users)
|
100
|
+
|
101
|
+
```bash
|
102
|
+
msad --out_format csv --attributes samaccountname,mail,sn,givenName group_flat_members "dc=group,dc=redaelli,dc=org" --group_name "qliksense_admin"
|
103
|
+
```
|
104
|
+
|
105
|
+
|
106
|
+
## License
|
107
|
+
|
108
|
+
Copyright © 2021 2022 Matteo Redaelli
|
109
|
+
|
110
|
+
This program is free software: you can redistribute it and/or modify
|
111
|
+
it under the terms of the GNU General Public License as published by
|
112
|
+
the Free Software Foundation, either version 3 of the License, or
|
113
|
+
(at your option) any later version.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
LICENSE
|
2
|
+
README.md
|
3
|
+
pyproject.toml
|
4
|
+
src/msad/__init__.py
|
5
|
+
src/msad/ad.py
|
6
|
+
src/msad/command_line.py
|
7
|
+
src/msad/group.py
|
8
|
+
src/msad/search.py
|
9
|
+
src/msad/user.py
|
10
|
+
src/msad.egg-info/PKG-INFO
|
11
|
+
src/msad.egg-info/SOURCES.txt
|
12
|
+
src/msad.egg-info/dependency_links.txt
|
13
|
+
src/msad.egg-info/entry_points.txt
|
14
|
+
src/msad.egg-info/top_level.txt
|
msad-0.2.0/PKG-INFO
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: msad
|
3
|
-
Version: 0.2.0
|
4
|
-
Summary: msad is a library and commandline for interacting with Active Directory
|
5
|
-
Home-page: https://github.com/matteoredaelli/msad
|
6
|
-
Author: Matteo Redaelli
|
7
|
-
Author-email: matteo.redaelli@gmail.com
|
8
|
-
License: GPL
|
9
|
-
Platform: UNKNOWN
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
11
|
-
Classifier: Operating System :: OS Independent
|
12
|
-
Requires-Python: >=3.6
|
13
|
-
Description-Content-Type: text/markdown
|
14
|
-
License-File: LICENSE
|
15
|
-
|
16
|
-
# msAD
|
17
|
-
|
18
|
-
|
19
|
-
msad is a library and command line tool for working with an Active Directory / LDAP server. It can be used for:
|
20
|
-
- search objects (users, groups, computers,..)
|
21
|
-
- search group members
|
22
|
-
- add/remove members to/from AD groups using DN or sAMaccoutName
|
23
|
-
- change AD passwords
|
24
|
-
- check if a user is disabled or locked, group membership
|
25
|
-
|
26
|
-
## Install
|
27
|
-
|
28
|
-
```bash
|
29
|
-
pip install msad
|
30
|
-
```
|
31
|
-
|
32
|
-
## Usage
|
33
|
-
|
34
|
-
I find useful to add an alias in my ~/.bash_aliases
|
35
|
-
|
36
|
-
```bash
|
37
|
-
alias msad='/usr/local/bin/msad --host=dmc1it.group.redaelli.org --port=636 --search_base dc=group,dc=redaelli,dc=org'
|
38
|
-
```
|
39
|
-
|
40
|
-
Retreive info about a user
|
41
|
-
|
42
|
-
```bash
|
43
|
-
msad check_user matteo 90 \[qliksense_analyzer,qliksense_professional\] 2>/dev/null
|
44
|
-
```
|
45
|
-
|
46
|
-
```json
|
47
|
-
{"is_disabled": false}
|
48
|
-
{"is_locked": false}
|
49
|
-
{"has_never_expires_password": false}
|
50
|
-
{"has_expired_password": false}
|
51
|
-
{"membership_qliksense_analyzer": false}
|
52
|
-
{"membership_qliksense_professional": true}
|
53
|
-
```
|
54
|
-
|
55
|
-
## License
|
56
|
-
|
57
|
-
Copyright © 2021 Matteo Redaelli
|
58
|
-
|
59
|
-
This program is free software: you can redistribute it and/or modify
|
60
|
-
it under the terms of the GNU General Public License as published by
|
61
|
-
the Free Software Foundation, either version 3 of the License, or
|
62
|
-
(at your option) any later version.
|
63
|
-
|
64
|
-
|
msad-0.2.0/README.md
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# msAD
|
2
|
-
|
3
|
-
|
4
|
-
msad is a library and command line tool for working with an Active Directory / LDAP server. It can be used for:
|
5
|
-
- search objects (users, groups, computers,..)
|
6
|
-
- search group members
|
7
|
-
- add/remove members to/from AD groups using DN or sAMaccoutName
|
8
|
-
- change AD passwords
|
9
|
-
- check if a user is disabled or locked, group membership
|
10
|
-
|
11
|
-
## Install
|
12
|
-
|
13
|
-
```bash
|
14
|
-
pip install msad
|
15
|
-
```
|
16
|
-
|
17
|
-
## Usage
|
18
|
-
|
19
|
-
I find useful to add an alias in my ~/.bash_aliases
|
20
|
-
|
21
|
-
```bash
|
22
|
-
alias msad='/usr/local/bin/msad --host=dmc1it.group.redaelli.org --port=636 --search_base dc=group,dc=redaelli,dc=org'
|
23
|
-
```
|
24
|
-
|
25
|
-
Retreive info about a user
|
26
|
-
|
27
|
-
```bash
|
28
|
-
msad check_user matteo 90 \[qliksense_analyzer,qliksense_professional\] 2>/dev/null
|
29
|
-
```
|
30
|
-
|
31
|
-
```json
|
32
|
-
{"is_disabled": false}
|
33
|
-
{"is_locked": false}
|
34
|
-
{"has_never_expires_password": false}
|
35
|
-
{"has_expired_password": false}
|
36
|
-
{"membership_qliksense_analyzer": false}
|
37
|
-
{"membership_qliksense_professional": true}
|
38
|
-
```
|
39
|
-
|
40
|
-
## License
|
41
|
-
|
42
|
-
Copyright © 2021 Matteo Redaelli
|
43
|
-
|
44
|
-
This program is free software: you can redistribute it and/or modify
|
45
|
-
it under the terms of the GNU General Public License as published by
|
46
|
-
the Free Software Foundation, either version 3 of the License, or
|
47
|
-
(at your option) any later version.
|
@@ -1,64 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: msad
|
3
|
-
Version: 0.2.0
|
4
|
-
Summary: msad is a library and commandline for interacting with Active Directory
|
5
|
-
Home-page: https://github.com/matteoredaelli/msad
|
6
|
-
Author: Matteo Redaelli
|
7
|
-
Author-email: matteo.redaelli@gmail.com
|
8
|
-
License: GPL
|
9
|
-
Platform: UNKNOWN
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
11
|
-
Classifier: Operating System :: OS Independent
|
12
|
-
Requires-Python: >=3.6
|
13
|
-
Description-Content-Type: text/markdown
|
14
|
-
License-File: LICENSE
|
15
|
-
|
16
|
-
# msAD
|
17
|
-
|
18
|
-
|
19
|
-
msad is a library and command line tool for working with an Active Directory / LDAP server. It can be used for:
|
20
|
-
- search objects (users, groups, computers,..)
|
21
|
-
- search group members
|
22
|
-
- add/remove members to/from AD groups using DN or sAMaccoutName
|
23
|
-
- change AD passwords
|
24
|
-
- check if a user is disabled or locked, group membership
|
25
|
-
|
26
|
-
## Install
|
27
|
-
|
28
|
-
```bash
|
29
|
-
pip install msad
|
30
|
-
```
|
31
|
-
|
32
|
-
## Usage
|
33
|
-
|
34
|
-
I find useful to add an alias in my ~/.bash_aliases
|
35
|
-
|
36
|
-
```bash
|
37
|
-
alias msad='/usr/local/bin/msad --host=dmc1it.group.redaelli.org --port=636 --search_base dc=group,dc=redaelli,dc=org'
|
38
|
-
```
|
39
|
-
|
40
|
-
Retreive info about a user
|
41
|
-
|
42
|
-
```bash
|
43
|
-
msad check_user matteo 90 \[qliksense_analyzer,qliksense_professional\] 2>/dev/null
|
44
|
-
```
|
45
|
-
|
46
|
-
```json
|
47
|
-
{"is_disabled": false}
|
48
|
-
{"is_locked": false}
|
49
|
-
{"has_never_expires_password": false}
|
50
|
-
{"has_expired_password": false}
|
51
|
-
{"membership_qliksense_analyzer": false}
|
52
|
-
{"membership_qliksense_professional": true}
|
53
|
-
```
|
54
|
-
|
55
|
-
## License
|
56
|
-
|
57
|
-
Copyright © 2021 Matteo Redaelli
|
58
|
-
|
59
|
-
This program is free software: you can redistribute it and/or modify
|
60
|
-
it under the terms of the GNU General Public License as published by
|
61
|
-
the Free Software Foundation, either version 3 of the License, or
|
62
|
-
(at your option) any later version.
|
63
|
-
|
64
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
LICENSE
|
2
|
-
README.md
|
3
|
-
setup.cfg
|
4
|
-
setup.py
|
5
|
-
msad/__init__.py
|
6
|
-
msad/ad.py
|
7
|
-
msad/command_line.py
|
8
|
-
msad/group.py
|
9
|
-
msad/search.py
|
10
|
-
msad/user.py
|
11
|
-
msad.egg-info/PKG-INFO
|
12
|
-
msad.egg-info/SOURCES.txt
|
13
|
-
msad.egg-info/dependency_links.txt
|
14
|
-
msad.egg-info/entry_points.txt
|
15
|
-
msad.egg-info/requires.txt
|
16
|
-
msad.egg-info/top_level.txt
|
msad-0.2.0/setup.cfg
DELETED
msad-0.2.0/setup.py
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# Copyright (c) 2021 Matteo Redaelli
|
2
|
-
#
|
3
|
-
# This program is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
import setuptools
|
17
|
-
|
18
|
-
with open("README.md", "r") as fh:
|
19
|
-
long_description = fh.read()
|
20
|
-
|
21
|
-
setuptools.setup(
|
22
|
-
name="msad",
|
23
|
-
version="0.2.0",
|
24
|
-
author="Matteo Redaelli",
|
25
|
-
author_email="matteo.redaelli@gmail.com",
|
26
|
-
description="msad is a library and commandline for interacting with Active Directory",
|
27
|
-
long_description=long_description,
|
28
|
-
long_description_content_type="text/markdown",
|
29
|
-
url="https://github.com/matteoredaelli/msad",
|
30
|
-
packages=setuptools.find_packages(),
|
31
|
-
license="GPL",
|
32
|
-
entry_points={
|
33
|
-
"console_scripts": ["msad=msad.command_line:main"],
|
34
|
-
},
|
35
|
-
classifiers=[
|
36
|
-
"Programming Language :: Python :: 3",
|
37
|
-
"Operating System :: OS Independent",
|
38
|
-
],
|
39
|
-
install_requires=["ldap3", "fire"],
|
40
|
-
python_requires=">=3.6",
|
41
|
-
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|