Sniffer Update

1. Collect the SSL Info capture into its own function.
2. Add a Trace function for the SSL Info.
3. When copying the IANA name for the cipher suite, use a strncpy
instead of a memcpy and cap the copy at the length of the destination.
Force a null terminator at the end of the destination, just in case.
4. Modify the snifftest to collect the SSL Info.
This commit is contained in:
John Safranek
2018-11-21 11:29:28 -08:00
parent 3599798aac
commit 96b4ddad82
2 changed files with 53 additions and 18 deletions

View File

@@ -295,6 +295,7 @@ int main(int argc, char** argv)
static int packetNumber = 0;
struct pcap_pkthdr header;
const unsigned char* packet = pcap_next(pcap, &header);
SSLInfo sslInfo;
packetNumber++;
if (packet) {
@@ -307,7 +308,8 @@ int main(int argc, char** argv)
else
continue;
ret = ssl_DecodePacket(packet, header.caplen, &data, err);
ret = ssl_DecodePacketWithSessionInfo(packet, header.caplen, &data,
&sslInfo, err);
if (ret < 0) {
printf("ssl_Decode ret = %d, %s\n", ret, err);
hadBadPacket = 1;