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

Configuration metadata #39

Merged
merged 22 commits into from
Apr 5, 2021
Merged

Configuration metadata #39

merged 22 commits into from
Apr 5, 2021

Conversation

infosec-intern
Copy link
Owner

Closes #23

@infosec-intern infosec-intern merged commit a8ca310 into main Apr 5, 2021
@infosec-intern infosec-intern deleted the configuration-metadata branch April 5, 2021 04:56
@ITAYC0HEN
Copy link
Contributor

HEy, I notice that there are no easy templates anymore (snippets).
Any reason to remove the rich snippet that was here before? :)
796702e

@infosec-intern
Copy link
Owner Author

@ITAYC0HEN the specific text templates were removed, but the capability still exists with the Snippet Provider. A lot of the text you added in that snippet was ported into the provider as default text with the option to provide default metadata as keywords via the extension's settings. For example, if you want to recreate the same metadata provided in your original snippet, the following configuration should work:

{
    "author": "",
    "date": "${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}",
    "hash": "",
    "reference": ""
}

I wrote a little wiki page for this specific feature here too: https://github.com/infosec-intern/vscode-yara/wiki/Snippets#rule-section-snippets

@ITAYC0HEN
Copy link
Contributor

Sorry not sure I understood how it works. Couldn't make it happen. Should I edit some of this repo's files under ~/.vscode or somewhere else?
I tried some things and couldn't bring them to work. Would you mind sharing a .diff file of some kind that I can apply to have the same metadata as in the previous snippet?

@infosec-intern
Copy link
Owner Author

Sure, here's my workspace settings with the metaEntries field filled out along with some screenshots to display the results

These are just placed in my yara-rules/.vscode/settings.json file:
metaEntriesSettings

Here's the actual snippet text - what it should look like when attempting to complete a rule snippet. Similar text will also be autofilled when trying to complete a meta section snippet:
ruleCompletion

And the resulting text with the author and date auto-filled (any snippet variables should work), and tabstops placed in the hash and reference keys because I left those values empty in the settings:
ruleResult

One other thing about these is you can enable/disable any of these snippets, so if you prefer to create your own snippet with the same name instead of use this feature, you can disable any/all of the sections in the Settings menu:
snippetToggles

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.

Configuration-based metadata
2 participants