blint 3.0.2__tar.gz → 3.0.3__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 (41) hide show
  1. {blint-3.0.2 → blint-3.0.3}/PKG-INFO +1 -1
  2. {blint-3.0.2 → blint-3.0.3}/blint/config.py +53 -11
  3. {blint-3.0.2 → blint-3.0.3}/blint/lib/binary.py +6 -1
  4. {blint-3.0.2 → blint-3.0.3}/blint/lib/disassembler.py +4 -2
  5. {blint-3.0.2 → blint-3.0.3}/blint/lib/runners.py +1 -1
  6. {blint-3.0.2 → blint-3.0.3}/blint/lib/utils.py +4 -1
  7. {blint-3.0.2 → blint-3.0.3}/pyproject.toml +1 -1
  8. {blint-3.0.2 → blint-3.0.3}/LICENSE +0 -0
  9. {blint-3.0.2 → blint-3.0.3}/README.md +0 -0
  10. {blint-3.0.2 → blint-3.0.3}/blint/__init__.py +0 -0
  11. {blint-3.0.2 → blint-3.0.3}/blint/cli.py +0 -0
  12. {blint-3.0.2 → blint-3.0.3}/blint/cyclonedx/README.md +0 -0
  13. {blint-3.0.2 → blint-3.0.3}/blint/cyclonedx/__init__.py +0 -0
  14. {blint-3.0.2 → blint-3.0.3}/blint/cyclonedx/spdx.py +0 -0
  15. {blint-3.0.2 → blint-3.0.3}/blint/cyclonedx/spec.py +0 -0
  16. {blint-3.0.2 → blint-3.0.3}/blint/data/__init__.py +0 -0
  17. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/__init__.py +0 -0
  18. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_entries_generic.yml +0 -0
  19. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_entries_pe.yml +0 -0
  20. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_exe_go.yml +0 -0
  21. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_functions_generic.yml +0 -0
  22. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_imports_pe.yml +0 -0
  23. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_methods_generic.yml +0 -0
  24. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_methods_mips.yml +0 -0
  25. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_monero_generic.yml +0 -0
  26. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_monero_go.yml +0 -0
  27. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_monero_rust.yml +0 -0
  28. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_rootkits_win.yml +0 -0
  29. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_symbols_antiforensic.yml +0 -0
  30. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_symbols_generic.yml +0 -0
  31. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_symbols_hooka.yml +0 -0
  32. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_symbols_macho.yml +0 -0
  33. {blint-3.0.2 → blint-3.0.3}/blint/data/annotations/review_symbols_rust.yml +0 -0
  34. {blint-3.0.2 → blint-3.0.3}/blint/data/rules.yml +0 -0
  35. {blint-3.0.2 → blint-3.0.3}/blint/db.py +0 -0
  36. {blint-3.0.2 → blint-3.0.3}/blint/lib/__init__.py +0 -0
  37. {blint-3.0.2 → blint-3.0.3}/blint/lib/analysis.py +0 -0
  38. {blint-3.0.2 → blint-3.0.3}/blint/lib/android.py +0 -0
  39. {blint-3.0.2 → blint-3.0.3}/blint/lib/checks.py +0 -0
  40. {blint-3.0.2 → blint-3.0.3}/blint/lib/sbom.py +0 -0
  41. {blint-3.0.2 → blint-3.0.3}/blint/logger.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blint
3
- Version: 3.0.2
3
+ Version: 3.0.3
4
4
  Summary: Linter and SBOM generator for binary files.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -1399,20 +1399,62 @@ CRYPTO_INDICATORS = [
1399
1399
  'npxor', 'vpxor', 'vpxord', 'vpxorq',
1400
1400
  'pshufb', 'vpshufb',
1401
1401
  'pclmulqdq', 'vpclmulqdq',
1402
- 'movdqa', 'movdqu', 'vmovdqa', 'vmovdqu',
1403
- 'padd', 'psub', 'pmul',
1404
- 'psll', 'psrl', 'psra',
1405
1402
  'vpaddd', 'vpsubd', 'vpmulld', 'pmaddwd'
1406
1403
  ]
1404
+
1405
+ # https://docs.nvidia.com/cuda/cuda-binary-utilities/index.html#turing-turing-instruction-set-table
1407
1406
  GPU_INDICATORS = [
1408
- 'glbind', 'glvertex', 'glcolor', 'glbegin', 'glend', 'glenable', 'gldisable', 'glget', 'glset', 'glload', 'glsave', 'gluniform', 'gluseprogram', 'glattachshader', 'gldraw', 'glclear', 'glviewport', 'glmatrix', 'glpushmatrix', 'glpopmatrix',
1409
- 'cuda', 'cuinit', 'cucontext', 'cudriver', 'cugpu', 'cudevice', 'cumem', 'cuptr', 'cukernel', 'culaunch', 'cugrid', 'cublock', 'cuthread', 'cufree', 'cucopy',
1410
- 'clgetplatform', 'clgetdevice', 'clcreatecontext', 'clcreatecommandqueue', 'clcreateshared', 'clcreatekernel', 'clsetkernelarg', 'clenqueuendrange', 'clfinish', 'clrelease', 'clbuildprogram',
1411
- 'd3d', 'd3d11', 'd3d12', 'create', 'device', 'swapchain', 'rendertarget', 'shaders', 'ps_', 'vs_', 'gs_', 'cs_', 'hs_', 'ds_',
1412
- 'vkcreate', 'vkdestroy', 'vkallocate', 'vkfree', 'vkqueue', 'vksubmit', 'vkwait', 'vkacquire', 'vkpresent', 'vkcmd', 'vkbegin', 'vkend', 'vkbind', 'vkdraw', 'vkdispatch', 'vkcopy', 'vkblit', 'vkclear', 'vkfill', 'vkupdate',
1413
- 'mtl', 'metal', 'mtldevice', 'mtlcommand', 'mtlrender', 'mtlcompute', 'mtlbuffer', 'mtltexture', 'mtlfunction', 'mtllibrary', 'mtlencoder', 'mtlpass',
1414
- 'gpu', 'compute', 'shader', 'vertex', 'fragment', 'pixel', 'kernel', 'workgroup', 'local', 'global', 'buffer', 'texture', 'surface',
1415
- ]
1407
+ 'acqbulk', 'acqshminit', 'atom', 'atomg', 'atoms', 'b2r', 'bgmma',
1408
+ 'bmov', 'bmma', 'bmsk', 'bpt', 'brx', 'brxu',
1409
+ 'bssy', 'bsync', 'bvote', 'cctl', 'cctll', 'cctlt',
1410
+ 'cgaerrbar', 'clclear', 'clcolor', 'clcreatecommandqueue',
1411
+ 'clcreatecontext', 'clcreatekernel', 'clcreateshared', 'cldevice',
1412
+ 'clenqueuendrange', 'clfinish', 'clgetdevice', 'clgetplatform', 'clcopy',
1413
+ 'clrelease', 'clsetkernelarg', 'compute', 'credux', 'cs2r',
1414
+ 'cs2ur', 'cuda', 'cublock', 'cucontext', 'cucopy', 'cudevice',
1415
+ 'cudriver', 'cufree', 'cugpu', 'cugrid', 'cuinit', 'cukernel', 'culaunch',
1416
+ 'cumem', 'cuptr', 'cuthread', 'd3d', 'd3d11', 'd3d12', 'depbar',
1417
+ 'dfma', 'dmma', 'elect', 'endcollective',
1418
+ 'errbar', 'fadd32i',
1419
+ 'fchk', 'ffma2', 'ffma32i', 'fhfma', 'fmnmx',
1420
+ 'fmnmx3', 'fmul2', 'fmul32i', 'fragment',
1421
+ 'fswzadd', 'getlmembase', 'glattachshader', 'glbegin', 'glbind',
1422
+ 'glclear', 'glcolor', 'gldisable', 'gldraw', 'glend', 'glenable', 'glget',
1423
+ 'glload', 'glmatrix', 'glpopmatrix', 'glpushmatrix', 'glsave', 'glset',
1424
+ 'gluniform', 'gluseprogram', 'glvertex', 'glviewport', 'gpu',
1425
+ 'gs_', 'hadd2', 'hadd2_32i', 'hfma2', 'hfma2_32i', 'hgmma', 'hmma',
1426
+ 'hmnmx2', 'hmul2', 'hmul2_32i',
1427
+ 'iadd3', 'iadd32i', 'idp4a', 'igmma',
1428
+ 'imma', 'imnmx', 'imul32i', 'iscadd', 'iscadd32i',
1429
+ 'jmxu', 'ldcu',
1430
+ 'ldgdepbar', 'ldgmc', 'ldgsts' 'ldsm', 'ldtm',
1431
+ 'lepc', 'lop3', 'lop32i', 'metal',
1432
+ 'mov32i', 'movm', 'mtl', 'mtlbuffer', 'mtlcommand', 'mtlcompute',
1433
+ 'mtldevice', 'mtlencoder', 'mtlfunction', 'mtllibrary', 'mtlpass',
1434
+ 'mtlrender', 'mtltexture', 'mufu', 'omma', 'p2r',
1435
+ 'plop3', 'pmtrig', 'preexit',
1436
+ 'qgmma', 'qspc', 'r2b', 'r2p', 'r2ur', 'redas', 'redg', 'redux',
1437
+ 'rendertarget', 'rpcmov', 'rtt', 's2r', 's2ur', 'setctaid',
1438
+ 'setlmembase', 'shader', 'shaders', 'shf', 'shfl', 'sgxt',
1439
+ 'stas', 'stg', 'stsm', 'sttm', 'suatom', 'suld',
1440
+ 'sured', 'sust', 'swapchain', 'syncs', 'tex', 'texture', 'tld',
1441
+ 'tld4', 'tmml', 'txd', 'txq', 'ublkcp', 'ublkpf', 'ublkred', 'ubmsk',
1442
+ 'ubrev', 'ucgabar_arv', 'ucgabar_wait', 'uclea', 'uf2f', 'uf2fp', 'uf2i',
1443
+ 'uf2ip', 'ufadd', 'uffma', 'uflo', 'ufmnmx', 'ufmul', 'ufrnd', 'ufsel',
1444
+ 'ugetnextworkid', 'ui2f', 'ui2fp', 'ui2i', 'ui2ip',
1445
+ 'uiabs', 'uiadd3', 'uiadd3.64', 'uimad', 'uimnmx', 'uldc', 'ulea',
1446
+ 'ulepc', 'ulop', 'ulop3', 'ulop32i', 'umemsets', 'up2ur', 'uplop3',
1447
+ 'upopc', 'ur2up', 'uredgr', 'usel', 'usetmaxreg',
1448
+ 'usgxt', 'ushf', 'ushl', 'ushr', 'ustgr', 'utcatomsws', 'utcbar', 'utccp',
1449
+ 'utchmma', 'utcimma', 'utcomma', 'utcqmma', 'utcshift', 'utmacctl',
1450
+ 'utmacmdflush', 'utmaldg', 'utmapf', 'utmaredg', 'utmastg', 'uviadd',
1451
+ 'uvimnmx', 'uvirtcount', 'vabsdiff4', 'vertex', 'vhmnmx',
1452
+ 'viadd', 'viaddmnmx', 'vimnmx', 'vimnmx3', 'vkacquire', 'vkallocate',
1453
+ 'vkbegin', 'vkbind', 'vkblit', 'vkclear', 'vkcmd', 'vkcopy', 'vkcreate',
1454
+ 'vkdestroy', 'vkdispatch', 'vkdraw', 'vkend', 'vkfill', 'vkfree',
1455
+ 'vkpresent', 'vkqueue', 'vksubmit', 'vkupdate', 'vkwait',
1456
+ 'warpgroup', 'warpgroupset', 'warpsync', 'vote'
1457
+ ]
1416
1458
 
1417
1459
  IMPLICIT_REGS_X86 = {
1418
1460
  'mul': {'read': {'ax', 'eax', 'rax'}, 'write': {'dx', 'ax', 'edx', 'eax', 'rdx', 'rax'}},
@@ -394,6 +394,11 @@ def process_pe_resources(parsed_obj):
394
394
  for e in lc_item.entries:
395
395
  version_metadata[e.key] = e.value
396
396
  try:
397
+ version_info_dict = {}
398
+ if version_info:
399
+ for k in ("file_info", "key", "type"):
400
+ if hasattr(version_info, k):
401
+ version_info_dict[k] = re.sub('\s+', ' ', str(getattr(version_info, k))).strip()
397
402
  resources = {
398
403
  "has_accelerator": rm.has_accelerator,
399
404
  "has_dialogs": rm.has_dialogs,
@@ -407,7 +412,7 @@ def process_pe_resources(parsed_obj):
407
412
  if rm.has_manifest
408
413
  else None
409
414
  ),
410
- "version_info": str(rm.version) if rm.has_version else None,
415
+ "version_info": version_info_dict,
411
416
  "html": rm.html if rm.has_html else None,
412
417
  }
413
418
  if version_metadata:
@@ -715,6 +715,8 @@ def disassemble_functions(parsed_obj, metadata, arch_target="", cpu="", features
715
715
  arch_target = machine_type
716
716
  if arch_target == "arm64" or (metadata.get("binary_type", "") == "MachO" and not arch_target):
717
717
  arch_target = "aarch64"
718
+ if arch_target == "riscv":
719
+ arch_target = "riscv64"
718
720
  if not arch_target:
719
721
  arch_target = "x86_64"
720
722
  try:
@@ -797,8 +799,8 @@ def disassemble_functions(parsed_obj, metadata, arch_target="", cpu="", features
797
799
  instruction_hash = hashlib.sha256(joined_mnemonics.encode('utf-8')).hexdigest()
798
800
  has_system_call = any(syscall_pattern in lower_assembly for syscall_pattern in SYSCALL_INDICATORS)
799
801
  has_security_feature = any(feature_pattern in lower_assembly for feature_pattern in SECURITY_INDICATORS)
800
- has_crypto_call = any(indicator in lower_assembly for indicator in CRYPTO_INDICATORS)
801
- has_gpu_call = any(indicator in lower_assembly for indicator in GPU_INDICATORS)
802
+ has_crypto_call = any(f"{indicator} " in lower_assembly for indicator in CRYPTO_INDICATORS if len(indicator) > 3)
803
+ has_gpu_call = any(f"{indicator} " in lower_assembly for indicator in GPU_INDICATORS if len(indicator) > 3)
802
804
  function_type = _classify_function(instruction_metrics, instruction_count, plain_assembly_text, has_system_call, has_indirect_call)
803
805
  disassembly_results[f"{func_addr_va_hex}::{func_name}"] = {
804
806
  "name": func_name,
@@ -101,7 +101,7 @@ class AnalysisRunner:
101
101
  """
102
102
  self.progress.update(self.task, description=f"Processing [bold]{f}[/bold]")
103
103
  metadata = parse(f, blint_options.disassemble)
104
- exe_name = metadata.get("name", "")
104
+ exe_name = metadata.get("name", f)
105
105
  # Store raw metadata
106
106
  export_metadata(blint_options.reports_dir, metadata, f"{os.path.basename(exe_name)}-metadata")
107
107
  self.progress.update(self.task, description=f"Checking [bold]{f}[/bold] against rules")
@@ -653,12 +653,15 @@ def extract_ar(ar_file: str, to_dir: str | None = None) -> list[str]:
653
653
  for entry in archive:
654
654
  # This workarounds a bug in ar that returns multiple names
655
655
  file_name = entry.name.split("\n")[0].removesuffix("/")
656
+ if os.path.sep in file_name:
657
+ file_name = file_name.rsplit(os.path.sep, 1)[-1]
656
658
  afile = os.path.join(to_dir, file_name)
657
659
  with open(afile, "wb") as output:
658
660
  output.write(archive.open(entry, "rb").read())
659
661
  files_list.append(afile)
660
662
  except (ArchiveError, ValueError) as e:
661
- LOG.warning(f"Failed to extract {ar_file}: {e}")
663
+ if e.args and "Unexpected magic" not in e.args[0]:
664
+ LOG.warning(f"Failed to extract {ar_file}: {e}")
662
665
  return files_list
663
666
 
664
667
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "blint"
3
- version = "3.0.2"
3
+ version = "3.0.3"
4
4
  description = "Linter and SBOM generator for binary files."
5
5
  authors = [
6
6
  {name= "Team AppThreat", email = "cloud@appthreat.com"},
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
File without changes
File without changes