增加对ssh协议支持

This commit is contained in:
fumingwei
2020-04-07 13:54:16 +08:00
parent e6eab6d0e6
commit d8127ce551
6 changed files with 44 additions and 3 deletions

22
src/tsg_ssh_utils.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#include "tsg_ssh_utils.h"
#define SSH_PROTOCOL_FIELD "SSH"
#define SSH_PROTOCOL_FIELD_LEN 3
int ssh_protocol_identify(const unsigned char* buff, size_t buff_len, void* argp)
{
void *logger=argp;
if(buff == NULL || buff_len < SSH_PROTOCOL_FIELD_LEN)
{
return -1;
}
if(memcmp((void *)buff,SSH_PROTOCOL_FIELD, SSH_PROTOCOL_FIELD_LEN) == 0)
return 1;
else
return 0;
}