scapy.modules.ticketer

Create/Edit Kerberos ticket using Scapy

See https://scapy.readthedocs.io/en/latest/layers/kerberos.html

class scapy.modules.ticketer.CCAddress(_pkt, /, *, addrtype=0, address=<CCCountedOctetString  |>)[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            ADDRTYPE           |            ADDRESS            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. CCAddress                          
CCAddress fields

addrtype

ShortEnumField

0

address

PacketField

<CCCountedOctetString  |>

guess_payload_class(payload)[source]
class scapy.modules.ticketer.CCAuthData(_pkt, /, *, authtype=0, authdata=<CCCountedOctetString  |>)[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            AUTHTYPE           |            AUTHDATA           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. CCAuthData                          
CCAuthData fields

authtype

ShortEnumField

0

authdata

PacketField

<CCCountedOctetString  |>

guess_payload_class(payload)[source]
class scapy.modules.ticketer.CCCountedOctetString(_pkt, /, *, length=None, data=b'')[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             LENGTH                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              DATA             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                    Fig. CCCountedOctetString                     
CCCountedOctetString fields

length

FieldLenField

None

data

StrLenField

b''

guess_payload_class(payload)[source]
class scapy.modules.ticketer.CCCredential(_pkt, /, *, client=<CCPrincipal  realm=<CCCountedOctetString  |> |>, server=<CCPrincipal  realm=<CCCountedOctetString  |> |>, keyblock=<CCKeyBlock  |>, authtime=None, starttime=None, endtime=None, renew_till=None, is_skey=0, ticket_flags=<Flag 0 ()>, num_address=None, addrs=[], num_authdata=None, authdata=[], ticket=<CCCountedOctetString  |>, second_ticket=<CCCountedOctetString  |>)[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             CLIENT            |             SERVER            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            KEYBLOCK           |            AUTHTIME           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |           STARTTIME           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |            ENDTIME            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |           RENEW TILL          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |    IS SKEY    |  TICKET FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                               |  NUM ADDRESS  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                               |     ADDRS     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |                  NUM AUTHDATA                 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |            AUTHDATA           |     TICKET    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |         SECOND TICKET         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. CCCredential                         
CCCredential fields

client

PacketField

<CCPrincipal  realm=<CCCountedOctetString  |> |>

server

PacketField

<CCPrincipal  realm=<CCCountedOctetString  |> |>

keyblock

PacketField

<CCKeyBlock  |>

authtime

UTCTimeField

None

starttime

UTCTimeField

None

endtime

UTCTimeField

None

renew_till

UTCTimeField

None

is_skey

ByteField

0

ticket_flags

FlagsField

<Flag 0 ()>

num_address

FieldLenField

None

addrs

PacketListField

[]

num_authdata

FieldLenField

None

authdata

PacketListField

[]

ticket

PacketField

<CCCountedOctetString  |>

second_ticket

PacketField

<CCCountedOctetString  |>

guess_payload_class(payload)[source]
set_from_krb(tkt, clientpart, sessionkey, kdcrep)[source]
class scapy.modules.ticketer.CCDeltaTime(_pkt, /, *, time_offset=0, usec_offset=0)[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          TIME OFFSET                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          USEC OFFSET                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. CCDeltaTime                         
CCDeltaTime fields

time_offset

IntField

0

usec_offset

IntField

0

guess_payload_class(payload)[source]
class scapy.modules.ticketer.CCHeader(_pkt, /, *, tag=1, taglen=8, tagdata=<CCDeltaTime  |>)[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              TAG              |             TAGLEN            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            TAGDATA            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. CCHeader                           
CCHeader fields

tag

ShortEnumField

1

taglen

ShortField

8

tagdata

PacketField

<CCDeltaTime  |>

guess_payload_class(payload)[source]
class scapy.modules.ticketer.CCKeyBlock(_pkt, /, *, keytype=0, etype=0, keylen=None, keyvalue=b'')[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            KEYTYPE            |             ETYPE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             KEYLEN            |            KEYVALUE           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. CCKeyBlock                          
CCKeyBlock fields

keytype

ShortEnumField

0

etype

ShortField

0

keylen

FieldLenField

None

keyvalue

StrLenField

b''

guess_payload_class(payload)[source]
toKey()[source]
class scapy.modules.ticketer.CCPrincipal(_pkt, /, *, name_type=0, num_components=None, realm=<CCCountedOctetString  |>, components=[])[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           NAME TYPE                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         NUM COMPONENTS                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             REALM             |           COMPONENTS          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. CCPrincipal                         
CCPrincipal fields

name_type

IntEnumField

0

num_components

FieldLenField

None

realm

PacketField

<CCCountedOctetString  |>

components

PacketListField

[]

guess_payload_class(payload)[source]
toPN()[source]
class scapy.modules.ticketer.CCache(_pkt, /, *, file_format_version=1284, headerlen=0, headers=[], primary_principal=<CCPrincipal  realm=<CCCountedOctetString  |> |>, credentials=[])[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      FILE FORMAT VERSION      |           HEADERLEN           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            HEADERS            |       PRIMARY PRINCIPAL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          CREDENTIALS          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                           Fig. CCache                            
CCache fields

file_format_version

ShortField

1284

headerlen

ShortField

0

headers

PacketListField

[]

primary_principal

PacketField

<CCPrincipal  realm=<CCCountedOctetString  |> |>

credentials

PacketListField

[]

class scapy.modules.ticketer.KTCountedOctetString(_pkt, /, *, length=None, data=b'')[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             LENGTH            |              DATA             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                    Fig. KTCountedOctetString                     
KTCountedOctetString fields

length

FieldLenField

None

data

StrLenField

b''

guess_payload_class(payload)[source]
class scapy.modules.ticketer.KTKeyBlock(_pkt, /, *, keytype=0, keylen=None, keyvalue=b'')[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            KEYTYPE            |             KEYLEN            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            KEYVALUE           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. KTKeyBlock                          
KTKeyBlock fields

keytype

ShortEnumField

0

keylen

FieldLenField

None

keyvalue

StrLenField

b''

guess_payload_class(payload)[source]
toKey()[source]
class scapy.modules.ticketer.Keytab(_pkt, /, *, file_format_version=1282, entries=[])[source]

Bases: Packet

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      FILE FORMAT VERSION      |            ENTRIES            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                           Fig. Keytab                            
Keytab fields

file_format_version

ShortField

1282

entries

PacketListField

[]

class scapy.modules.ticketer.KeytabEntry(_pkt, /, *, size=None, num_components=None, realm=<KTCountedOctetString  |>, components=[], name_type=0, timestamp=None, vno8=0, key=<KTKeyBlock  |>, vno=None)[source]

Bases: Packet

aliastypes
extract_padding(s: bytes) Tuple[bytes, bytes][source]
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              SIZE                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         NUM COMPONENTS        |             REALM             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           COMPONENTS          |           NAME TYPE           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |           TIMESTAMP           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |      VNO8     |      KEY      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |                      VNO                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |
+-+-+-+-+-+-+-+-+

                         Fig. KeytabEntry                         
KeytabEntry fields

size

IntField

None

num_components

FieldLenField

None

realm

PacketField

<KTCountedOctetString  |>

components

PacketListField

[]

name_type

IntField (Cond)

0

timestamp

UTCTimeField

None

vno8

ByteField

0

key

MayEnd

<KTKeyBlock  |>

vno

IntField (Cond)

None

getPrincipal()[source]
post_build(p: bytes, pay: bytes) bytes[source]
property versionNumber
class scapy.modules.ticketer.ScrollFrame(parent)[source]

Bases: Frame

onCanvasConfigure(event)[source]

Reset the canvas window to encompass inner frame when required

onEnter(event)[source]
onFrameConfigure(event)[source]

Reset the scroll region to encompass the inner frame

onLeave(event)[source]
onMouseWheel(event)[source]
class scapy.modules.ticketer.Ticketer[source]

Bases: object

add_cred(principal, mapupn=None, password=None, salt=None, key=None, etypes=None, kvno=None)[source]

Add a credential to the Keytab.

create_ticket(**kwargs)[source]

Create a Kerberos ticket

dec_ticket(i, key=None, hash=None)[source]

Get the decrypted ticket by credentials ID

edit_ticket(i, key=None, hash=None)[source]

Edit a Kerberos ticket using the GUI

export_krb(i)[source]

Export a full ticket, session key, UPN and SPN.

get_cred(principal, etype=None)[source]

Get credential from the Keytab by principal.

import_krb(res, key=None, hash=None, _inplace=None)[source]

Import the result of krb_[tgs/as]_req or a Ticket into the CCache.

Parameters:
  • obj – a KRB_Ticket object or a AS_REP/TGS_REP object

  • sessionkey – the session key that comes along the ticket

iter_tickets()[source]

Iterate through the tickets in the ccache

kpasswdset(i, targetupn=None, newpassword=None)[source]

Use kpasswd in ‘Set Password’ mode to set the password of an account.

Parameters:

i – the TGT to use.

open_ccache(fname)[source]

Load from CCache file

open_keytab(fname)[source]

Load from Keytab file

remove_krb(i)[source]

Remove a ticket from the store.

Parameters:

i – the ticket to remove.

renew(i, ip=None, additional_tickets=[], **kwargs)[source]

Renew a Kerberos TGT or a TS from the local CCache using a TGS-REQ

Parameters:

i – the ticket/sessionkey to renew.

request_st(i, spn, ip=None, renew=False, realm=None, additional_tickets=None, fast=False, armor_with=None, for_user=None, s4u2proxy=None, **kwargs)[source]

Request a Kerberos TS and add it to the local CCache using another ticket.

Parameters:
  • i – the index of the ticket/sessionkey to use in the TGS request.

  • spn – the SPN to request a ticket for.

  • armor_with – the index of the ticket/sessionkey to armor this request.

  • s4u2proxy – if an index, the index of the additional ticket to send along a S4U2PROXY request. If True, it will use additional_tickets as usual.

  • for_user – if provided, requests S4U2SELF for that user.

See krb_tgs_req() for the the other parameters.

request_tgt(upn, ip=None, key=None, password=None, realm=None, fast=False, armor_with=None, spn=None, x509=None, x509key=None, p12=None, **kwargs)[source]

Request a Kerberos TGT and add it to the local CCache

See krb_as_req() for the full documentation.

resign_ticket(i, hash=None, kdc_hash=None)[source]

Resign a ticket from CCache

Parameters:
  • hash – the hash to use to compute the Server Signature

  • kdc_hash – the hash to use to compute the KDC signature (if None, not recomputed unless its a TGT where is uses hash)

save_ccache(fname=None, i=None)[source]

Save ccache into file

Parameters:
  • fname – if provided, save to a specific file.

  • i – if provided, only save the ticket n°i.

save_keytab(fname=None)[source]

Save keytab into file

Parameters:

fname – if provided, save to a specific file.

show(utc=False)[source]

Show the content of a CCache

ssp(i, **kwargs)[source]

Create a KerberosSSP from a ticket or from the keystore.

Parameters:

i – index of the ticket to use from ccache (client) OR SPN of the key to use from the keystore (server)

update_ticket(i, decTkt, resign=False, hash=None, kdc_hash=None)[source]

Update a decrypted ticket by credentials ID