es4forensics
This crates provides structs and functions to insert timeline data into an elasticsearch index.
Creating Indices
use IndexBuilder;
use WithHost;
use Credentials;
let username = "elastic";
let password = "elastic";
let credentials = Basic;
let mut index = with_name
.with_host
.with_port
.without_certificate_validation
.with_credentials
.build;
After doing this, you can easily add documents to the index using [Index::add_timeline_object]
Adding documents to elasticsearch
For example, consider we have a line from a bodyfile. We need to convert this
into a [ecs::objects::PosixFile]-Object, which can then be added to an Index:
use Bodyfile3Line;
use PosixFile;
let str_line = "0|/Users/Administrator ($FILE_NAME)|93552-48-2|d/drwxrwxrwx|0|0|92|1577092511|1577092511|1577092511|-1";
let bf_line = try_from.unwrap;
index.add_timeline_object;
Exporting documents in JSON format
Sometimes you might want to simply export your documents, instead of directly importing them into elasticsearch.
Keep in mind that one bodyfile line might contain multiple different timestamps (up to four),
which yields up to four elasticsearch documents. Therefore, [ecs::objects::ElasticObject::documents()] returns an
iterator over [serde_json::Value]
use Bodyfile3Line;
use PosixFile;
use ElasticObject;
let str_line = "0|/Users/Administrator ($FILE_NAME)|93552-48-2|d/drwxrwxrwx|0|0|92|1577092511|1577092511|1577092511|-1";
let bf_line = try_from.unwrap;
for json_value in from.documents
License: GPL-3.0