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

Multiple json db #338

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Multiple json db #338

wants to merge 6 commits into from

Conversation

wangmot
Copy link
Collaborator

@wangmot wangmot commented Feb 4, 2025

Summary

If merged this pull request will allow multiple json databases to be used for pattern matching. Users can use private databases--they will just have to be in the same format as the emba.json and they will have to be placed in the correct location.

Proposed changes

I've created a new dictionary of dictionaries to store all the json databases (each json file as a single entry in the dictionary).

@wangmot wangmot marked this pull request as draft February 4, 2025 20:26
@wangmot
Copy link
Collaborator Author

wangmot commented Feb 4, 2025

I am noticing one bug. Let's take the busybox example binary which is in the emba.json database. When the patterns get matched against the emba.json, it finds 3 matches in the containsLibrary list. But when I have two json databases, both get added to a new dictionary and if I remove the busybox entry from emba.json and add it to the new json database, all of a sudden when the pattern matching occurs, it only returns one match. It seems like it breaks out of the loop once a single match is found. But this behavior doesn't occur with the original emba.json database. With that one, it is capable of finding multiple matches and only breaks out once all the patterns are traversed.

Edit: This might be a logic issue. I looked at the combined json dictionary and the format and structure of it looked fine. The dictionary is only one layer deeper than it previously was.

Then, I thought it could be an issue with encoding the data. When I copy pasted the busybox patterns from emba.json to the second json DB, there might've been subtle differences with special/invisible characters that didn't copy over, but after checking with diff, they were both identical. Will continue looking into this.

@wangmot wangmot requested a review from nightlark February 5, 2025 19:41
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

Successfully merging this pull request may close these issues.

1 participant