Skip to content

Commit

Permalink
Merge branch 'main' into finish-doc-TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
nightlark authored Dec 14, 2023
2 parents df249b9 + ac44dea commit d67979f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--By submitting a pull request you are acknowledging that you have the right to license your code under the terms of this repositories license.
Please review the [Contributing Guidelines](../CONTRIBUTING.md) for more details.
If appropriate, fill in the following sections. Please tag linked issues. e.g. This PR fixes issue #1234-->

### Summary

<!-- please finish the following statement -->

If merged this pull request will

### Proposed changes

<!-- Describe the highlights of the proposed changes here -->
12 changes: 12 additions & 0 deletions surfactant/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import click
from loguru import logger

from surfactant.cmd.cli import add, edit, find
from surfactant.cmd.createconfig import create_config
from surfactant.cmd.generate import sbom as generate
from surfactant.cmd.merge import merge_command
Expand Down Expand Up @@ -38,11 +39,22 @@ def version():
sys.exit(0)


@main.group("cli")
def cli():
"""Commandline interface used to modify SBOM entries."""


# Main Commands
main.add_command(generate)
main.add_command(version)
main.add_command(stat)
main.add_command(merge_command)
main.add_command(create_config)

# CLI Subcommands
cli.add_command(find)
cli.add_command(edit)
cli.add_command(add)

if __name__ == "__main__":
main(log_level="INFO")
19 changes: 19 additions & 0 deletions surfactant/cmd/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import click


@click.argument("sbom", type=click.File("r"), required=True)
@click.command("find")
def find(sbom):
"CLI command to find specific entry(s) within a supplied SBOM"


@click.argument("sbom", type=click.File("r"), required=True)
@click.command("edit")
def edit(sbom):
"CLI command to edit specific entry(s) in a supplied SBOM"


@click.argument("sbom", type=click.File("r"), required=True)
@click.command("add")
def add(sbom):
"CLI command to add specific entry(s) to a supplied SBOM"
4 changes: 3 additions & 1 deletion surfactant/infoextractors/pe_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ def add_core_assembly_info(asm_dict, asm_info):
asm_dict[
"Version"
] = f"{asm_info.MajorVersion}.{asm_info.MinorVersion}.{asm_info.BuildNumber}.{asm_info.RevisionNumber}"
asm_dict["PublicKey"] = asm_info.PublicKey.hex()
asm_dict["PublicKey"] = (
asm_info.PublicKey.hex() if hasattr(asm_info.PublicKey, "hex") else asm_info.PublicKey
)


def add_assembly_flags_info(asm_dict, asm_info):
Expand Down

0 comments on commit d67979f

Please sign in to comment.