msad 0.4.5__py3-none-any.whl → 0.5.0__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.
- msad/main.py +0 -56
- msad/user.py +4 -8
- {msad-0.4.5.dist-info → msad-0.5.0.dist-info}/METADATA +1 -1
- msad-0.5.0.dist-info/RECORD +12 -0
- msad-0.4.5.dist-info/RECORD +0 -12
- {msad-0.4.5.dist-info → msad-0.5.0.dist-info}/WHEEL +0 -0
- {msad-0.4.5.dist-info → msad-0.5.0.dist-info}/entry_points.txt +0 -0
- {msad-0.4.5.dist-info → msad-0.5.0.dist-info}/licenses/LICENSE +0 -0
msad/main.py
CHANGED
@@ -157,62 +157,6 @@ def _pprint(ldapresult, out_format="json", sep="\t"):
|
|
157
157
|
result = result + sep.join(new_values) + "\n"
|
158
158
|
return result
|
159
159
|
|
160
|
-
# def users(self, user):
|
161
|
-
# """Find users inside AD. The
|
162
|
-
# filter can be the cn or userPrincipalName or samaccoutnname or mail to be searched. Can contain *
|
163
|
-
# """
|
164
|
-
# result = msad.users(
|
165
|
-
# self._conn, self._search_base, user, attributes=self._attributes
|
166
|
-
# )
|
167
|
-
# return self._pprint(result)
|
168
|
-
|
169
|
-
# def is_disabled(self, user):
|
170
|
-
# """Check if a user is disabled"""
|
171
|
-
# return msad.user.is_disabled(self._conn, self._search_base, user)
|
172
|
-
|
173
|
-
# def is_locked(self, user):
|
174
|
-
# """Check if the user is locked"""
|
175
|
-
# return msad.user.is_locked(self._conn, self._search_base, user)
|
176
|
-
|
177
|
-
# def password_changed_in_days(self, user):
|
178
|
-
# return msad.user.password_changed_in_days(self._conn, self._search_base, user)
|
179
|
-
|
180
|
-
# def has_expired_password(self, user, max_age):
|
181
|
-
# """Check is user has the expired password"""
|
182
|
-
# return msad.has_expired_password(self._conn, self._search_base, user, max_age)
|
183
|
-
|
184
|
-
# def has_never_expires_password(self, user):
|
185
|
-
# """Check if a user has never expires password"""
|
186
|
-
# return msad.has_never_expires_password(self._conn, self._search_base, user)
|
187
|
-
|
188
|
-
# def check_user(self, user, max_age, groups=[]):
|
189
|
-
# """Get some info about a user: is it locked? disabled? password expired?"""
|
190
|
-
# return msad.check_user(self._conn, self._search_base, user, max_age, groups)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
# def user_groups(self, user_name=None, user_dn=None):
|
195
|
-
# """Extract the list of groups of a user (using DN or sAMAccountName)"""
|
196
|
-
# return msad.user.user_groups(
|
197
|
-
# self._conn, self._search_base, self._limit, user_name, user_dn
|
198
|
-
# )
|
199
|
-
|
200
|
-
|
201
|
-
# def group_member(
|
202
|
-
# self, group_name=None, group_dn=None, user_name=None, user_dn=None
|
203
|
-
# ):
|
204
|
-
# """Check if the user is a member of a group (using DN or sAMAccountName)"""
|
205
|
-
# return msad.group_member(
|
206
|
-
# conn=self._conn,
|
207
|
-
# search_base=self._search_base,
|
208
|
-
# group_name=group_name,
|
209
|
-
# group_dn=group_dn,
|
210
|
-
# user_name=user_name,
|
211
|
-
# user_dn=user_dn,
|
212
|
-
# )
|
213
|
-
|
214
|
-
|
215
|
-
|
216
160
|
app = typer.Typer()
|
217
161
|
|
218
162
|
@app.command()
|
msad/user.py
CHANGED
@@ -69,7 +69,7 @@ def has_never_expires_password(conn, search_base: str, user: str):
|
|
69
69
|
return True if len(result) == 1 else None
|
70
70
|
|
71
71
|
|
72
|
-
def password_changed_in_days(conn, search_base: str, user: str
|
72
|
+
def password_changed_in_days(conn, search_base: str, user: str):
|
73
73
|
# return search(conn, search_base, search_filter, attributes=attributes)
|
74
74
|
search_filter = f"(samaccountname={user})"
|
75
75
|
result = search(
|
@@ -83,12 +83,11 @@ def password_changed_in_days(conn, search_base: str, user: str, max_age: int, li
|
|
83
83
|
now = datetime.datetime.now()
|
84
84
|
|
85
85
|
if result == 0:
|
86
|
-
return
|
86
|
+
return "Unknown"
|
87
87
|
else:
|
88
88
|
delta = now - result.replace(tzinfo=None)
|
89
89
|
days = delta.days
|
90
|
-
return
|
91
|
-
|
90
|
+
return days
|
92
91
|
|
93
92
|
def check_user(conn, search_base:str, user:str, max_age:int, groups=[]):
|
94
93
|
# result = {}
|
@@ -102,10 +101,7 @@ def check_user(conn, search_base:str, user:str, max_age:int, groups=[]):
|
|
102
101
|
}
|
103
102
|
)
|
104
103
|
yield (
|
105
|
-
{"password_changed_in_days": password_changed_in_days(conn, search_base, user
|
106
|
-
)
|
107
|
-
yield (
|
108
|
-
{"has_expired_password": has_expired_password(conn, search_base, user, max_age)}
|
104
|
+
{"password_changed_in_days": password_changed_in_days(conn, search_base, user)}
|
109
105
|
)
|
110
106
|
for group in groups:
|
111
107
|
yield (
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: msad
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.0
|
4
4
|
Summary: msad is a commandline for interacting with Active Directory
|
5
5
|
Project-URL: Homepage, https://github.com/matteoredaelli/msad
|
6
6
|
Project-URL: Issues, https://github.com/matteoredaelli/msad/issues
|
@@ -0,0 +1,12 @@
|
|
1
|
+
msad/__init__.py,sha256=DJ6egXlvzOK_k0XlN7BpmMRuwu4MM7eQoxLE0Ou-sLI,63
|
2
|
+
msad/__main__.py,sha256=RCZmmoCNOWC7rAfIDm_LaymsybXIzE6McYbUEEkf9P8,60
|
3
|
+
msad/ad.py,sha256=C3dknAgRY6Jnotk0RgPSye7uzNxUd-7B3oGloGR674E,5679
|
4
|
+
msad/group.py,sha256=3HNpXfYK4yXxDNsXn72JOZSMEwjj0kMiDvVBca1oVuI,2510
|
5
|
+
msad/main.py,sha256=JyLcTl9n2ERoJ4XE62Exd-Bv6q-srDbb4TrIsqh3jc8,8417
|
6
|
+
msad/search.py,sha256=ADbUD8j_Tbh2XIWUYiWcgkg6pmKDciIL3DnCHf_Twzs,3478
|
7
|
+
msad/user.py,sha256=PSBkica6EshYCeOnDDBwlijacvG4jY_v4mvlWNLibD4,4076
|
8
|
+
msad-0.5.0.dist-info/METADATA,sha256=PuBh9MISrSo6R9F0s2xuA9Pf_xN0BZ6MAoFVg_K6WMA,2378
|
9
|
+
msad-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
msad-0.5.0.dist-info/entry_points.txt,sha256=UKSjeppC0YX2dfybmBfxLXCqF_HMZFfPX1MRw88rtpI,39
|
11
|
+
msad-0.5.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
12
|
+
msad-0.5.0.dist-info/RECORD,,
|
msad-0.4.5.dist-info/RECORD
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
msad/__init__.py,sha256=DJ6egXlvzOK_k0XlN7BpmMRuwu4MM7eQoxLE0Ou-sLI,63
|
2
|
-
msad/__main__.py,sha256=RCZmmoCNOWC7rAfIDm_LaymsybXIzE6McYbUEEkf9P8,60
|
3
|
-
msad/ad.py,sha256=C3dknAgRY6Jnotk0RgPSye7uzNxUd-7B3oGloGR674E,5679
|
4
|
-
msad/group.py,sha256=3HNpXfYK4yXxDNsXn72JOZSMEwjj0kMiDvVBca1oVuI,2510
|
5
|
-
msad/main.py,sha256=5wBSPOZPkOnYfe-gow1YFt65FpawJooZ3eOKp_RFP0A,10573
|
6
|
-
msad/search.py,sha256=ADbUD8j_Tbh2XIWUYiWcgkg6pmKDciIL3DnCHf_Twzs,3478
|
7
|
-
msad/user.py,sha256=p6n9vQRo1xwccDZEcZPr-7NvU3zjMtidf0-gWtdmrrg,4250
|
8
|
-
msad-0.4.5.dist-info/METADATA,sha256=hC_5HkxKer445LubdECYUISFAr0XhIs3MuFGqHD46ek,2378
|
9
|
-
msad-0.4.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
-
msad-0.4.5.dist-info/entry_points.txt,sha256=UKSjeppC0YX2dfybmBfxLXCqF_HMZFfPX1MRw88rtpI,39
|
11
|
-
msad-0.4.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
12
|
-
msad-0.4.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|