blint 2.0.5__tar.gz → 2.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {blint-2.0.5 → blint-2.0.7}/PKG-INFO +2 -1
  2. {blint-2.0.5 → blint-2.0.7}/README.md +1 -0
  3. {blint-2.0.5 → blint-2.0.7}/blint/cli.py +19 -7
  4. {blint-2.0.5 → blint-2.0.7}/blint/sbom.py +24 -15
  5. {blint-2.0.5 → blint-2.0.7}/pyproject.toml +1 -1
  6. {blint-2.0.5 → blint-2.0.7}/LICENSE +0 -0
  7. {blint-2.0.5 → blint-2.0.7}/blint/__init__.py +0 -0
  8. {blint-2.0.5 → blint-2.0.7}/blint/analysis.py +0 -0
  9. {blint-2.0.5 → blint-2.0.7}/blint/android.py +0 -0
  10. {blint-2.0.5 → blint-2.0.7}/blint/binary.py +0 -0
  11. {blint-2.0.5 → blint-2.0.7}/blint/checks.py +0 -0
  12. {blint-2.0.5 → blint-2.0.7}/blint/config.py +0 -0
  13. {blint-2.0.5 → blint-2.0.7}/blint/cyclonedx/README.md +0 -0
  14. {blint-2.0.5 → blint-2.0.7}/blint/cyclonedx/__init__.py +0 -0
  15. {blint-2.0.5 → blint-2.0.7}/blint/cyclonedx/spdx.py +0 -0
  16. {blint-2.0.5 → blint-2.0.7}/blint/cyclonedx/spec.py +0 -0
  17. {blint-2.0.5 → blint-2.0.7}/blint/data/__init__.py +0 -0
  18. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/__init__.py +0 -0
  19. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_entries_generic.yml +0 -0
  20. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_entries_pe.yml +0 -0
  21. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_exe_go.yml +0 -0
  22. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_imports_pe.yml +0 -0
  23. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_methods_generic.yml +0 -0
  24. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_methods_mips.yml +0 -0
  25. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_monero_generic.yml +0 -0
  26. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_monero_go.yml +0 -0
  27. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_monero_rust +0 -0
  28. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_monero_rust.yml +0 -0
  29. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_rootkits_win.yml +0 -0
  30. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_symbols_antiforensic.yml +0 -0
  31. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_symbols_generic.yml +0 -0
  32. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_symbols_hooka.yml +0 -0
  33. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_symbols_macho.yml +0 -0
  34. {blint-2.0.5 → blint-2.0.7}/blint/data/annotations/review_symbols_rust.yml +0 -0
  35. {blint-2.0.5 → blint-2.0.7}/blint/data/rules.yml +0 -0
  36. {blint-2.0.5 → blint-2.0.7}/blint/logger.py +0 -0
  37. {blint-2.0.5 → blint-2.0.7}/blint/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blint
3
- Version: 2.0.5
3
+ Version: 2.0.7
4
4
  Summary: Linter and SBOM generator for binary files.
5
5
  Home-page: https://github.com/OWASP-dep-scan/blint
6
6
  License: MIT
@@ -108,6 +108,7 @@ options:
108
108
  SBOM output file. Defaults to bom.json in current directory.
109
109
  --deep Enable deep mode to collect more used symbols and modules aggressively. Slow
110
110
  operation.
111
+ --stdout Print the SBOM to stdout instead of a file.
111
112
  ```
112
113
 
113
114
  To test any binary, including default commands
@@ -78,6 +78,7 @@ options:
78
78
  SBOM output file. Defaults to bom.json in current directory.
79
79
  --deep Enable deep mode to collect more used symbols and modules aggressively. Slow
80
80
  operation.
81
+ --stdout Print the SBOM to stdout instead of a file.
81
82
  ```
82
83
 
83
84
  To test any binary, including default commands
@@ -2,6 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  import argparse
5
+ import logging
5
6
  import os
6
7
  import sys
7
8
 
@@ -104,6 +105,13 @@ def build_args():
104
105
  help="Enable deep mode to collect more used symbols and modules "
105
106
  "aggressively. Slow operation.",
106
107
  )
108
+ sbom_parser.add_argument(
109
+ "--stdout",
110
+ action="store_true",
111
+ default=False,
112
+ dest="stdout_mode",
113
+ help="Print the SBOM to stdout instead of a file.",
114
+ )
107
115
  return parser.parse_args()
108
116
 
109
117
 
@@ -138,7 +146,7 @@ def handle_args():
138
146
  source directory.
139
147
  """
140
148
  args = build_args()
141
- if not args.no_banner:
149
+ if not args.no_banner and args.subcommand_name != "sbom":
142
150
  print(BLINT_LOGO)
143
151
  if not args.src_dir_image:
144
152
  args.src_dir_image = [os.getcwd()]
@@ -163,13 +171,17 @@ def main():
163
171
 
164
172
  # SBOM command
165
173
  if args.subcommand_name == "sbom":
166
- if args.sbom_output:
167
- sbom_output = args.sbom_output
174
+ if args.stdout_mode:
175
+ sbom_output = sys.stdout
176
+ LOG.setLevel(logging.ERROR)
168
177
  else:
169
- sbom_output = os.path.join(os.getcwd(), "bom.json")
170
- sbom_output_dir = os.path.dirname(sbom_output)
171
- if sbom_output_dir and not os.path.exists(sbom_output_dir):
172
- os.makedirs(sbom_output_dir)
178
+ if args.sbom_output:
179
+ sbom_output = args.sbom_output
180
+ else:
181
+ sbom_output = os.path.join(os.getcwd(), "bom.json")
182
+ sbom_output_dir = os.path.dirname(sbom_output)
183
+ if sbom_output_dir and not os.path.exists(sbom_output_dir):
184
+ os.makedirs(sbom_output_dir)
173
185
  generate(src_dirs, sbom_output, args.deep_mode)
174
186
  # Default case
175
187
  else:
@@ -175,20 +175,29 @@ def create_sbom(
175
175
  )
176
176
  # Populate the dependencies
177
177
  sbom.dependencies = dependencies
178
- LOG.debug(
179
- f"SBOM includes {len(components)} components and {len(dependencies)} dependencies",
180
- )
181
- with open(output_file, mode="w", encoding="utf-8") as fp:
182
- fp.write(
183
- sbom.model_dump_json(
184
- indent=None if deep_mode else 2,
185
- exclude_none=True,
186
- exclude_defaults=True,
187
- warnings=False,
188
- by_alias=True
189
- )
178
+ if isinstance(output_file, str):
179
+ LOG.debug(
180
+ f"SBOM includes {len(components)} components and {len(dependencies)} dependencies",
190
181
  )
191
- LOG.debug(f"SBOM file generated successfully at {output_file}")
182
+ with open(output_file, mode="w", encoding="utf-8") as fp:
183
+ fp.write(
184
+ sbom.model_dump_json(
185
+ indent=None if deep_mode else 2,
186
+ exclude_none=True,
187
+ exclude_defaults=True,
188
+ warnings=False,
189
+ by_alias=True
190
+ )
191
+ )
192
+ LOG.debug(f"SBOM file generated successfully at {output_file}")
193
+ else:
194
+ output_file.write(sbom.model_dump_json(
195
+ indent=2,
196
+ exclude_none=True,
197
+ exclude_defaults=True,
198
+ warnings=False,
199
+ by_alias=True
200
+ ))
192
201
  return True
193
202
 
194
203
 
@@ -517,7 +526,7 @@ def process_dotnet_dependencies(dotnet_deps: dict[str, dict], dependencies_dict:
517
526
  ],
518
527
  )
519
528
  if hash_content:
520
- comp.hashes = [Hash(alg=HashAlg.SHA_512, content=hash_content)],
529
+ comp.hashes = Hash(alg=HashAlg.SHA_512, content=hash_content),
521
530
  comp.bom_ref = RefType(purl)
522
531
  components.append(comp)
523
532
  targets: dict[str, dict[str, dict]] = dotnet_deps.get("targets", {})
@@ -567,7 +576,7 @@ def process_go_dependencies(go_deps: dict[str, str]) -> list[Component]:
567
576
  except binascii.Error:
568
577
  hash_content = str(v.get("hash").removeprefix("h1:"))
569
578
  if hash_content:
570
- comp.hashes = [Hash(alg=HashAlg.SHA_256, content=hash_content)]
579
+ comp.hashes = Hash(alg=HashAlg.SHA_256, content=hash_content)
571
580
  comp.bom_ref = RefType(f"""pkg:golang/{k}@{v.get("version")}""")
572
581
  components.append(comp)
573
582
  return components
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "blint"
3
- version = "2.0.5"
3
+ version = "2.0.7"
4
4
  description = "Linter and SBOM generator for binary files."
5
5
  authors = ["Prabhu Subramanian <prabhu@appthreat.com>", "Caroline Russell <caroline@appthreat.dev>"]
6
6
  license = "MIT"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes