Skip to content

Commit ff96859

Browse files
committed
Fix show() on non-UTC Kerberos
1 parent eae1567 commit ff96859

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

scapy/modules/ticketer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def save(self, fname=None):
368368
with open(self.fname, "wb") as fd:
369369
return fd.write(bytes(self.ccache))
370370

371-
def show(self):
371+
def show(self, utc=False):
372372
"""
373373
Show the content of a CCache
374374
"""
@@ -382,7 +382,10 @@ def _to_str(x):
382382
if x is None:
383383
return "None"
384384
else:
385-
x = datetime.fromtimestamp(x)
385+
x = datetime.fromtimestamp(
386+
x,
387+
tz=timezone.utc if utc else None
388+
)
386389
return x.strftime("%d/%m/%y %H:%M:%S")
387390

388391
for i, cred in enumerate(self.ccache.credentials):

test/scapy/layers/kerberos.uts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ with mock.patch('scapy.libs.rfc3961.os.urandom', side_effect=fake_random):
914914
= Ticketer++ - Call show()
915915

916916
with ContextManagerCaptureOutput() as cmco:
917-
t.show()
917+
t.show(utc=True)
918918
outp = cmco.get_output().strip()
919919

920920
print(outp)

0 commit comments

Comments
 (0)