184 static void AppLayerProtoDetectPEGetIpprotos(
AppProto alproto,
195 uint32_t buflen, uint16_t searchlen,
bool *rflow)
200 SCLogDebug(
"s->co->offset (%"PRIu16
") > searchlen (%"PRIu16
")",
204 if (s->
cd->
depth > searchlen) {
205 SCLogDebug(
"s->co->depth (%"PRIu16
") > searchlen (%"PRIu16
")",
210 const uint8_t *sbuf = buf + s->
cd->
offset;
212 SCLogDebug(
"s->co->offset (%"PRIu16
") s->cd->depth (%"PRIu16
")",
221 uint8_t direction = (
flags & (STREAM_TOSERVER | STREAM_TOCLIENT));
222 SCLogDebug(
"matching, s->direction %s, our dir %s",
223 (s->
direction & STREAM_TOSERVER) ?
"toserver" :
"toclient",
224 (
flags & STREAM_TOSERVER) ?
"toserver" :
"toclient");
229 SCLogDebug(
"direction is wrong, rflow = true");
235 SCLogDebug(
"PP can't be run yet as pp_min_depth %u > buflen %u",
243 SCLogDebug(
"found %s/%u, rdir %02x reverse_flow? %s",
245 (rdir && direction != rdir) ?
"true" :
"false");
246 *rflow = (rdir && direction != rdir);
253 SCLogDebug(
"depth reached and answer inconclusive: fail");
268 uint32_t buflen, uint8_t
flags,
AppProto *pm_results,
bool *rflow)
274 SCLogDebug(
"searchlen %u buflen %u", searchlen, buflen);
280 if (search_cnt == 0) {
288 memset(pm_results_bf, 0,
sizeof(pm_results_bf));
297 s, tctx, f,
flags, buf, buflen, searchlen, rflow);
300 if (AppProtoIsValid(
proto) &&
301 !(pm_results_bf[
proto / 8] & (1 << (
proto % 8))) )
303 pm_results[pm_matches++] =
proto;
309 if (pm_matches == 0 && buflen >= pm_ctx->
pp_max_len) {
321 const uint8_t *buf, uint32_t buflen, uint8_t
flags,
AppProto *pm_results,
bool *rflow)
336 if (
flags & STREAM_TOSERVER) {
344 m = PMGetProtoInspect(tctx, pm_ctx, mpm_tctx, f, buf, buflen,
flags, pm_results, rflow);
365 if (
flags & STREAM_TOSERVER) {
372 SCLogDebug(
"no matches and in midstream mode, lets try the "
373 "*patterns for the other side");
377 om = PMGetProtoInspect(
378 tctx, pm_ctx, mpm_tctx, f, buf, buflen,
flags, pm_results, rflow);
386 }
else if (om < 0 &&
m &&
m < 0) {
391 }
else if (om == 0 ||
m == 0) {
413 while (pp_port != NULL) {
414 if (pp_port->
dp != NULL && pp_port->
dp->
alproto == alproto) {
415 pp_elem = pp_port->
dp;
418 if (pp_port->
sp != NULL && pp_port->
sp->
alproto == alproto) {
419 pp_elem = pp_port->
sp;
422 pp_port = pp_port->
next;
425 SCReturnPtr(pp_elem,
"AppLayerProtoDetectProbingParserElement *");
445 while (pp_port != NULL) {
446 if (pp_port->
port == port || pp_port->
port == 0) {
449 pp_port = pp_port->
next;
453 SCReturnPtr(pp_port,
"AppLayerProtoDetectProbingParserPort *");
461 static AppProto AppLayerProtoDetectPEGetProto(
Flow *f, uint8_t ipproto, uint8_t
flags)
474 uint8_t
flags,
const uint8_t *buf, uint32_t buflen, uint32_t *alproto_masks, uint8_t *rdir)
477 if ((buflen < pe->min_depth) ||
489 if (AppProtoIsValid(alproto)) {
509 static AppProto AppLayerProtoDetectPPGetProto(
Flow *f,
const uint8_t *buf, uint32_t buflen,
510 uint8_t ipproto,
const uint8_t
flags,
bool *reverse_flow)
518 uint32_t *alproto_masks = NULL;
520 uint8_t idir = (
flags & (STREAM_TOSERVER | STREAM_TOCLIENT));
524 bool probe_is_found =
false;
531 (dir == STREAM_TOSERVER) ?
"toserver" :
"toclient");
533 if (dir == STREAM_TOSERVER) {
535 pp_port_dp = AppLayerProtoDetectGetProbingParsers(alpd_ctx.
ctx_pp, ipproto, dp);
537 if (pp_port_dp != NULL) {
538 SCLogDebug(
"toserver - Probing parser found for destination port %"PRIu16, dp);
541 pe1 = pp_port_dp->
dp;
543 SCLogDebug(
"toserver - No probing parser registered for dest port %"PRIu16, dp);
546 pp_port_sp = AppLayerProtoDetectGetProbingParsers(alpd_ctx.
ctx_pp, ipproto, sp);
547 if (pp_port_sp != NULL) {
548 SCLogDebug(
"toserver - Probing parser found for source port %"PRIu16, sp);
551 pe2 = pp_port_sp->
sp;
553 SCLogDebug(
"toserver - No probing parser registered for source port %"PRIu16, sp);
557 pp_port_dp = AppLayerProtoDetectGetProbingParsers(alpd_ctx.
ctx_pp, ipproto, dp);
563 if (pp_port_dp != NULL) {
564 SCLogDebug(
"toclient - Probing parser found for destination port %"PRIu16, dp);
567 pe1 = pp_port_dp->
dp;
569 SCLogDebug(
"toclient - No probing parser registered for dest port %"PRIu16, dp);
572 pp_port_sp = AppLayerProtoDetectGetProbingParsers(alpd_ctx.
ctx_pp, ipproto, sp);
573 if (pp_port_sp != NULL) {
574 SCLogDebug(
"toclient - Probing parser found for source port %"PRIu16, sp);
576 pe2 = pp_port_sp->
sp;
578 SCLogDebug(
"toclient - No probing parser registered for source port %"PRIu16, sp);
583 pe0 = AppLayerProtoDetectGetProbingParser(alpd_ctx.
ctx_pp, ipproto, f->
alproto_tc);
585 pe0 = AppLayerProtoDetectGetProbingParser(alpd_ctx.
ctx_pp, ipproto, f->
alproto_ts);
588 if (pe1 == NULL && pe2 == NULL && pe0 == NULL) {
589 SCLogDebug(
"%s - No probing parsers found for either port",
590 (dir == STREAM_TOSERVER) ?
"toserver":
"toclient");
593 probe_is_found =
true;
598 alproto = PPGetProto(pe0, f,
flags, buf, buflen, alproto_masks, &rdir);
599 if (AppProtoIsValid(alproto))
601 alproto = PPGetProto(pe1, f,
flags, buf, buflen, alproto_masks, &rdir);
602 if (AppProtoIsValid(alproto))
604 alproto = PPGetProto(pe2, f,
flags, buf, buflen, alproto_masks, &rdir);
605 if (AppProtoIsValid(alproto))
610 if (pp_port_dp && pp_port_sp)
617 if (alproto_masks[0] == mask) {
619 SCLogDebug(
"%s, mask is now %08x, needed %08x, so done",
620 (dir == STREAM_TOSERVER) ?
"toserver":
"toclient",
621 alproto_masks[0], mask);
624 (dir == STREAM_TOSERVER) ?
"toserver":
"toclient",
625 alproto_masks[0], mask);
631 if (idir == STREAM_TOSERVER) {
632 dir = STREAM_TOCLIENT;
634 dir = STREAM_TOSERVER;
636 SCLogDebug(
"no match + midstream, retry the other direction %s",
637 (dir == STREAM_TOSERVER) ?
"toserver" :
"toclient");
638 goto again_midstream;
639 }
else if (!probe_is_found) {
644 if (AppProtoIsValid(alproto) && rdir != 0 && rdir != idir) {
645 SCLogDebug(
"PP found %u, is reverse flow", alproto);
646 *reverse_flow =
true;
650 (idir == STREAM_TOSERVER) ?
"toserver":
"toclient", alproto_masks[0]);
656 static void AppLayerProtoDetectPPGetIpprotos(
AppProto alproto,
665 for (pp = alpd_ctx.
ctx_pp; pp != NULL; pp = pp->
next) {
666 for (pp_port = pp->
port; pp_port != NULL; pp_port = pp_port->
next) {
667 for (pp_pe = pp_port->
dp; pp_pe != NULL; pp_pe = pp_pe->
next) {
671 for (pp_pe = pp_port->
sp; pp_pe != NULL; pp_pe = pp_pe->
next) {
681 static uint32_t AppLayerProtoDetectProbingParserGetMask(
AppProto alproto)
686 FatalError(
"Unknown protocol detected - %u", alproto);
702 SCReturnPtr(p,
"AppLayerProtoDetectProbingParserElement");
723 SCReturnPtr(p,
"AppLayerProtoDetectProbingParserPort");
735 AppLayerProtoDetectProbingParserElementFree(e);
742 AppLayerProtoDetectProbingParserElementFree(e);
761 SCReturnPtr(p,
"AppLayerProtoDetectProbingParser");
771 AppLayerProtoDetectProbingParserPortFree(pt);
781 AppLayerProtoDetectProbingParserElementCreate(
AppProto alproto,
790 pe->
alproto_mask = AppLayerProtoDetectProbingParserGetMask(alproto);
795 if (max_depth != 0 && min_depth >= max_depth) {
797 "register the probing parser. min_depth >= max_depth");
800 if (alproto <= ALPROTO_UNKNOWN || alproto >=
ALPROTO_MAX) {
801 SCLogError(
"Invalid arguments sent to register "
802 "the probing parser. Invalid alproto - %d",
807 SCReturnPtr(pe,
"AppLayerProtoDetectProbingParserElement");
809 AppLayerProtoDetectProbingParserElementFree(pe);
810 SCReturnPtr(NULL,
"AppLayerProtoDetectProbingParserElement");
829 SCReturnPtr(new_pe,
"AppLayerProtoDetectProbingParserElement");
840 printf(
"\nProtocol Detection Configuration\n");
842 for ( ; pp != NULL; pp = pp->
next) {
844 if (pp->
ipproto == IPPROTO_TCP)
845 printf(
"IPProto: TCP\n");
846 else if (pp->
ipproto == IPPROTO_UDP)
847 printf(
"IPProto: UDP\n");
849 printf(
"IPProto: %"PRIu8
"\n", pp->
ipproto);
852 for ( ; pp_port != NULL; pp_port = pp_port->
next) {
853 if (pp_port->
dp != NULL) {
854 printf(
" Port: %"PRIu16
"\n", pp_port->
port);
856 printf(
" Destination port: (max-depth: %"PRIu16
", "
857 "mask - %"PRIu32
")\n",
861 for ( ; pp_pe != NULL; pp_pe = pp_pe->
next) {
864 printf(
" alproto: ALPROTO_HTTP1\n");
866 printf(
" alproto: ALPROTO_FTP\n");
868 printf(
" alproto: ALPROTO_FTPDATA\n");
870 printf(
" alproto: ALPROTO_SMTP\n");
872 printf(
" alproto: ALPROTO_TLS\n");
874 printf(
" alproto: ALPROTO_SSH\n");
876 printf(
" alproto: ALPROTO_IMAP\n");
878 printf(
" alproto: ALPROTO_JABBER\n");
880 printf(
" alproto: ALPROTO_SMB\n");
882 printf(
" alproto: ALPROTO_DCERPC\n");
884 printf(
" alproto: ALPROTO_IRC\n");
886 printf(
" alproto: ALPROTO_DNS\n");
888 printf(
" alproto: ALPROTO_MODBUS\n");
890 printf(
" alproto: ALPROTO_ENIP\n");
892 printf(
" alproto: ALPROTO_NFS\n");
894 printf(
" alproto: ALPROTO_NTP\n");
896 printf(
" alproto: ALPROTO_TFTP\n");
898 printf(
" alproto: ALPROTO_IKE\n");
900 printf(
" alproto: ALPROTO_KRB5\n");
902 printf(
" alproto: ALPROTO_DHCP\n");
904 printf(
" alproto: ALPROTO_QUIC\n");
906 printf(
" alproto: ALPROTO_SNMP\n");
908 printf(
" alproto: ALPROTO_SIP\n");
910 printf(
" alproto: ALPROTO_TEMPLATE\n");
912 printf(
" alproto: ALPROTO_RFB\n");
914 printf(
" alproto: ALPROTO_MQTT\n");
916 printf(
" alproto: ALPROTO_PGSQL\n");
918 printf(
" alproto: ALPROTO_TELNET\n");
920 printf(
" alproto: ALPROTO_DNP3\n");
922 printf(
" alproto: ALPROTO_BITTORRENT_DHT\n");
924 printf(
"impossible\n");
926 printf(
" port: %"PRIu16
"\n", pp_pe->
port);
928 printf(
" min_depth: %"PRIu32
"\n", pp_pe->
min_depth);
929 printf(
" max_depth: %"PRIu32
"\n", pp_pe->
max_depth);
935 if (pp_port->
sp == NULL) {
939 printf(
" Source port: (max-depth: %"PRIu16
", "
940 "mask - %"PRIu32
")\n",
944 for ( ; pp_pe != NULL; pp_pe = pp_pe->
next) {
947 printf(
" alproto: ALPROTO_HTTP1\n");
949 printf(
" alproto: ALPROTO_FTP\n");
951 printf(
" alproto: ALPROTO_FTPDATA\n");
953 printf(
" alproto: ALPROTO_SMTP\n");
955 printf(
" alproto: ALPROTO_TLS\n");
957 printf(
" alproto: ALPROTO_SSH\n");
959 printf(
" alproto: ALPROTO_IMAP\n");
961 printf(
" alproto: ALPROTO_JABBER\n");
963 printf(
" alproto: ALPROTO_SMB\n");
965 printf(
" alproto: ALPROTO_DCERPC\n");
967 printf(
" alproto: ALPROTO_IRC\n");
969 printf(
" alproto: ALPROTO_DNS\n");
971 printf(
" alproto: ALPROTO_MODBUS\n");
973 printf(
" alproto: ALPROTO_ENIP\n");
975 printf(
" alproto: ALPROTO_NFS\n");
977 printf(
" alproto: ALPROTO_NTP\n");
979 printf(
" alproto: ALPROTO_TFTP\n");
981 printf(
" alproto: ALPROTO_IKE\n");
983 printf(
" alproto: ALPROTO_KRB5\n");
985 printf(
" alproto: ALPROTO_QUIC\n");
987 printf(
" alproto: ALPROTO_DHCP\n");
989 printf(
" alproto: ALPROTO_SNMP\n");
991 printf(
" alproto: ALPROTO_SIP\n");
993 printf(
" alproto: ALPROTO_TEMPLATE\n");
995 printf(
" alproto: ALPROTO_RFB\n");
997 printf(
" alproto: ALPROTO_MQTT\n");
999 printf(
" alproto: ALPROTO_PGSQL\n");
1001 printf(
" alproto: ALPROTO_TELNET\n");
1003 printf(
" alproto: ALPROTO_DNP3\n");
1005 printf(
" alproto: ALPROTO_BITTORRENT_DHT\n");
1007 printf(
"impossible\n");
1009 printf(
" port: %"PRIu16
"\n", pp_pe->
port);
1011 printf(
" min_depth: %"PRIu32
"\n", pp_pe->
min_depth);
1012 printf(
" max_depth: %"PRIu32
"\n", pp_pe->
max_depth);
1028 if (*head_pe == NULL) {
1033 if ((*head_pe)->port == 0) {
1034 if (new_pe->
port != 0) {
1035 new_pe->
next = *head_pe;
1039 while (temp_pe->
next != NULL)
1040 temp_pe = temp_pe->
next;
1041 temp_pe->
next = new_pe;
1045 if (new_pe->
port == 0) {
1046 while (temp_pe->
next != NULL)
1047 temp_pe = temp_pe->
next;
1048 temp_pe->
next = new_pe;
1050 while (temp_pe->
next != NULL && temp_pe->
next->
port != 0)
1051 temp_pe = temp_pe->
next;
1053 temp_pe->
next = new_pe;
1067 if (*head_pp == NULL) {
1073 while (temp_pp->
next != NULL)
1074 temp_pp = temp_pp->
next;
1075 temp_pp->
next = new_pp;
1086 if (*head_port == NULL) {
1087 *head_port = new_port;
1091 if ((*head_port)->port == 0) {
1092 new_port->
next = *head_port;
1093 *head_port = new_port;
1096 while (temp_port->
next != NULL && temp_port->
next->
port != 0) {
1097 temp_port = temp_port->
next;
1100 temp_port->
next = new_port;
1111 uint16_t min_depth, uint16_t max_depth,
1120 while (curr_pp != NULL) {
1121 if (curr_pp->
ipproto == ipproto)
1123 curr_pp = curr_pp->
next;
1125 if (curr_pp == NULL) {
1128 AppLayerProtoDetectProbingParserAppend(pp, new_pp);
1134 while (curr_port != NULL) {
1135 if (curr_port->
port == port)
1137 curr_port = curr_port->
next;
1139 if (curr_port == NULL) {
1141 new_port->
port = port;
1142 AppLayerProtoDetectProbingParserPortAppend(&curr_pp->
port, new_port);
1143 curr_port = new_port;
1144 if (direction & STREAM_TOSERVER) {
1152 zero_port = curr_pp->
port;
1153 while (zero_port != NULL && zero_port->
port != 0) {
1154 zero_port = zero_port->
next;
1156 if (zero_port != NULL) {
1159 zero_pe = zero_port->
dp;
1160 for ( ; zero_pe != NULL; zero_pe = zero_pe->
next) {
1161 if (curr_port->
dp == NULL)
1171 AppLayerProtoDetectProbingParserElementDuplicate(zero_pe);
1172 AppLayerProtoDetectProbingParserElementAppend(&curr_port->
dp, dup_pe);
1176 zero_pe = zero_port->
sp;
1177 for ( ; zero_pe != NULL; zero_pe = zero_pe->
next) {
1178 if (curr_port->
sp == NULL)
1188 AppLayerProtoDetectProbingParserElementDuplicate(zero_pe);
1189 AppLayerProtoDetectProbingParserElementAppend(&curr_port->
sp, dup_pe);
1197 if (direction & STREAM_TOSERVER)
1198 curr_pe = curr_port->
dp;
1200 curr_pe = curr_port->
sp;
1201 while (curr_pe != NULL) {
1202 if (curr_pe->
alproto == alproto) {
1204 "ipproto - %" PRIu8
" Port - %" PRIu16
" "
1205 "App Protocol - NULL, App Protocol(ID) - "
1206 "%" PRIu16
" min_depth - %" PRIu16
" "
1207 "max_dept - %" PRIu16
".",
1208 ipproto, port, alproto, min_depth, max_depth);
1211 curr_pe = curr_pe->
next;
1215 AppLayerProtoDetectProbingParserElementCreate(alproto,
1217 min_depth, max_depth);
1222 if (direction & STREAM_TOSERVER) {
1225 if (curr_port->
dp == NULL)
1234 head_pe = &curr_port->
dp;
1238 if (curr_port->
sp == NULL)
1247 head_pe = &curr_port->
sp;
1249 AppLayerProtoDetectProbingParserElementAppend(head_pe, new_pe);
1251 if (curr_port->
port == 0) {
1253 while (temp_port != NULL && temp_port->
port != 0) {
1254 if (direction & STREAM_TOSERVER) {
1255 if (temp_port->
dp == NULL)
1263 AppLayerProtoDetectProbingParserElementAppend(&temp_port->
dp,
1264 AppLayerProtoDetectProbingParserElementDuplicate(curr_pe));
1267 if (temp_port->
sp == NULL)
1275 AppLayerProtoDetectProbingParserElementAppend(&temp_port->
sp,
1276 AppLayerProtoDetectProbingParserElementDuplicate(curr_pe));
1279 temp_port = temp_port->
next;
1289 static void AppLayerProtoDetectPMGetIpprotos(
AppProto alproto,
1296 for (
int j = 0; j < 2; j++) {
1302 ipprotos[ipproto / 8] |= 1 << (ipproto % 8);
1314 typedef struct TempContainer_ {
1316 uint16_t content_len;
1321 uint32_t struct_total_size = 0;
1322 uint32_t content_total_size = 0;
1324 uint8_t *ahb = NULL;
1325 uint8_t *content = NULL;
1326 uint16_t content_len = 0;
1328 TempContainer *struct_offset = NULL;
1329 uint8_t *content_offset = NULL;
1332 if (ctx->
head == NULL)
1335 for (s = ctx->
head; s != NULL; s = s->
next) {
1336 struct_total_size +=
sizeof(TempContainer);
1341 ahb =
SCMalloc(
sizeof(uint8_t) * (struct_total_size + content_total_size));
1345 struct_offset = (TempContainer *)ahb;
1346 content_offset = ahb + struct_total_size;
1347 for (s = ctx->
head; s != NULL; s = s->
next) {
1348 TempContainer *tcdup = (TempContainer *)ahb;
1352 for (; tcdup != struct_offset; tcdup++) {
1353 if (tcdup->content_len != content_len ||
1354 SCMemcmp(tcdup->content, content, tcdup->content_len) != 0)
1361 if (tcdup != struct_offset) {
1362 s->
cd->
id = tcdup->id;
1366 struct_offset->content_len = content_len;
1367 struct_offset->content = content_offset;
1368 content_offset += content_len;
1369 memcpy(struct_offset->content, content, content_len);
1370 struct_offset->id = max_id++;
1371 s->
cd->
id = struct_offset->id;
1397 if (ctx->
map == NULL)
1402 for (s = ctx->
head; s != NULL; ) {
1422 ctx->
map[s->
id] = s;
1464 AppProto alproto, uint8_t direction,
1466 uint16_t pp_min_depth, uint16_t pp_max_depth)
1488 static int AppLayerProtoDetectPMRegisterPattern(uint8_t ipproto,
AppProto alproto,
1489 const char *pattern,
1490 uint16_t depth, uint16_t
offset,
1494 uint16_t pp_min_depth, uint16_t pp_max_depth)
1518 if (depth < cd->content_len)
1521 if (direction & STREAM_TOSERVER)
1528 if (depth < ctx_pm->min_len)
1532 AppLayerProtoDetectPMAddSignature(ctx_pm, cd, alproto, direction,
1533 PPFunc, pp_min_depth, pp_max_depth);
1546 const uint8_t *buf, uint32_t buflen, uint8_t ipproto, uint8_t
flags,
bool *reverse_flow)
1549 SCLogDebug(
"buflen %u for %s direction", buflen,
1550 (
flags & STREAM_TOSERVER) ?
"toserver" :
"toclient");
1557 uint16_t pm_matches = AppLayerProtoDetectPMGetProto(
1558 tctx, f, buf, buflen,
flags, pm_results, reverse_flow);
1559 if (pm_matches > 0) {
1561 alproto = pm_results[0];
1564 uint8_t reverse_dir = (
flags & STREAM_TOSERVER) ? STREAM_TOCLIENT : STREAM_TOSERVER;
1577 pm_alproto = alproto;
1585 alproto = AppLayerProtoDetectPPGetProto(f, buf, buflen, ipproto,
flags, &rflow);
1586 if (AppProtoIsValid(alproto)) {
1588 *reverse_flow =
true;
1596 alproto = AppLayerProtoDetectPEGetProto(f, ipproto,
flags);
1600 if (!AppProtoIsValid(alproto))
1601 alproto = pm_alproto;
1615 while (pp != NULL) {
1617 AppLayerProtoDetectProbingParserFree(pp);
1625 static void AppLayerProtoDetectFreeAliases(
void)
1630 if (cur_alias == NULL)
1634 while (cur_alias != NULL) {
1635 next_alias = cur_alias->
next;
1637 cur_alias = next_alias;
1657 for (j = 0; j < 2; j++) {
1660 if (AppLayerProtoDetectPMSetContentIDs(ctx_pm) < 0)
1666 if (AppLayerProtoDetectPMMapSignatures(ctx_pm) < 0)
1668 if (AppLayerProtoDetectPMPrepareMpm(ctx_pm) < 0)
1675 AppLayerProtoDetectPrintProbingParsers(alpd_ctx.
ctx_pp);
1693 const char *portstr,
1695 uint16_t min_depth, uint16_t max_depth,
1705 while (temp_dp != NULL) {
1706 uint16_t port = temp_dp->
port;
1707 if (port == 0 && temp_dp->
port2 != 0)
1710 AppLayerProtoDetectInsertNewProbingParser(&alpd_ctx.
ctx_pp,
1714 min_depth, max_depth,
1718 if (port == temp_dp->
port2) {
1724 temp_dp = temp_dp->
next;
1733 const char *alproto_name,
1735 uint16_t min_depth, uint16_t max_depth,
1747 r = snprintf(param,
sizeof(param),
"%s%s%s",
"app-layer.protocols.",
1748 alproto_name,
".detection-ports");
1751 }
else if (r > (
int)
sizeof(param)) {
1752 FatalError(
"buffer not big enough to write param.");
1756 SCLogDebug(
"Entry for %s not found.", param);
1757 r = snprintf(param,
sizeof(param),
"%s%s%s%s%s",
"app-layer.protocols.",
1758 alproto_name,
".", ipproto_name,
".detection-ports");
1761 }
else if (r > (
int)
sizeof(param)) {
1762 FatalError(
"buffer not big enough to write param.");
1771 if (port_node == NULL)
1774 if (port_node != NULL && port_node->
val != NULL) {
1778 min_depth, max_depth,
1780 ProbingParserTs, ProbingParserTc);
1785 if (port_node == NULL)
1788 if (port_node != NULL && port_node->
val != NULL) {
1792 min_depth, max_depth,
1794 ProbingParserTc, ProbingParserTs);
1806 const char *pattern,
1807 uint16_t depth, uint16_t
offset,
1811 int r = AppLayerProtoDetectPMRegisterPattern(ipproto, alproto,
1819 const char *pattern, uint16_t depth, uint16_t
offset,
1822 uint16_t pp_min_depth, uint16_t pp_max_depth)
1825 int r = AppLayerProtoDetectPMRegisterPattern(ipproto, alproto,
1828 PPFunc, pp_min_depth, pp_max_depth);
1833 const char *pattern,
1834 uint16_t depth, uint16_t
offset,
1838 int r = AppLayerProtoDetectPMRegisterPattern(ipproto, alproto,
1853 memset(&alpd_ctx, 0,
sizeof(alpd_ctx));
1860 FatalError(
"Unable to alloc SpmGlobalThreadCtx.");
1864 for (j = 0; j < 2; j++) {
1881 int ipproto_map = 0;
1888 for (dir = 0; dir < 2; dir++) {
1891 for (
id = 0;
id < pm_ctx->
max_sig_id;
id++) {
1892 sig = pm_ctx->
map[id];
1893 AppLayerProtoDetectPMFreeSignature(sig);
1902 AppLayerProtoDetectFreeAliases();
1904 AppLayerProtoDetectFreeProbingParsers(alpd_ctx.
ctx_pp);
1930 new_alias->
next = NULL;
1932 if (alpda_ctx == NULL) {
1933 alpda_ctx = new_alias;
1936 while (cur_alias->
next != NULL) {
1937 cur_alias = cur_alias->
next;
1939 cur_alias->
next = new_alias;
2015 const char *ipproto,
const char *alproto,
bool default_enabled)
2019 BUG_ON(ipproto == NULL || alproto == NULL);
2029 r = snprintf(param,
sizeof(param),
"%s%s%s",
"app-layer.protocols.",
2030 alproto,
".enabled");
2033 }
else if (r > (
int)
sizeof(param)) {
2034 FatalError(
"buffer not big enough to write param.");
2039 SCLogDebug(
"Entry for %s not found.", param);
2040 r = snprintf(param,
sizeof(param),
"%s%s%s%s%s",
"app-layer.protocols.",
2041 alproto,
".", ipproto,
".enabled");
2044 }
else if (r > (
int)
sizeof(param)) {
2045 FatalError(
"buffer not big enough to write param.");
2050 SCLogDebug(
"Entry for %s not found.", param);
2051 if (default_enabled) {
2064 }
else if (strcasecmp(node->
val,
"detection-only") == 0) {
2070 SCLogError(
"Invalid value found for %s.", param);
2095 for (j = 0; j < 2; j++) {
2096 if (max_pat_id == 0) {
2117 for (j = 0; j < 2; j++) {
2144 int ipproto_map, dir;
2147 for (dir = 0; dir < 2; dir++) {
2173 AppLayerProtoDetectPMGetIpprotos(alproto, ipprotos);
2174 AppLayerProtoDetectPPGetIpprotos(alproto, ipprotos);
2175 AppLayerProtoDetectPEGetIpprotos(alproto, ipprotos);
2186 while (cur_alias != NULL) {
2187 if (strcasecmp(alproto_name, cur_alias->
proto_alias) == 0) {
2191 cur_alias = cur_alias->
next;
2197 if (alpd_ctx.
alproto_names[a] != NULL && AppProtoEquals(b, a)) {
2231 for (alproto = 0; alproto !=
ALPROTO_MAX; alproto++) {
2233 alprotos[alproto] = 1;
2241 static void AppLayerProtoDetectPEGetIpprotos(
AppProto alproto,
2245 ipprotos[IPPROTO_TCP / 8] |= 1 << (IPPROTO_TCP % 8);
2248 ipprotos[IPPROTO_UDP / 8] |= 1 << (IPPROTO_UDP % 8);
2256 SCLogError(
"Expectation on 2 IP protocols are not supported");
2274 alpd_ctx_ut = alpd_ctx;
2275 memset(&alpd_ctx, 0,
sizeof(alpd_ctx));
2282 alpd_ctx = alpd_ctx_ut;
2283 memset(&alpd_ctx_ut, 0,
sizeof(alpd_ctx_ut));
2287 static int AppLayerProtoDetectTest01(
void)
2292 const char *buf =
"HTTP";
2306 static int AppLayerProtoDetectTest02(
void)
2311 const char *buf =
"HTTP";
2331 static int AppLayerProtoDetectTest03(
void)
2336 uint8_t l7data[] =
"HTTP/1.1 200 OK\r\nServer: Apache/1.0\r\n\r\n";
2338 memset(pm_results, 0,
sizeof(pm_results));
2340 memset(&f, 0x00,
sizeof(f));
2344 const char *buf =
"HTTP";
2363 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2364 &f, l7data,
sizeof(l7data),
2366 pm_results, &rflow);
2376 static int AppLayerProtoDetectTest04(
void)
2381 uint8_t l7data[] =
"HTTP/1.1 200 OK\r\nServer: Apache/1.0\r\n\r\n";
2383 memset(&f, 0x00,
sizeof(f));
2385 memset(pm_results, 0,
sizeof(pm_results));
2388 const char *buf =
"200 ";
2404 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2405 &f, l7data,
sizeof(l7data), STREAM_TOCLIENT,
2416 static int AppLayerProtoDetectTest05(
void)
2421 uint8_t l7data[] =
"HTTP/1.1 200 OK\r\nServer: Apache/1.0\r\n\r\n<HTML><BODY>Blahblah</BODY></HTML>";
2423 memset(pm_results, 0,
sizeof(pm_results));
2425 memset(&f, 0x00,
sizeof(f));
2428 const char *buf =
"HTTP";
2447 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2448 &f, l7data,
sizeof(l7data),
2460 static int AppLayerProtoDetectTest06(
void)
2465 uint8_t l7data[] =
"220 Welcome to the OISF FTP server\r\n";
2467 memset(pm_results, 0,
sizeof(pm_results));
2469 memset(&f, 0x00,
sizeof(f));
2472 const char *buf =
"HTTP";
2491 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2492 &f, l7data,
sizeof(l7data), STREAM_TOCLIENT,
2503 static int AppLayerProtoDetectTest07(
void)
2508 uint8_t l7data[] =
"220 Welcome to the OISF HTTP/FTP server\r\n";
2510 memset(&f, 0x00,
sizeof(f));
2513 memset(pm_results, 0,
sizeof(pm_results));
2515 const char *buf =
"HTTP";
2530 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2531 &f, l7data,
sizeof(l7data), STREAM_TOCLIENT,
2541 static int AppLayerProtoDetectTest08(
void)
2546 uint8_t l7data[] = {
2547 0x00, 0x00, 0x00, 0x85, 0xff, 0x53, 0x4d, 0x42,
2548 0x72, 0x00, 0x00, 0x00, 0x00, 0x18, 0x53, 0xc8,
2549 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2550 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfe,
2551 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, 0x02,
2552 0x50, 0x43, 0x20, 0x4e, 0x45, 0x54, 0x57, 0x4f,
2553 0x52, 0x4b, 0x20, 0x50, 0x52, 0x4f, 0x47, 0x52,
2554 0x41, 0x4d, 0x20, 0x31, 0x2e, 0x30, 0x00, 0x02,
2555 0x4c, 0x41, 0x4e, 0x4d, 0x41, 0x4e, 0x31, 0x2e,
2556 0x30, 0x00, 0x02, 0x57, 0x69, 0x6e, 0x64, 0x6f,
2557 0x77, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x57,
2558 0x6f, 0x72, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x70,
2559 0x73, 0x20, 0x33, 0x2e, 0x31, 0x61, 0x00, 0x02,
2560 0x4c, 0x4d, 0x31, 0x2e, 0x32, 0x58, 0x30, 0x30,
2561 0x32, 0x00, 0x02, 0x4c, 0x41, 0x4e, 0x4d, 0x41,
2562 0x4e, 0x32, 0x2e, 0x31, 0x00, 0x02, 0x4e, 0x54,
2563 0x20, 0x4c, 0x4d, 0x20, 0x30, 0x2e, 0x31, 0x32,
2567 memset(pm_results, 0,
sizeof(pm_results));
2569 memset(&f, 0x00,
sizeof(f));
2572 const char *buf =
"|ff|SMB";
2588 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2589 &f, l7data,
sizeof(l7data), STREAM_TOCLIENT,
2600 static int AppLayerProtoDetectTest09(
void)
2605 uint8_t l7data[] = {
2606 0x00, 0x00, 0x00, 0x66, 0xfe, 0x53, 0x4d, 0x42,
2607 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2608 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
2609 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2610 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2611 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2613 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2614 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00,
2615 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2616 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2617 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2622 memset(pm_results, 0,
sizeof(pm_results));
2624 memset(&f, 0x00,
sizeof(f));
2627 const char *buf =
"|fe|SMB";
2643 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2644 &f, l7data,
sizeof(l7data), STREAM_TOCLIENT,
2655 static int AppLayerProtoDetectTest10(
void)
2660 uint8_t l7data[] = {
2661 0x05, 0x00, 0x0b, 0x03, 0x10, 0x00, 0x00, 0x00,
2662 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2663 0xd0, 0x16, 0xd0, 0x16, 0x00, 0x00, 0x00, 0x00,
2664 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
2665 0xb8, 0x4a, 0x9f, 0x4d, 0x1c, 0x7d, 0xcf, 0x11,
2666 0x86, 0x1e, 0x00, 0x20, 0xaf, 0x6e, 0x7c, 0x57,
2667 0x00, 0x00, 0x00, 0x00, 0x04, 0x5d, 0x88, 0x8a,
2668 0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8, 0x08, 0x00,
2669 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00
2672 memset(pm_results, 0,
sizeof(pm_results));
2674 memset(&f, 0x00,
sizeof(f));
2677 const char *buf =
"|05 00|";
2693 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2694 &f, l7data,
sizeof(l7data), STREAM_TOCLIENT,
2709 static int AppLayerProtoDetectTest11(
void)
2714 uint8_t l7data[] =
"CONNECT www.ssllabs.com:443 HTTP/1.0\r\n";
2715 uint8_t l7data_resp[] =
"HTTP/1.1 405 Method Not Allowed\r\n";
2717 memset(pm_results, 0,
sizeof(pm_results));
2719 memset(&f, 0x00,
sizeof(f));
2731 IPPROTO_TCP,
ALPROTO_HTTP1,
"TRACE", 5, 0, STREAM_TOSERVER);
2733 IPPROTO_TCP,
ALPROTO_HTTP1,
"OPTIONS", 7, 0, STREAM_TOSERVER);
2735 IPPROTO_TCP,
ALPROTO_HTTP1,
"CONNECT", 7, 0, STREAM_TOSERVER);
2760 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2761 &f, l7data,
sizeof(l7data), STREAM_TOSERVER,
2766 memset(pm_results, 0,
sizeof(pm_results));
2767 cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2768 &f, l7data_resp,
sizeof(l7data_resp), STREAM_TOCLIENT,
2782 static int AppLayerProtoDetectTest12(
void)
2794 printf(
"failure 1\n");
2800 printf(
"failure 2\n");
2806 printf(
"failure 3\n");
2810 printf(
"failure 4\n");
2814 printf(
"failure 5\n");
2818 printf(
"failure 6\n");
2834 static int AppLayerProtoDetectTest13(
void)
2839 uint8_t l7data[] =
"CONNECT www.ssllabs.com:443 HTTP/1.0\r\n";
2840 uint8_t l7data_resp[] =
"HTTP/1.1 405 Method Not Allowed\r\n";
2844 memset(&f, 0x00,
sizeof(f));
2856 IPPROTO_UDP,
ALPROTO_HTTP1,
"TRACE", 5, 0, STREAM_TOSERVER);
2858 IPPROTO_UDP,
ALPROTO_HTTP1,
"OPTIONS", 7, 0, STREAM_TOSERVER);
2860 IPPROTO_UDP,
ALPROTO_HTTP1,
"CONNECT", 7, 0, STREAM_TOSERVER);
2881 memset(pm_results, 0,
sizeof(pm_results));
2883 uint32_t cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2884 &f, l7data,
sizeof(l7data), STREAM_TOSERVER,
2888 memset(pm_results, 0,
sizeof(pm_results));
2889 cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2890 &f, l7data_resp,
sizeof(l7data_resp), STREAM_TOCLIENT,
2905 static int AppLayerProtoDetectTest14(
void)
2910 uint8_t l7data[] =
"CONNECT www.ssllabs.com:443 HTTP/1.0\r\n";
2911 uint8_t l7data_resp[] =
"HTTP/1.1 405 Method Not Allowed\r\n";
2915 memset(&f, 0x00,
sizeof(f));
2927 IPPROTO_UDP,
ALPROTO_HTTP1,
"TRACE", 5, 0, STREAM_TOSERVER);
2929 IPPROTO_UDP,
ALPROTO_HTTP1,
"OPTIONS", 7, 0, STREAM_TOSERVER);
2931 IPPROTO_UDP,
ALPROTO_HTTP1,
"CONNECT", 7, 0, STREAM_TOSERVER);
2953 memset(pm_results, 0,
sizeof(pm_results));
2955 cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2956 &f, l7data,
sizeof(l7data), STREAM_TOSERVER,
2961 memset(pm_results, 0,
sizeof(pm_results));
2962 cnt = AppLayerProtoDetectPMGetProto(
alpd_tctx,
2963 &f, l7data_resp,
sizeof(l7data_resp), STREAM_TOCLIENT,
3008 int i = -1, j = -1 , k = -1;
3012 for (i = 0; i < no_of_ip_proto; i++, pp = pp->
next) {
3013 if (pp->ipproto != ip_proto[i].
ipproto)
3017 for (k = 0; k < ip_proto[i].
no_of_port; k++, pp_port = pp_port->
next) {
3018 if (pp_port->port != ip_proto[i].
port[k].
port)
3034 j++, pp_element = pp_element->
next) {
3052 if (pp_element != NULL)
3055 pp_element = pp_port->sp;
3076 if (pp_element != NULL)
3079 if (pp_port != NULL)
3088 printf(
"i = %d, k = %d, j = %d(%s)\n", i, k, j, (dir == 0) ?
"ts" :
"tc");
3093 static uint16_t ProbingParserDummyForTesting(
Flow *f, uint8_t direction,
3094 const uint8_t *input,
3095 uint32_t input_len, uint8_t *rdir)
3100 static int AppLayerProtoDetectTest15(
void)
3108 ProbingParserDummyForTesting, NULL);
3114 ProbingParserDummyForTesting, NULL);
3120 ProbingParserDummyForTesting, NULL);
3127 ProbingParserDummyForTesting, NULL);
3133 ProbingParserDummyForTesting, NULL);
3139 ProbingParserDummyForTesting, NULL);
3145 ProbingParserDummyForTesting, NULL);
3152 ProbingParserDummyForTesting, NULL);
3158 ProbingParserDummyForTesting, NULL);
3166 ProbingParserDummyForTesting, NULL);
3174 ProbingParserDummyForTesting, NULL);
3180 ProbingParserDummyForTesting, NULL);
3187 ProbingParserDummyForTesting, NULL);
3193 ProbingParserDummyForTesting, NULL);
3199 ProbingParserDummyForTesting, NULL);
3201 ProbingParserDummyForTesting, NULL);
3207 ProbingParserDummyForTesting, NULL);
3213 ProbingParserDummyForTesting, NULL);
3219 ProbingParserDummyForTesting, NULL);
3225 ProbingParserDummyForTesting, NULL);
3231 ProbingParserDummyForTesting, NULL);
3237 ProbingParserDummyForTesting, NULL);
3357 23, element_ts_85, element_tc_85,
3365 23, element_ts_90, element_tc_90,
3373 23, element_ts_0, element_tc_0,
3383 element_ts_85_udp, element_tc_85_udp,
3401 if (AppLayerProtoDetectPPTestData(alpd_ctx.
ctx_pp, ip_proto,
3415 static int AppLayerProtoDetectTest16(
void)
3420 uint8_t http_buf1[] =
"POST /one HTTP/1.0\r\n"
3421 "User-Agent: Mozilla/1.0\r\n"
3422 "Cookie: hellocatch\r\n\r\n";
3423 uint32_t http_buf1_len =
sizeof(http_buf1) - 1;
3437 printf(
"packet setup failed: ");
3441 f =
UTHBuildFlow(AF_INET,
"1.1.1.1",
"2.2.2.2", 1024, 80);
3443 printf(
"flow setup failed: ");
3447 f->
proto = IPPROTO_TCP;
3465 "(msg:\"Test content option\"; "
3477 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
3482 if (http_state == NULL) {
3483 printf(
"no http state: ");
3491 printf(
"sig 1 didn't alert, but it should: ");
3498 if (det_ctx != NULL)
3514 static int AppLayerProtoDetectTest17(
void)
3519 uint8_t http_buf1[] =
"POST /one HTTP/1.0\r\n"
3520 "User-Agent: Mozilla/1.0\r\n"
3521 "Cookie: hellocatch\r\n\r\n";
3522 uint32_t http_buf1_len =
sizeof(http_buf1) - 1;
3536 f =
UTHBuildFlow(AF_INET,
"1.1.1.1",
"2.2.2.2", 1024, 80);
3540 f->
proto = IPPROTO_TCP;
3556 "(msg:\"http over non standar port\"; "
3568 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
3573 if (http_state == NULL) {
3574 printf(
"no http state: ");
3582 printf(
"sig 1 didn't alert, but it should: ");
3591 if (det_ctx != NULL)
3607 static int AppLayerProtoDetectTest18(
void)
3612 uint8_t http_buf1[] =
"POST /one HTTP/1.0\r\n"
3613 "User-Agent: Mozilla/1.0\r\n"
3614 "Cookie: hellocatch\r\n\r\n";
3615 uint32_t http_buf1_len =
sizeof(http_buf1) - 1;
3629 f =
UTHBuildFlow(AF_INET,
"1.1.1.1",
"2.2.2.2", 1024, 80);
3633 f->
proto = IPPROTO_TCP;
3649 "(msg:\"Test content option\"; "
3661 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
3666 if (http_state == NULL) {
3667 printf(
"no http state: ");
3675 printf(
"sig 1 alerted, but it should not (it's not ftp): ");
3683 if (det_ctx != NULL)
3699 static int AppLayerProtoDetectTest19(
void)
3703 uint8_t http_buf1[] =
"MPUT one\r\n";
3704 uint32_t http_buf1_len =
sizeof(http_buf1) - 1;
3718 f =
UTHBuildFlow(AF_INET,
"1.1.1.1",
"2.2.2.2", 1024, 80);
3722 f->
proto = IPPROTO_TCP;
3738 "(msg:\"http over non standar port\"; "
3748 STREAM_TOSERVER, http_buf1, http_buf1_len);
3750 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
3758 printf(
"sig 1 alerted, but it should not (it's ftp): ");
3767 if (det_ctx != NULL)
3784 UtRegisterTest(
"AppLayerProtoDetectTest01", AppLayerProtoDetectTest01);
3785 UtRegisterTest(
"AppLayerProtoDetectTest02", AppLayerProtoDetectTest02);
3786 UtRegisterTest(
"AppLayerProtoDetectTest03", AppLayerProtoDetectTest03);
3787 UtRegisterTest(
"AppLayerProtoDetectTest04", AppLayerProtoDetectTest04);
3788 UtRegisterTest(
"AppLayerProtoDetectTest05", AppLayerProtoDetectTest05);
3789 UtRegisterTest(
"AppLayerProtoDetectTest06", AppLayerProtoDetectTest06);
3790 UtRegisterTest(
"AppLayerProtoDetectTest07", AppLayerProtoDetectTest07);
3791 UtRegisterTest(
"AppLayerProtoDetectTest08", AppLayerProtoDetectTest08);
3792 UtRegisterTest(
"AppLayerProtoDetectTest09", AppLayerProtoDetectTest09);
3793 UtRegisterTest(
"AppLayerProtoDetectTest10", AppLayerProtoDetectTest10);
3794 UtRegisterTest(
"AppLayerProtoDetectTest11", AppLayerProtoDetectTest11);
3795 UtRegisterTest(
"AppLayerProtoDetectTest12", AppLayerProtoDetectTest12);
3796 UtRegisterTest(
"AppLayerProtoDetectTest13", AppLayerProtoDetectTest13);
3797 UtRegisterTest(
"AppLayerProtoDetectTest14", AppLayerProtoDetectTest14);
3798 UtRegisterTest(
"AppLayerProtoDetectTest15", AppLayerProtoDetectTest15);
3799 UtRegisterTest(
"AppLayerProtoDetectTest16", AppLayerProtoDetectTest16);
3800 UtRegisterTest(
"AppLayerProtoDetectTest17", AppLayerProtoDetectTest17);
3801 UtRegisterTest(
"AppLayerProtoDetectTest18", AppLayerProtoDetectTest18);
3802 UtRegisterTest(
"AppLayerProtoDetectTest19", AppLayerProtoDetectTest19);