| 1467 | SERVER_TO_CLIENT = 'sc' |
| 1468 | |
| 1469 | def __init__(self, connection: Connection, first_packet): |
| 1470 | self.connection = connection |
| 1471 | self.addr = first_packet.addr |
| 1472 | self.ts = first_packet.ts |
| 1473 | self.starttime = first_packet.ts |
| 1474 | self.endtime = first_packet.ts |
| 1475 | self.sip = first_packet.sip |
| 1476 | self.smac = first_packet.smac |
| 1477 | self.sport = first_packet.sport |
| 1478 | self.sipcc = first_packet.sipcc |
| 1479 | self.sipasn = first_packet.sipasn |
| 1480 | self.dip = first_packet.dip |
| 1481 | self.dmac = first_packet.dmac |
| 1482 | self.dport = first_packet.dport |
| 1483 | self.dipcc = first_packet.dipcc |
| 1484 | self.dipasn = first_packet.dipasn |
| 1485 | self.protocol = first_packet.protocol |
| 1486 | # self.ack_sequence_numbers = {} |
| 1487 | self.packets = [] |
| 1488 | # self.data_packets = [] |
| 1489 | self.__data_bytes = b'' |
| 1490 | |
| 1491 | # Used for data caching |
| 1492 | self._data = None |
| 1493 | self._segments = None |
| 1494 | |
| 1495 | # Maps sequence number with packets |
| 1496 | self._seq_map = {} |
| 1497 | self.seq_max = 0 |
| 1498 | self.seq_min = 0 |
| 1499 | |
| 1500 | # Used to indicate that a Blob should not be passed to next plugin. |
| 1501 | # Can theoretically be overruled in, say, a connection_handler to |
| 1502 | # force a Blob to be passed to next plugin. |
| 1503 | self.hidden = False |
| 1504 | |
| 1505 | if self.sip == self.connection.clientip and \ |
| 1506 | (not self.sport or self.sport == self.connection.clientport): |
| 1507 | # packet moving from client to server |
| 1508 | self.direction = self.CLIENT_TO_SERVER |
| 1509 | else: |
| 1510 | # packet moving from server to client |
| 1511 | self.direction = self.SERVER_TO_CLIENT |
| 1512 | |
| 1513 | self.add_packet(first_packet) |
| 1514 | |
| 1515 | @property |
| 1516 | def all_packets(self): |