MCPcopy Index your code
hub / github.com/secdev/scapy / Ticketer

Class Ticketer

scapy/modules/ticketer.py:439–2598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437
438
439class Ticketer:
440 def __init__(self):
441 self._data = collections.defaultdict(dict)
442 self.ccache_fname = None
443 self.ccache = CCache()
444 self.keytab_fname = None
445 self.keytab = Keytab()
446 self.hashes_cache = collections.defaultdict(dict)
447
448 def open_ccache(self, fname):
449 """
450 Load from CCache file
451 """
452 self.ccache_fname = fname
453 self.hashes_cache = collections.defaultdict(dict)
454 with open(self.ccache_fname, "rb") as fd:
455 self.ccache = CCache(fd.read())
456
457 def open_keytab(self, fname):
458 """
459 Load from Keytab file
460 """
461 self.keytab_fname = fname
462 with open(self.keytab_fname, "rb") as fd:
463 self.keytab = Keytab(fd.read())
464
465 def save_ccache(self, fname=None, i=None):
466 """
467 Save ccache into file
468
469 :param fname: if provided, save to a specific file.
470 :param i: if provided, only save the ticket n°i.
471 """
472 if fname:
473 self.ccache_fname = fname
474 if not self.ccache_fname:
475 raise ValueError("No file opened. Specify the 'fname' argument !")
476
477 # If i is specified, extract single ticket.
478 if i is not None:
479 ccache = self.ccache.copy()
480 ccache.credentials = [ccache.credentials[i]]
481 else:
482 ccache = self.ccache
483
484 # Write
485 with open(self.ccache_fname, "wb") as fd:
486 return fd.write(bytes(ccache))
487
488 def save_keytab(self, fname=None):
489 """
490 Save keytab into file
491
492 :param fname: if provided, save to a specific file.
493 """
494 if fname:
495 self.keytab_fname = fname
496 if not self.keytab_fname:

Callers 1

from_cli_argumentsMethod · 0.90

Calls 1

UTCTimeFieldClass · 0.90

Tested by

no test coverage detected