hashview / hashview/hashview

Select multiple hashfiles during job creation, combined into a new hashfile

Open
#359 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
399
Forks
52
Avg merge
21h 39m
Merged PRs (30d)
79

Description

Summary

During job creation, the "Use existing" hashfile picker only allows selecting a
single hashfile at a time. Allow selecting multiple existing hashfiles and
combine their hashes into one new auto-named hashfile for the job.

Motivation

Operators frequently accumulate hashes across several uploads (e.g. per-host
pwdumps, staged captures) and want to crack them together in one job. Today the
only workaround is manually merging files outside Hashview and re-uploading,
which loses the per-source hashfiles and duplicates data.

Current behavior

  • UI: single-select radio per row
    hashview/templates/jobs_assigned_hashfiles.html.j2:238
    <input type="radio" name="hashfile_id" value="{{ hashfile.id }}" ...>
    
  • Route: reads one hashfile_id and assigns it directly to the job
    hashview/jobs/routes.py:434-438
    elif request.method == 'POST' and request.form.get('hashfile_id'):
        job.hashfile_id = request.form['hashfile_id']
    
  • A job references exactly one Hashfiles.id; there is no notion of combining files.

Proposed behavior

  1. Change the "Use existing" picker from radio to checkboxes so multiple
    hashfiles can be selected.
  2. On submit with 2+ selections, create a new Hashfiles record and populate it
    by unioning the HashfileHashes rows of the selected files, then assign it as
    the job's hashfile_id.
  3. Name is auto-generated (e.g. combined-<timestamp> or derived from the
    source names) to avoid collisions — the user does not name it.
  4. Single selection keeps today's behavior (assign existing hashfile_id
    directly, no new record).

Constraints

  • Mixed-customer combining is blocked. The job-creation flow is already
    scoped to a single customer, so the "Use existing" list only shows that
    customer's hashfiles — combining across customers is not reachable in the
    current UI and must remain so. The combined Hashfiles record inherits that
    single customer_id.

Deduplication

Hash dedup infrastructure already exists and should be reused:

  • import_hash_only() dedupes by (hash_type, MD5(ciphertext))
    (hashview/utils/utils.py:544-555).
  • HashfileHashes is already many-to-many, so one hash can belong to the
    combined file and its sources.
    Combining should produce a distinct set of hash_ids (respecting username
    where present) — no duplicate HashfileHashes rows in the combined file.

No schema changes

The combined hashfile is a normal saved Hashfiles record — no new columns and
no Alembic migration needed. Jobs still references a single hashfile_id.

Affected files

  • hashview/templates/jobs_assigned_hashfiles.html.j2
  • hashview/jobs/routes.py (jobs_assigned_hashfile)
  • hashview/utils/utils.py (new combine_hashfiles() helper)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in hashview/templates/jobs_assigned_hashfiles.html.j2 and hashview/jobs/routes.py at the picker and POST handling, then read import_hash_only() in hashview/utils/utils.py and the HashfileHashes relationships. Confirm how selected hash IDs, usernames, customer IDs, and auto-generated names should be represented; done means single selections still assign directly and multiple selections create one deduplicated combined Hashfiles record assigned to the job.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
backend, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.