Skip to content

Commit

Permalink
Added cuckoo.network.suricata() function (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanek-m committed Jul 24, 2020
1 parent 6e01107 commit cf66a6c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/types/modules/cuckoo_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ bool CuckooModule::initialize(ImportFeatures features)
networkStruct->addAttribute(std::make_shared<FunctionSymbol>("connection_ip", Type::Int, Type::Regexp));
networkStruct->addAttribute(std::make_shared<FunctionSymbol>("connection_country", Type::Int, Type::Regexp));
networkStruct->addAttribute(std::make_shared<FunctionSymbol>("irc_command", Type::Int, Type::Regexp, Type::Regexp));
networkStruct->addAttribute(std::make_shared<FunctionSymbol>("suricata", Type::Int, Type::Regexp));
}
cuckooStruct->addAttribute(networkStruct);

Expand Down
22 changes: 22 additions & 0 deletions tests/cpp/parser_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6435,6 +6435,28 @@ rule abc
EXPECT_EQ(expected, driver.getParsedFile().getTextFormatted());
}

TEST_F(ParserTests,
CuckooSuricataModuleFunction) {
prepareInput(
R"(
import "cuckoo"
rule cuckoo_suricata
{
condition:
cuckoo.network.suricata(/SomeEvilSuricataSignature/)
}
)");

EXPECT_TRUE(driver.parse(input));
ASSERT_EQ(1u, driver.getParsedFile().getRules().size());

const auto& rule = driver.getParsedFile().getRules()[0];
EXPECT_EQ(R"(cuckoo.network.suricata(/SomeEvilSuricataSignature/))", rule->getCondition()->getText());

EXPECT_EQ(input_text, driver.getParsedFile().getTextFormatted());
}

TEST_F(ParserTests,
CuckooScheduledTaskModuleFunction) {
prepareInput(
Expand Down

0 comments on commit cf66a6c

Please sign in to comment.