gam7 7.20.4__py3-none-any.whl → 7.21.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.
Potentially problematic release.
This version of gam7 might be problematic. Click here for more details.
- gam/__init__.py +168 -174
- gam/gamlib/glverlibs.py +1 -1
- gam/gamlib/yubikey.py +13 -12
- {gam7-7.20.4.dist-info → gam7-7.21.0.dist-info}/METADATA +2 -2
- {gam7-7.20.4.dist-info → gam7-7.21.0.dist-info}/RECORD +8 -9
- gam/gamlib/gliso8601.py +0 -159
- {gam7-7.20.4.dist-info → gam7-7.21.0.dist-info}/WHEEL +0 -0
- {gam7-7.20.4.dist-info → gam7-7.21.0.dist-info}/entry_points.txt +0 -0
- {gam7-7.20.4.dist-info → gam7-7.21.0.dist-info}/licenses/LICENSE +0 -0
gam/gamlib/glverlibs.py
CHANGED
gam/gamlib/yubikey.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
|
|
3
|
-
# Copyright (C)
|
|
3
|
+
# Copyright (C) 2025 Ross Scroggs All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# All Rights Reserved.
|
|
6
6
|
#
|
|
@@ -19,11 +19,20 @@
|
|
|
19
19
|
"""YubiKey"""
|
|
20
20
|
|
|
21
21
|
import base64
|
|
22
|
-
import datetime
|
|
23
22
|
from secrets import SystemRandom
|
|
24
23
|
import string
|
|
25
24
|
import sys
|
|
26
25
|
|
|
26
|
+
import arrow
|
|
27
|
+
|
|
28
|
+
from gam import mplock
|
|
29
|
+
|
|
30
|
+
from gam import systemErrorExit
|
|
31
|
+
from gam import readStdin
|
|
32
|
+
from gam import writeStdout
|
|
33
|
+
|
|
34
|
+
from gam.gamlib import glmsgs as Msg
|
|
35
|
+
|
|
27
36
|
from cryptography.hazmat.primitives import hashes, serialization
|
|
28
37
|
from cryptography.hazmat.primitives.asymmetric import padding
|
|
29
38
|
from smartcard.Exceptions import CardConnectionException
|
|
@@ -49,14 +58,6 @@ YUBIKEY_VALUE_ERROR_RC = 85
|
|
|
49
58
|
YUBIKEY_MULTIPLE_CONNECTED_RC = 86
|
|
50
59
|
YUBIKEY_NOT_FOUND_RC = 87
|
|
51
60
|
|
|
52
|
-
from gam import mplock
|
|
53
|
-
|
|
54
|
-
from gam import systemErrorExit
|
|
55
|
-
from gam import readStdin
|
|
56
|
-
from gam import writeStdout
|
|
57
|
-
|
|
58
|
-
from gam.gamlib import glmsgs as Msg
|
|
59
|
-
|
|
60
61
|
PIN_PUK_CHARS = string.ascii_letters+string.digits+string.punctuation
|
|
61
62
|
|
|
62
63
|
class YubiKey():
|
|
@@ -155,8 +156,8 @@ class YubiKey():
|
|
|
155
156
|
KEY_TYPE.RSA2048,
|
|
156
157
|
PIN_POLICY.ALWAYS,
|
|
157
158
|
TOUCH_POLICY.NEVER)
|
|
158
|
-
now =
|
|
159
|
-
valid_to = now
|
|
159
|
+
now = arrow.utcnow()
|
|
160
|
+
valid_to = now.shift(days=36500)
|
|
160
161
|
subject = 'CN=GAM Created Key'
|
|
161
162
|
piv.authenticate(MANAGEMENT_KEY_TYPE.TDES, DEFAULT_MANAGEMENT_KEY)
|
|
162
163
|
piv.verify_pin(new_pin)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gam7
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.21.0
|
|
4
4
|
Summary: CLI tool to manage Google Workspace
|
|
5
5
|
Project-URL: Homepage, https://github.com/GAM-team/GAM
|
|
6
6
|
Project-URL: Issues, https://github.com/GAM-team/GAM/issues
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
20
|
Requires-Python: >=3.9
|
|
21
|
+
Requires-Dist: arrow>=1.3.0
|
|
21
22
|
Requires-Dist: chardet>=5.2.0
|
|
22
23
|
Requires-Dist: cryptography>=44.0.2
|
|
23
24
|
Requires-Dist: distro; sys_platform == 'linux'
|
|
@@ -30,7 +31,6 @@ Requires-Dist: httplib2>=0.22.0
|
|
|
30
31
|
Requires-Dist: lxml>=5.4.0
|
|
31
32
|
Requires-Dist: passlib>=1.7.4
|
|
32
33
|
Requires-Dist: pathvalidate>=3.2.3
|
|
33
|
-
Requires-Dist: python-dateutil
|
|
34
34
|
Provides-Extra: yubikey
|
|
35
35
|
Requires-Dist: yubikey-manager>=5.6.1; extra == 'yubikey'
|
|
36
36
|
Description-Content-Type: text/markdown
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
gam/__init__.py,sha256=
|
|
1
|
+
gam/__init__.py,sha256=Z6eQpJ0CV7t39PSXBOoVWv-qUvDONbGgGH1ntSFyy_g,3609270
|
|
2
2
|
gam/__main__.py,sha256=amz0-959ph6zkZKqjaar4n60yho-T37w6qWI36qx0CA,1049
|
|
3
3
|
gam/cacerts.pem,sha256=DUsVo2XlFYwfkhe3gnxa-Km4Z4noz74hSApXwTT-nQE,44344
|
|
4
4
|
gam/cbcm-v1.1beta1.json,sha256=xO5XloCQQULmPbFBx5bckdqmbLFQ7sJ2TImhE1ysDIY,19439
|
|
@@ -30,12 +30,11 @@ gam/gamlib/glgapi.py,sha256=pdBbwNtnCwFWxJGaP-_3hdTjSNoOCJF2yo76WdQOi1k,40426
|
|
|
30
30
|
gam/gamlib/glgdata.py,sha256=weRppttWm6uRyqtBoGPKoHiNZ2h28nhfUV4J_mbCszY,2707
|
|
31
31
|
gam/gamlib/glglobals.py,sha256=oJfaLUQj46XqwrOzRfWhGqO0f1P26xjJZefaILJUFGE,9695
|
|
32
32
|
gam/gamlib/glindent.py,sha256=RfBa2LDfLIqPLL5vMfC689TCVmqn8xf-qulSzkiatrc,1228
|
|
33
|
-
gam/gamlib/gliso8601.py,sha256=DJNe9WgQZeWKj3ZKLqpDoDmXYjuc1UUEAqmDTramCGw,4360
|
|
34
33
|
gam/gamlib/glmsgs.py,sha256=ODq-KS3jhXH5DB5DEo6eCX1DHhy4OGv_jeQjiLVPOHM,34049
|
|
35
34
|
gam/gamlib/glskus.py,sha256=29vlBLBJCL4u9GawCt3eNeZq9HQG3hGFZk9-EainNng,15384
|
|
36
35
|
gam/gamlib/gluprop.py,sha256=IyPLCyvn7-NHTUenM71YPQPXRZXx6CB5q-GtJ-FYd1c,11461
|
|
37
|
-
gam/gamlib/glverlibs.py,sha256=
|
|
38
|
-
gam/gamlib/yubikey.py,sha256
|
|
36
|
+
gam/gamlib/glverlibs.py,sha256=mDphdXVN_dJlGUVGuLqOEA3yHBNBeqRV4DRoTX7Wl7A,982
|
|
37
|
+
gam/gamlib/yubikey.py,sha256=UNPaeSx0y6_v1RnShO1e9ZyVSHni6sGvOgcEwktlCeE,7896
|
|
39
38
|
gam/gdata/__init__.py,sha256=uvjmSza2EdL7lGaoJ04-uXHGeYa0i1dBQHIetBybcUQ,29637
|
|
40
39
|
gam/gdata/service.py,sha256=CuImJDRVcNMM1dfo7V6T0LrztzqTNrIraaLkHXpL0Tw,70045
|
|
41
40
|
gam/gdata/urlfetch.py,sha256=yAglxcDC3sCp763P9dXOVwKMjrHvwKRoVSMv_G3Rt8E,9308
|
|
@@ -48,8 +47,8 @@ gam/gdata/apps/audit/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrK
|
|
|
48
47
|
gam/gdata/apps/audit/service.py,sha256=Z1eueThcNeVUMWP1DRWc_DGHrJCiJI8W_xj6L-cqu-Q,9658
|
|
49
48
|
gam/gdata/apps/contacts/__init__.py,sha256=Um6zgIkiahZns7yAEuC3pxHSMD8iciZ_EoynSLoYPfU,30463
|
|
50
49
|
gam/gdata/apps/contacts/service.py,sha256=5lNb-Ii1Gyek6ePFji3kyoYtCBc8CuJTwagx2BL2o14,15684
|
|
51
|
-
gam7-7.
|
|
52
|
-
gam7-7.
|
|
53
|
-
gam7-7.
|
|
54
|
-
gam7-7.
|
|
55
|
-
gam7-7.
|
|
50
|
+
gam7-7.21.0.dist-info/METADATA,sha256=tmmcQbL-FSaDd14t67qZkJUPxCUZ0BhqL2Jqw-pXoH8,2937
|
|
51
|
+
gam7-7.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
52
|
+
gam7-7.21.0.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
|
|
53
|
+
gam7-7.21.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
54
|
+
gam7-7.21.0.dist-info/RECORD,,
|
gam/gamlib/gliso8601.py
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""ISO 8601 date time string parsing
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from datetime import (datetime, timedelta, tzinfo)
|
|
7
|
-
import time as _time
|
|
8
|
-
import re
|
|
9
|
-
|
|
10
|
-
ISO8601_REGEX = re.compile(r'^(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})(?P<separator>[ T])(?P<hour>[0-9]{2}):(?P<minute>[0-9]{2}):(?P<second>[0-9]{2})([.,](?P<second_fraction>[0-9]+)){0,1}(?P<timezone>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9]{2}):(?P<tz_minute>[0-9]{2}))$')
|
|
11
|
-
ISO8601_TZ_REGEX = re.compile(r'^(?P<timezone>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9]{2}):(?P<tz_minute>[0-9]{2}))$')
|
|
12
|
-
|
|
13
|
-
class ParseError(Exception):
|
|
14
|
-
"""Raised when there is a problem parsing a date string"""
|
|
15
|
-
|
|
16
|
-
# Yoinked from python docs
|
|
17
|
-
ZERO = timedelta(0)
|
|
18
|
-
class Utc(tzinfo):
|
|
19
|
-
"""UTC Timezone
|
|
20
|
-
|
|
21
|
-
"""
|
|
22
|
-
def utcoffset(self, dt):
|
|
23
|
-
return ZERO
|
|
24
|
-
|
|
25
|
-
def tzname(self, dt):
|
|
26
|
-
return "UTC"
|
|
27
|
-
|
|
28
|
-
def dst(self, dt):
|
|
29
|
-
return ZERO
|
|
30
|
-
|
|
31
|
-
def __repr__(self):
|
|
32
|
-
return "<iso8601.Utc>"
|
|
33
|
-
|
|
34
|
-
UTC = Utc()
|
|
35
|
-
|
|
36
|
-
class FixedOffset(tzinfo):
|
|
37
|
-
"""Fixed offset in hours and minutes from UTC
|
|
38
|
-
|
|
39
|
-
"""
|
|
40
|
-
def __init__(self, offset_hours, offset_minutes, name):
|
|
41
|
-
self.__offset_hours = offset_hours # Keep for later __getinitargs__
|
|
42
|
-
self.__offset_minutes = offset_minutes # Keep for later __getinitargs__
|
|
43
|
-
self.__offset = timedelta(hours=offset_hours, minutes=offset_minutes)
|
|
44
|
-
self.__name = name
|
|
45
|
-
|
|
46
|
-
def __eq__(self, other):
|
|
47
|
-
if isinstance(other, FixedOffset):
|
|
48
|
-
return (other.__offset == self.__offset) and (other.__name == self.__name)
|
|
49
|
-
if isinstance(other, tzinfo):
|
|
50
|
-
return other == self
|
|
51
|
-
return False
|
|
52
|
-
|
|
53
|
-
def __getinitargs__(self):
|
|
54
|
-
return (self.__offset_hours, self.__offset_minutes, self.__name)
|
|
55
|
-
|
|
56
|
-
def utcoffset(self, dt):
|
|
57
|
-
return self.__offset
|
|
58
|
-
|
|
59
|
-
def tzname(self, dt):
|
|
60
|
-
return self.__name
|
|
61
|
-
|
|
62
|
-
def dst(self, dt):
|
|
63
|
-
return ZERO
|
|
64
|
-
|
|
65
|
-
def __repr__(self):
|
|
66
|
-
return "<FixedOffset %r %r>" % (self.__name, self.__offset)
|
|
67
|
-
|
|
68
|
-
# A class capturing the platform's idea of local time.
|
|
69
|
-
|
|
70
|
-
STDOFFSET = timedelta(seconds = -_time.timezone)
|
|
71
|
-
if _time.daylight:
|
|
72
|
-
DSTOFFSET = timedelta(seconds = -_time.altzone)
|
|
73
|
-
else:
|
|
74
|
-
DSTOFFSET = STDOFFSET
|
|
75
|
-
|
|
76
|
-
DSTDIFF = DSTOFFSET - STDOFFSET
|
|
77
|
-
|
|
78
|
-
class LocalTimezone(tzinfo):
|
|
79
|
-
"""Local time zone
|
|
80
|
-
|
|
81
|
-
"""
|
|
82
|
-
|
|
83
|
-
def utcoffset(self, dt):
|
|
84
|
-
if self._isdst(dt):
|
|
85
|
-
return DSTOFFSET
|
|
86
|
-
else:
|
|
87
|
-
return STDOFFSET
|
|
88
|
-
|
|
89
|
-
def dst(self, dt):
|
|
90
|
-
if self._isdst(dt):
|
|
91
|
-
return DSTDIFF
|
|
92
|
-
else:
|
|
93
|
-
return ZERO
|
|
94
|
-
|
|
95
|
-
def tzname(self, dt):
|
|
96
|
-
return _time.tzname[self._isdst(dt)]
|
|
97
|
-
|
|
98
|
-
def _isdst(self, dt):
|
|
99
|
-
tt = (dt.year, dt.month, dt.day,
|
|
100
|
-
dt.hour, dt.minute, dt.second,
|
|
101
|
-
dt.weekday(), 0, 0)
|
|
102
|
-
stamp = _time.mktime(tt)
|
|
103
|
-
tt = _time.localtime(stamp)
|
|
104
|
-
return tt.tm_isdst > 0
|
|
105
|
-
|
|
106
|
-
Local = LocalTimezone()
|
|
107
|
-
|
|
108
|
-
def parse_timezone(matches):
|
|
109
|
-
"""Parses ISO 8601 time zone specs into tzinfo offsets
|
|
110
|
-
|
|
111
|
-
"""
|
|
112
|
-
|
|
113
|
-
if matches["timezone"] == "Z":
|
|
114
|
-
return UTC
|
|
115
|
-
sign = matches["tz_sign"]
|
|
116
|
-
hours = int(matches['tz_hour'])
|
|
117
|
-
minutes = int(matches['tz_minute'])
|
|
118
|
-
description = "%s%02d:%02d" % (sign, hours, minutes)
|
|
119
|
-
if sign == "-":
|
|
120
|
-
hours = -hours
|
|
121
|
-
minutes = -minutes
|
|
122
|
-
return FixedOffset(hours, minutes, description)
|
|
123
|
-
|
|
124
|
-
def parse_timezone_str(tzstring):
|
|
125
|
-
m = ISO8601_TZ_REGEX.match(tzstring)
|
|
126
|
-
if not m:
|
|
127
|
-
raise ParseError("Unable to parse timezone string %r" % tzstring)
|
|
128
|
-
groups = m.groupdict()
|
|
129
|
-
return parse_timezone(groups)
|
|
130
|
-
|
|
131
|
-
def parse_date(datestring):
|
|
132
|
-
"""Parses ISO 8601 dates into datetime objects
|
|
133
|
-
|
|
134
|
-
The timezone is parsed from the date string. However it is quite common to
|
|
135
|
-
have dates without a timezone (not strictly correct). In this case the
|
|
136
|
-
default timezone specified in default_timezone is used. This is UTC by
|
|
137
|
-
default.
|
|
138
|
-
|
|
139
|
-
:param datestring: The date to parse as a string
|
|
140
|
-
:returns: A datetime.datetime instance
|
|
141
|
-
:raises: ParseError when there is a problem parsing the date or
|
|
142
|
-
constructing the datetime instance.
|
|
143
|
-
|
|
144
|
-
"""
|
|
145
|
-
m = ISO8601_REGEX.match(datestring)
|
|
146
|
-
if not m:
|
|
147
|
-
raise ParseError("Unable to parse date string %r" % datestring)
|
|
148
|
-
groups = m.groupdict()
|
|
149
|
-
tz = parse_timezone(groups)
|
|
150
|
-
try:
|
|
151
|
-
return datetime(year=int(groups['year']),
|
|
152
|
-
month=int(groups['month']),
|
|
153
|
-
day=int(groups['day']),
|
|
154
|
-
hour=int(groups['hour']),
|
|
155
|
-
minute=int(groups['minute']),
|
|
156
|
-
second=int(groups['second']),
|
|
157
|
-
tzinfo=tz)
|
|
158
|
-
except Exception as e:
|
|
159
|
-
raise ParseError(e)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|