scapy.contrib.automotive.xcp.xcp

class scapy.contrib.automotive.xcp.xcp.CTORequest(_pkt, /, *, pid=191)[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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      PID      |
+-+-+-+-+-+-+-+-+

                         Fig. CTORequest                          
CTORequest fields

pid

ByteEnumField

191

payload_guess

Possible sublayers: AllocDaq, AllocOdtEntry, AllocOdt, BuildChecksum, ClearDaqList, Connect, CopyCalPage, Disconnect, DownloadMax, DownloadNext, Download, FreeDaq, GetCalPage, GetCommModeInfo, GetDaqClock, GetDaqEventInfo, GetDaqListInfo, GetDaqListMode, GetDaqProcessorInfo, GetDaqResolutionInfo, GetId, GetPagProcessorInfo, GetPageInfo, GetPgmProcessorInfo, GetSectorInfo, GetSeed, GetSegmentInfo, GetSegmentMode, GetStatus, ModifyBits, ProgramClear, ProgramFormat, ProgramMax, ProgramNext, ProgramPrepare, ProgramReset, ProgramStart, ProgramVerify, Program, ReadDaq, SetCalPage, SetDaqListMode, SetDaqPtr, SetMta, SetRequest, SetSegmentMode, ShortDownload, ShortUpload, StartStopDaqList, StartStopSynch, Synch, TransportLayerCmdGetDAQId, TransportLayerCmdGetSlaveId, TransportLayerCmdSetDAQId, TransportLayerCmd, Unlock, Upload, UserCmd, WriteDaq, DTO

pids = {0: 'STIM', 1: 'STIM', 2: 'STIM', 3: 'STIM', 4: 'STIM', 5: 'STIM', 6: 'STIM', 7: 'STIM', 8: 'STIM', 9: 'STIM', 10: 'STIM', 11: 'STIM', 12: 'STIM', 13: 'STIM', 14: 'STIM', 15: 'STIM', 16: 'STIM', 17: 'STIM', 18: 'STIM', 19: 'STIM', 20: 'STIM', 21: 'STIM', 22: 'STIM', 23: 'STIM', 24: 'STIM', 25: 'STIM', 26: 'STIM', 27: 'STIM', 28: 'STIM', 29: 'STIM', 30: 'STIM', 31: 'STIM', 32: 'STIM', 33: 'STIM', 34: 'STIM', 35: 'STIM', 36: 'STIM', 37: 'STIM', 38: 'STIM', 39: 'STIM', 40: 'STIM', 41: 'STIM', 42: 'STIM', 43: 'STIM', 44: 'STIM', 45: 'STIM', 46: 'STIM', 47: 'STIM', 48: 'STIM', 49: 'STIM', 50: 'STIM', 51: 'STIM', 52: 'STIM', 53: 'STIM', 54: 'STIM', 55: 'STIM', 56: 'STIM', 57: 'STIM', 58: 'STIM', 59: 'STIM', 60: 'STIM', 61: 'STIM', 62: 'STIM', 63: 'STIM', 64: 'STIM', 65: 'STIM', 66: 'STIM', 67: 'STIM', 68: 'STIM', 69: 'STIM', 70: 'STIM', 71: 'STIM', 72: 'STIM', 73: 'STIM', 74: 'STIM', 75: 'STIM', 76: 'STIM', 77: 'STIM', 78: 'STIM', 79: 'STIM', 80: 'STIM', 81: 'STIM', 82: 'STIM', 83: 'STIM', 84: 'STIM', 85: 'STIM', 86: 'STIM', 87: 'STIM', 88: 'STIM', 89: 'STIM', 90: 'STIM', 91: 'STIM', 92: 'STIM', 93: 'STIM', 94: 'STIM', 95: 'STIM', 96: 'STIM', 97: 'STIM', 98: 'STIM', 99: 'STIM', 100: 'STIM', 101: 'STIM', 102: 'STIM', 103: 'STIM', 104: 'STIM', 105: 'STIM', 106: 'STIM', 107: 'STIM', 108: 'STIM', 109: 'STIM', 110: 'STIM', 111: 'STIM', 112: 'STIM', 113: 'STIM', 114: 'STIM', 115: 'STIM', 116: 'STIM', 117: 'STIM', 118: 'STIM', 119: 'STIM', 120: 'STIM', 121: 'STIM', 122: 'STIM', 123: 'STIM', 124: 'STIM', 125: 'STIM', 126: 'STIM', 127: 'STIM', 128: 'STIM', 129: 'STIM', 130: 'STIM', 131: 'STIM', 132: 'STIM', 133: 'STIM', 134: 'STIM', 135: 'STIM', 136: 'STIM', 137: 'STIM', 138: 'STIM', 139: 'STIM', 140: 'STIM', 141: 'STIM', 142: 'STIM', 143: 'STIM', 144: 'STIM', 145: 'STIM', 146: 'STIM', 147: 'STIM', 148: 'STIM', 149: 'STIM', 150: 'STIM', 151: 'STIM', 152: 'STIM', 153: 'STIM', 154: 'STIM', 155: 'STIM', 156: 'STIM', 157: 'STIM', 158: 'STIM', 159: 'STIM', 160: 'STIM', 161: 'STIM', 162: 'STIM', 163: 'STIM', 164: 'STIM', 165: 'STIM', 166: 'STIM', 167: 'STIM', 168: 'STIM', 169: 'STIM', 170: 'STIM', 171: 'STIM', 172: 'STIM', 173: 'STIM', 174: 'STIM', 175: 'STIM', 176: 'STIM', 177: 'STIM', 178: 'STIM', 179: 'STIM', 180: 'STIM', 181: 'STIM', 182: 'STIM', 183: 'STIM', 184: 'STIM', 185: 'STIM', 186: 'STIM', 187: 'STIM', 188: 'STIM', 189: 'STIM', 190: 'STIM', 191: 'STIM', 199: 'WRITE_DAQ_MULTIPLE', 200: 'PROGRAM_VERIFY', 201: 'PROGRAM_MAX', 202: 'PROGRAM_NEXT', 203: 'PROGRAM_FORMAT', 204: 'PROGRAM_PREPARE', 205: 'GET_SECTOR_INFO', 206: 'GET_PGM_PROCESSOR_INFO', 207: 'PROGRAM_RESET', 208: 'PROGRAM', 209: 'PROGRAM_CLEAR', 210: 'PROGRAM_START', 211: 'ALLOC_ODT_ENTRY', 212: 'ALLOC_ODT', 213: 'ALLOC_DAQ', 214: 'FREE_DAQ', 215: 'GET_DAQ_EVENT_INFO', 216: 'GET_DAQ_LIST_INFO', 217: 'GET_DAQ_RESOLUTION_INFO', 218: 'GET_DAQ_PROCESSOR_INFO', 219: 'READ_DAQ', 220: 'GET_DAQ_CLOCK', 221: 'START_STOP_SYNCH', 222: 'START_STOP_DAQ_LIST', 223: 'GET_DAQ_LIST_MODE', 224: 'SET_DAQ_LIST_MODE', 225: 'WRITE_DAQ', 226: 'SET_DAQ_PTR', 227: 'CLEAR_DAQ_LIST', 228: 'COPY_CAL_PAGE', 229: 'GET_SEGMENT_MODE', 230: 'SET_SEGMENT_MODE', 231: 'GET_PAGE_INFO', 232: 'GET_SEGMENT_INFO', 233: 'GET_PAG_PROCESSOR_INFO', 234: 'GET_CAL_PAGE', 235: 'SET_CAL_PAGE', 236: 'MODIFY_BITS', 237: 'SHORT_DOWNLOAD', 238: 'DOWNLOAD_MAX', 239: 'DOWNLOAD_NEXT', 240: 'DOWNLOAD', 241: 'USER_CMD', 242: 'TRANSPORT_LAYER_CMD', 243: 'BUILD_CHECKSUM', 244: 'SHORT_UPLOAD', 245: 'UPLOAD', 246: 'SET_MTA', 247: 'UNLOCK', 248: 'GET_SEED', 249: 'SET_REQUEST', 250: 'GET_ID', 251: 'GET_COMM_MODE_INFO', 252: 'SYNCH', 253: 'GET_STATUS', 254: 'DISCONNECT', 255: 'CONNECT'}
class scapy.contrib.automotive.xcp.xcp.CTOResponse(_pkt, /, *, packet_code=255)[source]

Bases: Packet

aliastypes
answers(request)[source]

In XCP, the payload of a response packet is dependent on the pid field of the corresponding request. This method changes the class of the payload to the class which is expected for the given request.

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  PACKET CODE  |
+-+-+-+-+-+-+-+-+

                         Fig. CTOResponse                         
CTOResponse fields

packet_code

ByteEnumField

255

static get_positive_response_cls(request)[source]
packet_codes = {252: 'SERV', 253: 'EV', 254: 'ERR', 255: 'RES'}
payload_guess

Possible sublayers: EvPacket, NegativeResponse, ServPacket, DTO

class scapy.contrib.automotive.xcp.xcp.DTO(_pkt, /, *, fill=0, daq=b'', timestamp=b'', 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      FILL     |              DAQ              |   TIMESTAMP   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |              DATA             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                             Fig. DTO                             
DTO fields

fill

XByteField (Cond)

0

daq

StrLenField (Cond)

b''

timestamp

StrLenField (Cond)

b''

data

StrLenField (Cond)

b''

class scapy.contrib.automotive.xcp.xcp.XCPOnCAN(_pkt, /, *, flags=<Flag 0 ()>, identifier=0, length=None, reserved=0)[source]

Bases: CAN

aliastypes
extract_padding(p)[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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|FLAGS|                        IDENTIFIER                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     LENGTH    |                    RESERVED                   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |
+-+-+-+-+-+-+-+-+

                          Fig. XCPOnCAN                           
XCPOnCAN fields

flags

FlagsField

<Flag 0 ()>

identifier

XBitField (29 bits)

0

length

ByteField

None

reserved

ThreeBytesField

0

payload_guess

Possible sublayers: CTOResponse

post_build(pkt, pay)[source]
class scapy.contrib.automotive.xcp.xcp.XCPOnCANTail(_pkt, /, *, control_field=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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         CONTROL FIELD         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. XCPOnCANTail                         
XCPOnCANTail fields

control_field

StrField

b''

class scapy.contrib.automotive.xcp.xcp.XCPOnTCP(_pkt, /, *, sport=20, dport=80, seq=0, ack=0, dataofs=None, reserved=0, flags=<Flag 2 (S)>, window=8192, chksum=None, urgptr=0, options=b'', length=None, ctr=0)[source]

Bases: TCP

aliastypes
answers(other)[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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             SPORT             |             DPORT             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              SEQ                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              ACK                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|DATAOFS|RESER|      FLAGS      |             WINDOW            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             CHKSUM            |             URGPTR            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            OPTIONS            |             LENGTH            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              CTR              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. XCPOnTCP                           
XCPOnTCP fields

sport

ShortEnumField

20

dport

ShortEnumField

80

seq

IntField

0

ack

IntField

0

dataofs

BitField (4 bits)

None

reserved

BitField (3 bits)

0

flags

FlagsField

<Flag 2 (S)>

window

ShortField

8192

chksum

XShortField

None

urgptr

ShortField

0

options

TCPOptionsField

b''

length

ShortField

None

ctr

ShortField

0

payload_guess

Possible sublayers: HSFZ, DoIP, SOMEIP, CTOResponse

post_build(pkt, pay)[source]
class scapy.contrib.automotive.xcp.xcp.XCPOnUDP(_pkt, /, *, sport=53, dport=53, len=None, chksum=None, length=None, ctr=0)[source]

Bases: UDP

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             SPORT             |             DPORT             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              LEN              |             CHKSUM            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             LENGTH            |              CTR              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. XCPOnUDP                           
XCPOnUDP fields

sport

ShortEnumField

53

dport

ShortEnumField

53

len

ShortField

None

chksum

XShortField

None

length

ShortField

None

ctr

ShortField

0

payload_guess

Possible sublayers: PDUTransport, DoIP, SOMEIP, CTOResponse, GRE

post_build(pkt, pay)[source]