Update and clean up to file entropy measurement.

- Updated to newer file analyzer api.
This commit is contained in:
Seth Hall 2015-02-03 15:04:36 -05:00
parent b81510592a
commit 9c692bad39
2 changed files with 16 additions and 20 deletions

View file

@ -3,7 +3,8 @@ module Files;
export { export {
redef record Files::Info += { redef record Files::Info += {
## The information density of the contents of the file, expressed as a number of bits per character. ## The information density of the contents of the file,
## expressed as a number of bits per character.
entropy: double &log &optional; entropy: double &log &optional;
}; };
} }

View file

@ -1,29 +1,24 @@
// See the file in the main distribution directory for copyright.
#include "plugin/Plugin.h" #include "plugin/Plugin.h"
#include "file_analysis/Component.h"
#include "Entropy.h" #include "Entropy.h"
namespace plugin { namespace Bro_FileEntropy { namespace plugin {
namespace Bro_FileEntropy {
class Plugin : public plugin::Plugin { class Plugin : public plugin::Plugin {
protected: public:
void InitPreScript() plugin::Configuration Configure()
{ {
SetName("Bro::FileEntropy"); AddComponent(new ::file_analysis::Component("ENTROPY", ::file_analysis::Entropy::Instantiate));
SetVersion(-1);
SetAPIVersion(BRO_PLUGIN_API_VERSION);
SetDynamicPlugin(false);
SetDescription("Entropy test file content"); plugin::Configuration config;
config.name = "Bro::FileEntropy";
AddComponent(new ::file_analysis::Component("ENTROPY", config.description = "Entropy test file content";
::file_analysis::Entropy::Instantiate)); return config;
extern std::list<std::pair<const char*, int> > __bif_events_init();
AddBifInitFunction(&__bif_events_init);
} }
}; } plugin;
Plugin __plugin; }
}
} }