Example #1
0
/* Testing the final vermont workflow */
void test_final_vermont_workflow(){
	int i, j;
	// Enter the absolute or relative path to the signatures thou shalt match with.
	char * signature_directory = "./signatures";

	printf("\nInitializing signaturematcher ... ");
	struct Matcher * signaturematcher = new_matcher(signature_directory);
	printf("Done.\n");

	// Define the flow thou shalt match upon.
	char * flow = "dies ist ein kleiner und doch guter test .üovfisnr0q9832ur0ocdijwaoercú32qruq3222cxjfsopijreif7rq203	iß3+2ai p09u ppppppu4esrrrr4crss8cp0s9ewy";

	int runs = 10000;

	int * results = NULL;
	for (j = 0; j < runs; ++j) {
		results = match_single_flow(signaturematcher, flow, strlen(flow));

		for (i = 0; i < signaturematcher->numOfClasses; ++i) {
			if (results[i] == 1)
			{}//printf("match: %s\n", signaturematcher->signatures[i]->id);
		}
		free(results);
	}

	destruct_matcher(signaturematcher);
}
void FrontPayloadSigMatcher::matchConnection(Connection* conn)
{
	int* results = match_single_flow(sigmatcher, conn->srcPayload, conn->srcPayloadLen, conn->dstPayload, conn->dstPayloadLen);

	for (int32_t j=0; j<sigmatcher->numOfClasses; j++) {
		if (results[j]==1) {
			msg(MSG_DIALOG, "SIGMATCHER: matched record on class '%s' in token %u",
					sigmatcher->signatures[j]->id, j);
			msg(MSG_DIALOG, "%s", conn->toString().c_str());
		}
	}

	free(results);
}