Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Output Question #52

Closed
forensicmatt opened this issue Aug 29, 2019 · 4 comments
Closed

Custom Output Question #52

forensicmatt opened this issue Aug 29, 2019 · 4 comments

Comments

@forensicmatt
Copy link
Contributor

I am wanting to create a custom output. Something very similar to evtx::json_output::JsonOutput, but I want to be able to tweak how the json is generated just a little bit to get around some hurdles of ingesting the json into Elastic. Is it possible in 0.4.1 to create a custom output structure that implements BinXmlOutput? My issue is that some of the required modules are not public (for example evtx::model::xml::XmlElement).

Thanks in advance for the help.

@omerbenamram
Copy link
Owner

omerbenamram commented Aug 29, 2019

Hi @forensicmatt,

BinXmlOutput is somewhat of an implementation detail (as well as the inner model), which I'm not sure is sufficiently polished to be considered public API of the library.

Regarding your use case, I'm not sure I fully understand the issue, why not transform the current output JSON to fit your liking? Is there any information you think is missing in the current representation? I could improve the JSON output if necessary.

@forensicmatt
Copy link
Contributor Author

forensicmatt commented Aug 29, 2019

Here is one example:

Mostly you have

<EventRecordID>3948</EventRecordID>

But there are also:

<EventID Qualifiers="16384">9009</EventID>

In JSON this is :

"EventID": 10001,
"EventID": {
  "#attributes": {
    "Qualifiers": 16384
  },
  "#text": 9009
},

Because the value of EventID can be either a Number, or an Object, this prevents ingesting records into elastic. My first thought was instead of naming an Elements attributes with #attributes, to make it "EventID_attributes": { } , this could then keep EventID: 9009 and have a separate object for ELEMENTNAME_attributes. Something of the nature should fix Values having multiple types. I am not sure how others would feel about the naming convention though so I was wanting to just implement it in a separate tool. I really don't want to do any type of XML to JSON conversion though because of the speed hurdle. Maybe you could provide a switch, or name how attributes are handled?

An example of what the json would look like:

"EventID": 9009,
"EventID_attributes": {
    "Qualifiers": 16384
},

@forensicmatt
Copy link
Contributor Author

BinXmlOutput is somewhat of an implementation detail (as well as the inner model), which I'm not sure is sufficiently polished to be considered public API of the library.

Is this something that you would be open to making public and just stating that its not polished? If this was public I could just experiment with making my own Output right?

@forensicmatt
Copy link
Contributor Author

I created a pull request for a solution that solves this issue without a performance hit: #53.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants