dexsect 4.1.0__py3-none-any.whl

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 (74) hide show
  1. dexsect/__init__.py +4 -0
  2. dexsect/__main__.py +5 -0
  3. dexsect/catalog/EXTRACTION_CATALOG.json +4057 -0
  4. dexsect/catalog/__init__.py +0 -0
  5. dexsect/cli.py +1272 -0
  6. dexsect/core/__init__.py +0 -0
  7. dexsect/core/config.py +177 -0
  8. dexsect/core/context.py +181 -0
  9. dexsect/core/i18n.py +40 -0
  10. dexsect/core/pipeline.py +153 -0
  11. dexsect/core/platform_utils.py +164 -0
  12. dexsect/core/runner.py +124 -0
  13. dexsect/core/theme.py +64 -0
  14. dexsect/core/ui.py +405 -0
  15. dexsect/core/utils.py +150 -0
  16. dexsect/inspectors/__init__.py +0 -0
  17. dexsect/inspectors/assets_db_inspector.py +235 -0
  18. dexsect/inspectors/base.py +46 -0
  19. dexsect/inspectors/bundle_inspector.py +55 -0
  20. dexsect/inspectors/code_inspector.py +341 -0
  21. dexsect/inspectors/custom_rules_inspector.py +178 -0
  22. dexsect/inspectors/dex_inspector.py +144 -0
  23. dexsect/inspectors/manifest_inspector.py +503 -0
  24. dexsect/inspectors/native_fw_inspector.py +167 -0
  25. dexsect/inspectors/resources_inspector.py +195 -0
  26. dexsect/inspectors/scanner_inspector.py +153 -0
  27. dexsect/inspectors/signing_inspector.py +423 -0
  28. dexsect/inspectors/text_scanner.py +336 -0
  29. dexsect/locales/__init__.py +0 -0
  30. dexsect/locales/ar.json +130 -0
  31. dexsect/locales/de.json +51 -0
  32. dexsect/locales/en.json +110 -0
  33. dexsect/locales/es.json +51 -0
  34. dexsect/locales/fr.json +51 -0
  35. dexsect/locales/ja.json +51 -0
  36. dexsect/locales/pt.json +51 -0
  37. dexsect/locales/ru.json +51 -0
  38. dexsect/locales/tr.json +51 -0
  39. dexsect/locales/zh.json +51 -0
  40. dexsect/parsers/__init__.py +0 -0
  41. dexsect/parsers/axml.py +264 -0
  42. dexsect/parsers/bundle.py +214 -0
  43. dexsect/parsers/elf.py +396 -0
  44. dexsect/phases/__init__.py +0 -0
  45. dexsect/phases/base.py +102 -0
  46. dexsect/phases/decode.py +507 -0
  47. dexsect/phases/decompile.py +408 -0
  48. dexsect/phases/fingerprint.py +341 -0
  49. dexsect/phases/frameworks.py +377 -0
  50. dexsect/phases/mapper.py +41 -0
  51. dexsect/phases/native.py +188 -0
  52. dexsect/plugins/__init__.py +0 -0
  53. dexsect/plugins/base.py +20 -0
  54. dexsect/plugins/diff.py +162 -0
  55. dexsect/plugins/inspect.py +172 -0
  56. dexsect/plugins/report.py +80 -0
  57. dexsect/plugins/trace.py +141 -0
  58. dexsect/reporting/__init__.py +0 -0
  59. dexsect/reporting/analysis_report.py +1190 -0
  60. dexsect/reporting/diff_report.py +144 -0
  61. dexsect/reporting/sarif_report.py +109 -0
  62. dexsect/reporting/unpack_map.py +149 -0
  63. dexsect/rules/__init__.py +0 -0
  64. dexsect/rules/anti_analysis.json +45 -0
  65. dexsect/rules/crypto_audit.json +41 -0
  66. dexsect/rules/secrets_extended.json +46 -0
  67. dexsect/storage/__init__.py +0 -0
  68. dexsect/storage/findings_db.py +460 -0
  69. dexsect-4.1.0.dist-info/METADATA +532 -0
  70. dexsect-4.1.0.dist-info/RECORD +74 -0
  71. dexsect-4.1.0.dist-info/WHEEL +5 -0
  72. dexsect-4.1.0.dist-info/entry_points.txt +2 -0
  73. dexsect-4.1.0.dist-info/licenses/LICENSE +21 -0
  74. dexsect-4.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,423 @@
1
+ import hashlib
2
+ import os
3
+ import re
4
+ import shutil
5
+ import struct
6
+ import subprocess
7
+ import tempfile
8
+ import time
9
+ import zipfile
10
+ from pathlib import Path
11
+ from typing import Any, Dict, List, Optional, Tuple
12
+
13
+ from ..core.context import ArtifactUnit, PipelineContext
14
+ from ..storage.findings_db import FindingItem, FindingsDB
15
+ from .base import BaseInspector, InspectorResult
16
+
17
+
18
+ APK_SIG_BLOCK_MAGIC = b"APK Sig Block 42"
19
+ APK_SIG_V2_ID = 0x7109871A
20
+ APK_SIG_V3_ID = 0xF05368C0
21
+ APK_SIG_V31_ID = 0x1B93AD61
22
+
23
+
24
+
25
+ OID_NAMES = {
26
+ (2, 5, 4, 3): "CN", (2, 5, 4, 6): "C", (2, 5, 4, 7): "L",
27
+ (2, 5, 4, 8): "ST", (2, 5, 4, 10): "O", (2, 5, 4, 11): "OU",
28
+ }
29
+
30
+
31
+ def _read_tlv(buf: bytes, off: int):
32
+ if off >= len(buf):
33
+ return None, 0, off
34
+ tag = buf[off]
35
+ off += 1
36
+ if off >= len(buf):
37
+ return None, 0, off
38
+ lb = buf[off]
39
+ off += 1
40
+ if lb & 0x80:
41
+ num = lb & 0x7F
42
+ if num == 0 or off + num > len(buf):
43
+ return None, 0, off
44
+ length = int.from_bytes(buf[off : off + num], "big")
45
+ off += num
46
+ else:
47
+ length = lb
48
+ if off + length > len(buf):
49
+ return None, 0, len(buf)
50
+ return tag, buf[off : off + length], off + length
51
+
52
+
53
+ def _decode_oid(raw: bytes) -> tuple:
54
+ if not raw:
55
+ return ()
56
+ out = [raw[0] // 40, raw[0] % 40]
57
+ val = 0
58
+ for b in raw[1:]:
59
+ val = (val << 7) | (b & 0x7F)
60
+ if not (b & 0x80):
61
+ out.append(val)
62
+ val = 0
63
+ return tuple(out)
64
+
65
+
66
+ def _parse_rdn_seq(seq_bytes: bytes) -> str:
67
+ parts = []
68
+ pos = 0
69
+ while pos < len(seq_bytes):
70
+ tag, rdn_set, pos = _read_tlv(seq_bytes, pos)
71
+ if tag is None:
72
+ break
73
+ spos = 0
74
+ while spos < len(rdn_set):
75
+ t2, atv, spos = _read_tlv(rdn_set, spos)
76
+ if t2 != 0x30:
77
+ continue
78
+ ot, ob, p2 = _read_tlv(atv, 0)
79
+ vt, vb, _ = _read_tlv(atv, p2)
80
+ if ot == 0x06 and vb:
81
+ key = OID_NAMES.get(_decode_oid(ob), ".".join(map(str, _decode_oid(ob))))
82
+ parts.append(f"{key}={vb.decode('utf-8', errors='replace')}")
83
+ return ", ".join(parts)
84
+
85
+
86
+ def _parse_cert_pure_python(cert_bytes: bytes) -> Optional[Dict[str, str]]:
87
+ """Minimal pure-Python ASN.1 DER X.509 parser (handles raw DER and PKCS7-wrapped DER)."""
88
+ def _try_x509(buf: bytes) -> Optional[Dict[str, str]]:
89
+ t, cert_body, _ = _read_tlv(buf, 0)
90
+ if t != 0x30:
91
+ return None
92
+ t_tbs, tbs, _ = _read_tlv(cert_body, 0)
93
+ if t_tbs != 0x30:
94
+ return None
95
+ pos = 0
96
+ t0, v0, nxt = _read_tlv(tbs, pos)
97
+ if t0 == 0xA0: # optional explicit version [0]
98
+ pos = nxt
99
+ t_ser, ser_b, pos = _read_tlv(tbs, pos)
100
+ if t_ser != 0x02:
101
+ return None
102
+ _t_alg, _alg_b, pos = _read_tlv(tbs, pos)
103
+ t_iss, iss_b, pos = _read_tlv(tbs, pos)
104
+ t_val, val_b, pos = _read_tlv(tbs, pos)
105
+ t_sub, sub_b, pos = _read_tlv(tbs, pos)
106
+ if t_iss != 0x30 or t_val != 0x30 or t_sub != 0x30:
107
+ return None
108
+ vpos = 0
109
+ _, nb_b, vpos = _read_tlv(val_b, vpos)
110
+ _, na_b, _ = _read_tlv(val_b, vpos)
111
+ sha256_fmt = ":".join(f"{b:02X}" for b in hashlib.sha256(buf).digest())
112
+ sha1_fmt = ":".join(f"{b:02X}" for b in hashlib.sha1(buf).digest())
113
+ return {
114
+ "subject": _parse_rdn_seq(sub_b),
115
+ "issuer": _parse_rdn_seq(iss_b),
116
+ "serial": ser_b.hex(),
117
+ "valid_from": nb_b.decode("ascii", errors="ignore"),
118
+ "valid_until": na_b.decode("ascii", errors="ignore"),
119
+ "sha1": sha1_fmt,
120
+ "sha256": sha256_fmt,
121
+ "sig_alg": "",
122
+ "key_info": "",
123
+ }
124
+
125
+ direct = _try_x509(cert_bytes)
126
+ if direct and (direct["subject"] or direct["issuer"]):
127
+ return direct
128
+ # Search inside PKCS7 SignedData [0] container for embedded X.509 certificate
129
+ idx = cert_bytes.find(b"\xa0\x03\x02\x01\x02")
130
+ if idx > 4:
131
+ for back in range(max(0, idx - 12), idx):
132
+ if cert_bytes[back] == 0x30:
133
+ res = _try_x509(cert_bytes[back:])
134
+ if res and (res["subject"] or res["issuer"]):
135
+ return res
136
+ return None
137
+
138
+ def _parse_cert_with_keytool(cert_bytes: bytes) -> Optional[Dict[str, str]]:
139
+ keytool = shutil.which("keytool")
140
+ if not keytool:
141
+ return None
142
+ tmp_path = None
143
+ try:
144
+ fd, tmp_path = tempfile.mkstemp(suffix=".der")
145
+ os.write(fd, cert_bytes)
146
+ os.close(fd)
147
+ proc = subprocess.run(
148
+ [keytool, "-printcert", "-file", tmp_path],
149
+ stdout=subprocess.PIPE,
150
+ stderr=subprocess.STDOUT,
151
+ text=True,
152
+ errors="replace",
153
+ timeout=15,
154
+ )
155
+ txt = proc.stdout
156
+ if proc.returncode != 0 or "Owner:" not in txt:
157
+ return None
158
+
159
+ def _rx(pattern: str) -> str:
160
+ m = re.search(pattern, txt, re.MULTILINE)
161
+ return m.group(1).strip() if m else ""
162
+
163
+ return {
164
+ "subject": _rx(r"^\s*Owner:\s*(.+)$"),
165
+ "issuer": _rx(r"^\s*Issuer:\s*(.+)$"),
166
+ "serial": _rx(r"^\s*Serial number:\s*(.+)$"),
167
+ "valid_from": _rx(r"^\s*Valid from:\s*(.+?)\s+until:"),
168
+ "valid_until": _rx(r"until:\s*(.+)$"),
169
+ "sha1": _rx(r"^\s*SHA1:\s*([0-9A-Fa-f:]+)"),
170
+ "sha256": _rx(r"^\s*SHA256:\s*([0-9A-Fa-f:]+)"),
171
+ "sig_alg": _rx(r"^\s*Signature algorithm name:\s*(.+)$"),
172
+ "key_info": _rx(r"^\s*Subject Public Key Algorithm:\s*(.+)$"),
173
+ }
174
+ except Exception:
175
+ return None
176
+ finally:
177
+ if tmp_path and os.path.exists(tmp_path):
178
+ try:
179
+ os.unlink(tmp_path)
180
+ except OSError:
181
+ pass
182
+
183
+
184
+ def _parse_cert_with_openssl(cert_bytes: bytes) -> Optional[Dict[str, str]]:
185
+ openssl = shutil.which("openssl")
186
+ if not openssl:
187
+ return None
188
+ try:
189
+ # Try DER directly first (v2/v3 certs), then PKCS7 DER (v1 .RSA)
190
+ for fmt_cmd in (
191
+ [openssl, "x509", "-inform", "DER", "-noout", "-subject", "-issuer", "-serial", "-dates", "-fingerprint", "-sha256"],
192
+ None,
193
+ ):
194
+ if fmt_cmd:
195
+ p = subprocess.run(fmt_cmd, input=cert_bytes, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, errors="replace", timeout=15)
196
+ if p.returncode == 0 and "subject=" in p.stdout:
197
+ txt = p.stdout
198
+ break
199
+ else:
200
+ p1 = subprocess.run([openssl, "pkcs7", "-inform", "DER", "-print_certs"], input=cert_bytes, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=15)
201
+ if p1.returncode != 0 or not p1.stdout:
202
+ return None
203
+ p2 = subprocess.run(
204
+ [openssl, "x509", "-noout", "-subject", "-issuer", "-serial", "-dates", "-fingerprint", "-sha256"],
205
+ input=p1.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, errors="replace", timeout=15,
206
+ )
207
+ if p2.returncode != 0:
208
+ return None
209
+ txt = p2.stdout
210
+
211
+ def _rx(pat: str) -> str:
212
+ m = re.search(pat, txt, re.MULTILINE)
213
+ return m.group(1).strip() if m else ""
214
+
215
+ return {
216
+ "subject": _rx(r"^subject=(.+)$"),
217
+ "issuer": _rx(r"^issuer=(.+)$"),
218
+ "serial": _rx(r"^serial=(.+)$"),
219
+ "valid_from": _rx(r"^notBefore=(.+)$"),
220
+ "valid_until": _rx(r"^notAfter=(.+)$"),
221
+ "sha1": "",
222
+ "sha256": _rx(r"Fingerprint=(.+)$"),
223
+ "sig_alg": "",
224
+ "key_info": "",
225
+ }
226
+ except Exception:
227
+ return None
228
+
229
+
230
+ def _extract_v2_v3_certs(apk_path: Path) -> Tuple[List[str], List[Tuple[str, bytes]]]:
231
+ """Parse APK Signing Block v2/v3 directly from binary ZIP layout and return DER certificates."""
232
+ schemes: List[str] = []
233
+ certs: List[Tuple[str, bytes]] = []
234
+ try:
235
+ size = apk_path.stat().st_size
236
+ with apk_path.open("rb") as f:
237
+ tail_len = min(size, 65536 + 22)
238
+ f.seek(size - tail_len)
239
+ tail = f.read(tail_len)
240
+ eocd_pos = tail.rfind(b"PK\x05\x06")
241
+ if eocd_pos == -1 or eocd_pos + 20 > len(tail):
242
+ return schemes, certs
243
+ cd_offset = struct.unpack_from("<I", tail, eocd_pos + 16)[0]
244
+ if cd_offset < 32 or cd_offset > size:
245
+ return schemes, certs
246
+
247
+ f.seek(cd_offset - 24)
248
+ footer = f.read(24)
249
+ if len(footer) != 24 or footer[8:] != APK_SIG_BLOCK_MAGIC:
250
+ return schemes, certs
251
+ block_size = struct.unpack_from("<Q", footer, 0)[0]
252
+ block_start = cd_offset - 8 - block_size
253
+ if block_start < 0 or block_size > 16 * 1024 * 1024:
254
+ return schemes, certs
255
+
256
+ f.seek(block_start + 8)
257
+ pairs_bytes = f.read(block_size - 24)
258
+
259
+ pos = 0
260
+ while pos + 12 <= len(pairs_bytes):
261
+ pair_len = struct.unpack_from("<Q", pairs_bytes, pos)[0]
262
+ pos += 8
263
+ if pair_len < 4 or pos + pair_len > len(pairs_bytes):
264
+ break
265
+ pair_id = struct.unpack_from("<I", pairs_bytes, pos)[0]
266
+ val = pairs_bytes[pos + 4 : pos + pair_len]
267
+ pos += pair_len
268
+
269
+ if pair_id in (APK_SIG_V2_ID, APK_SIG_V3_ID, APK_SIG_V31_ID):
270
+ scheme_name = "v2" if pair_id == APK_SIG_V2_ID else ("v3" if pair_id == APK_SIG_V3_ID else "v3.1")
271
+ schemes.append(scheme_name)
272
+ if len(val) < 4:
273
+ continue
274
+ signers_len = struct.unpack_from("<I", val, 0)[0]
275
+ sp = 4
276
+ end_s = min(len(val), 4 + signers_len)
277
+ while sp + 4 <= end_s:
278
+ s_len = struct.unpack_from("<I", val, sp)[0]
279
+ sp += 4
280
+ signer = val[sp : sp + s_len]
281
+ sp += s_len
282
+ if len(signer) < 4:
283
+ continue
284
+ sd_len = struct.unpack_from("<I", signer, 0)[0]
285
+ sd = signer[4 : 4 + sd_len]
286
+ if len(sd) < 8:
287
+ continue
288
+ dig_len = struct.unpack_from("<I", sd, 0)[0]
289
+ cp = 4 + dig_len
290
+ if cp + 4 > len(sd):
291
+ continue
292
+ certs_len = struct.unpack_from("<I", sd, cp)[0]
293
+ cp += 4
294
+ end_c = min(len(sd), cp + certs_len)
295
+ while cp + 4 <= end_c:
296
+ c_len = struct.unpack_from("<I", sd, cp)[0]
297
+ cp += 4
298
+ c_der = sd[cp : cp + c_len]
299
+ cp += c_len
300
+ if c_der:
301
+ certs.append((f"APK_Sig_{scheme_name}", c_der))
302
+ except Exception:
303
+ pass
304
+ return schemes, certs
305
+
306
+
307
+ class SigningInspector(BaseInspector):
308
+ name = "signing"
309
+ description = "Inspect APK signing certificates (v1/v2/v3), fingerprints, and signature schemes"
310
+ domains = ["Signing & Integrity"]
311
+ catalog_ids = ["SIG-001", "SIG-002", "SIG-003", "SIG-004", "SIG-005", "SIG-006", "SIG-007"]
312
+
313
+ def _emit_cert_findings(
314
+ self, uid: str, label: str, cert_bytes: bytes, findings: List[FindingItem], parsed_certs: List[Dict[str, str]]
315
+ ) -> None:
316
+ cinfo = _parse_cert_with_keytool(cert_bytes) or _parse_cert_with_openssl(cert_bytes) or _parse_cert_pure_python(cert_bytes)
317
+ if not cinfo:
318
+ return
319
+ cinfo["cert_file"] = label
320
+ parsed_certs.append(cinfo)
321
+ if cinfo.get("subject"):
322
+ findings.append(FindingItem(
323
+ catalog_id="SIG-002", domain="Signing & Integrity", subdomain="Certificates",
324
+ unit_id=uid, layer="apk_zip", title="Certificate Subject",
325
+ value=cinfo["subject"], file_path=label, extra={"issuer": cinfo.get("issuer", "")},
326
+ ))
327
+ if cinfo.get("issuer"):
328
+ findings.append(FindingItem(
329
+ catalog_id="SIG-002", domain="Signing & Integrity", subdomain="Certificates",
330
+ unit_id=uid, layer="apk_zip", title="Certificate Issuer",
331
+ value=cinfo["issuer"], file_path=label,
332
+ ))
333
+ if cinfo.get("serial") or cinfo.get("valid_from"):
334
+ val = f"serial={cinfo.get('serial')} | {cinfo.get('valid_from')} -> {cinfo.get('valid_until')}"
335
+ findings.append(FindingItem(
336
+ catalog_id="SIG-003", domain="Signing & Integrity", subdomain="Certificates",
337
+ unit_id=uid, layer="apk_zip", title="Serial & Validity",
338
+ value=val, file_path=label, extra=cinfo,
339
+ ))
340
+ if cinfo.get("sha256"):
341
+ findings.append(FindingItem(
342
+ catalog_id="SIG-004", domain="Signing & Integrity", subdomain="Certificates",
343
+ unit_id=uid, layer="apk_zip", title="SHA256 Fingerprint",
344
+ value=cinfo["sha256"], file_path=label, extra={"sha1": cinfo.get("sha1", "")},
345
+ ))
346
+ if cinfo.get("sig_alg") or cinfo.get("key_info"):
347
+ findings.append(FindingItem(
348
+ catalog_id="SIG-005", domain="Signing & Integrity", subdomain="Certificates",
349
+ unit_id=uid, layer="apk_zip", title="Algorithm & Key",
350
+ value=f"{cinfo.get('sig_alg', '')} | {cinfo.get('key_info', '')}".strip(" |"),
351
+ file_path=label,
352
+ ))
353
+ subj_low = (cinfo.get("subject", "") + " " + cinfo.get("issuer", "")).lower()
354
+ is_debug_cert = ("android debug" in subj_low) or ("testkey" in subj_low)
355
+ findings.append(FindingItem(
356
+ catalog_id="SIG-006", domain="Signing & Integrity", subdomain="Certificates",
357
+ unit_id=uid, layer="apk_zip", title="Debug/TestKey Match",
358
+ value="true" if is_debug_cert else "false", file_path=label,
359
+ ))
360
+
361
+ def run(
362
+ self,
363
+ ctx: PipelineContext,
364
+ db: FindingsDB,
365
+ units: List[ArtifactUnit],
366
+ profile: str,
367
+ ) -> InspectorResult:
368
+ t0 = time.time()
369
+ findings: List[FindingItem] = []
370
+ summary_units: Dict[str, Any] = {}
371
+
372
+ for unit in units:
373
+ src = Path(unit.source_path) if unit.source_path else None
374
+ if not src or not src.is_file() or not zipfile.is_zipfile(src):
375
+ continue
376
+
377
+ v1_certs: List[str] = []
378
+ parsed_certs: List[Dict[str, str]] = []
379
+
380
+ with zipfile.ZipFile(src, "r") as zf:
381
+ for nm in sorted(zf.namelist()):
382
+ low = nm.lower()
383
+ if nm.startswith("META-INF/") and low.endswith((".rsa", ".dsa", ".ec")):
384
+ v1_certs.append(nm)
385
+ findings.append(FindingItem(
386
+ catalog_id="SIG-001", domain="Signing & Integrity", subdomain="Certificates",
387
+ unit_id=unit.unit_id, layer="apk_zip", title="Signature File (v1)",
388
+ value=nm, file_path=str(src),
389
+ ))
390
+ self._emit_cert_findings(unit.unit_id, nm, zf.read(nm), findings, parsed_certs)
391
+
392
+ v23_schemes, v23_certs = _extract_v2_v3_certs(src)
393
+ if not v1_certs and v23_certs:
394
+ for idx, (label, der_bytes) in enumerate(v23_certs, start=1):
395
+ lbl = f"{label}_cert{idx}"
396
+ findings.append(FindingItem(
397
+ catalog_id="SIG-001", domain="Signing & Integrity", subdomain="Certificates",
398
+ unit_id=unit.unit_id, layer="apk_zip", title=f"Signature ({label})",
399
+ value=lbl, file_path=str(src),
400
+ ))
401
+ self._emit_cert_findings(unit.unit_id, lbl, der_bytes, findings, parsed_certs)
402
+
403
+ scheme_desc = f"v1_jar={bool(v1_certs)}, v2_v3_schemes={sorted(set(v23_schemes))}"
404
+ findings.append(FindingItem(
405
+ catalog_id="SIG-007", domain="Signing & Integrity", subdomain="Integrity",
406
+ unit_id=unit.unit_id, layer="apk_zip", title="Signature Schemes",
407
+ value=scheme_desc, file_path=str(src),
408
+ extra={"v1": bool(v1_certs), "v2_v3": sorted(set(v23_schemes))},
409
+ ))
410
+ summary_units[unit.unit_id] = {
411
+ "v1_cert_files": v1_certs,
412
+ "v2_v3_schemes": sorted(set(v23_schemes)),
413
+ "certificates": parsed_certs,
414
+ }
415
+
416
+ inserted = db.insert_findings(findings)
417
+ return InspectorResult(
418
+ name=self.name,
419
+ status="COMPLETED",
420
+ duration_sec=round(time.time() - t0, 3),
421
+ findings_count=inserted,
422
+ summary=summary_units,
423
+ )