Skip to content

Fix crash bugs, remove dev cruft, English README#1

Open
paulpel wants to merge 1 commit into
mainfrom
cleanup/fix-crashes-and-readme
Open

Fix crash bugs, remove dev cruft, English README#1
paulpel wants to merge 1 commit into
mainfrom
cleanup/fix-crashes-and-readme

Conversation

@paulpel
Copy link
Copy Markdown
Owner

@paulpel paulpel commented May 26, 2026

Makes the toolkit actually run, removes course cruft, and documents it in English.

Crash / correctness fixes

  • choose_disk_image(change=False) was called in 3 places but the method takes no change argument → TypeError on every invalid-image path. Now called with no args.
  • UnboundLocalError on raw imagesheader_table/hash_table were only set in the EWF branch but always passed to the report builder. They're now initialised with defaults; also removed a redundant duplicate part_metadata() call.
  • Invalid fontsize= kwarg on PIL.ImageDraw.text (evidence_metadata.py, open_evidence.py) → load a font (DejaVuSans with a load_default() fallback) and pass font=.
  • pdf_analysis.py registered DejaVuSans.ttf from a bare filename (crashes if not in cwd) → falls back to the built-in Helvetica.
  • recovery_files.py hardcoded ~/infa/Disk-Project/... (and the ~ was never expanded, creating a literal ~ dir) → RECOVERY_OUTPUT_DIR env var defaulting to RecoveredDiskImages/, plus os.path.basename instead of a fragile split("/")[1].

Cleanup

  • choosenchosen typo throughout main.py (also removes a dead self.choosen_dir), and a stray debug print.
  • Drop the Python-2 from __future__ import print_function shim and duplicate PyPDF2 imports.
  • requirements.txt: re-encode UTF-16 → UTF-8 and add the missing runtime deps (pdf2image, PyMuPDF, pytz).
  • Remove notatki.txt (Polish course scratch notes).
  • English README with setup, system deps (foremost, poppler), usage and configuration.

⚠️ Not executed in this environment (needs pytsk3/pyewf, a disk image, and foremost/poppler). All five modules pass py_compile. Follow-ups: factor the duplicated EWFImgInfo / PDF-encrypt helpers into a shared module; broaden find_pdfs beyond directories literally named "pdf".

Crash / correctness:
- main.py: choose_disk_image() was called with change=False but takes no such
  argument (TypeError on every invalid-image path); call it with no args.
- evidence_metadata.py: header_table/hash_table were only set for EWF images, so
  raw images raised UnboundLocalError when building the report — they're now
  initialised with defaults. Also removed a redundant duplicate part_metadata()
  call and guarded table_1/table_2.
- watermark text used the invalid `fontsize=` kwarg on PIL ImageDraw.text
  (evidence_metadata.py, open_evidence.py) — now loads a font (DejaVuSans with a
  load_default fallback) and passes font=.
- pdf_analysis.py: registering DejaVuSans from a bare filename crashed when the
  .ttf wasn't in the cwd — now falls back to the built-in Helvetica.
- recovery_files.py: replaced the hardcoded `~/infa/Disk-Project/...` output path
  (which also created a literal `~` dir) with a RECOVERY_OUTPUT_DIR env var
  defaulting to RecoveredDiskImages/, and use os.path.basename instead of a
  fragile split("/")[1].

Cleanup:
- remove the `choosen` -> `chosen` typo throughout main.py (also de-duplicates a
  dead self.choosen_dir attribute) and a stray debug print.
- evidence_metadata.py: drop the Python-2 `from __future__ import print_function`
  shim and duplicate PyPDF2 imports.
- requirements.txt: re-encode UTF-16 -> UTF-8 and add the missing runtime deps
  (pdf2image, PyMuPDF, pytz).
- remove notatki.txt (Polish course scratch notes).
- rewrite README in English with setup, system deps, usage and configuration.

Note: not executed here (pytsk3/pyewf + a disk image + foremost/poppler needed);
all five modules pass py_compile. Follow-ups: factor the duplicated EWFImgInfo /
PDF-encrypt helpers into a shared module; broaden find_pdfs beyond dirs named "pdf".
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

Successfully merging this pull request may close these issues.

1 participant