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

KeyError: 'Commands' #1

Closed
m8r1us opened this issue Dec 21, 2022 · 2 comments
Closed

KeyError: 'Commands' #1

m8r1us opened this issue Dec 21, 2022 · 2 comments

Comments

@m8r1us
Copy link

m8r1us commented Dec 21, 2022

Thanks for creating and publishing the script.

When running the second command to create the LOLBAS md files I get the following error:

└─# python3 generator.py lolbas build -od MyVault/LOLBAS/                                       1 ⨯
2022-12-21 16:08:08,505 - main - INFO - Executing utility module: <lib.utils.lolbas.Build object at 0x7f074c9807c0>
2022-12-21 16:08:08,505 - lolbas.build - INFO - Using cached LOLBAS repository.
Traceback (most recent call last):
  File "/opt/sec-vault-gen/generator.py", line 115, in <module>
    util(**dargs)
  File "/opt/sec-vault-gen/lib/utils/lolbas.py", line 149, in __call__
    return Build.build(*args, **kwargs)
  File "/opt/sec-vault-gen/lib/utils/lolbas.py", line 83, in build
    categories = list(set([c['Category'] for c in fm['Commands']]))
KeyError: 'Commands'

After checking the variable "fm" it seems that the "FM.read" is not parsing the YML file. But the path to the YML file is correct.

            # ====================
            # GET FRONTMATTER DATA
            # ====================

            for infile in d.glob('*.yml'):
                with infile.open() as i:
                    fm = FM.read(i)

                # =============================
                # ORGANIZE COMMANDS BY CATEGORY
                # =============================

                categories = list(set([c['Category'] for c in fm['Commands']]))
                commands_by_category = {}
                for cat in categories:
                    commands_by_category[cat] = [
                        c for c in fm['Commands'] if c['Category'] == cat
                    ]

Before I debug further, maybe you have an idea or have you had the same issue once?

Python Version: 3.10.9

Thanks

@syloktools
Copy link

Same issue here. Did you find a solution? @m8r1us

@ImpostorKeanu
Copy link
Owner

Sorry...didn't know this code was still being used. Thought it was long forgotten!

Just merged a potential fix by @pkincaid-sa

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

3 participants