| 182 | |
| 183 | |
| 184 | class _TLSPadField(StrField): |
| 185 | def i2len(self, pkt, i): |
| 186 | if i is not None: |
| 187 | return len(i) |
| 188 | return 0 |
| 189 | |
| 190 | def i2m(self, pkt, x): |
| 191 | if x is None: |
| 192 | return b"" |
| 193 | return x |
| 194 | |
| 195 | def addfield(self, pkt, s, val): |
| 196 | # We add nothing here. This is done in .post_build() if needed. |
| 197 | return s |
| 198 | |
| 199 | def getfield(self, pkt, s): |
| 200 | if pkt.tls_session.consider_read_padding(): |
| 201 | # This should work with SSLv3 and also TLS versions. |
| 202 | # Note that we need to retrieve pkt.padlen beforehand, |
| 203 | # because it's possible that the padding is followed by some data |
| 204 | # from another TLS record (hence the last byte from s would not be |
| 205 | # the last byte from the current record padding). |
| 206 | tmp_len = orb(s[pkt.padlen - 1]) |
| 207 | return s[tmp_len:], self.m2i(pkt, s[:tmp_len]) |
| 208 | return s, None |
| 209 | |
| 210 | def i2repr(self, pkt, x): |
| 211 | # XXX Provide status when dissection has been performed successfully? |
| 212 | return repr(self.i2m(pkt, x)) |
| 213 | |
| 214 | |
| 215 | class _TLSPadLenField(ByteField): |
no outgoing calls
no test coverage detected
searching dependent graphs…