AperiSolve icon indicating copy to clipboard operation
AperiSolve copied to clipboard

Feature Request: Batch Processing API with Results Export

Open 0x-Professor opened this issue 1 year ago • 3 comments

Summary

Add a REST API endpoint that supports batch processing of multiple files for steganalysis, with structured results export (JSON/CSV/PDF) to enable automation, integration with external tools, and more efficient workflows for security researchers.

User Story

As a security researcher or CTF participant, I want to programmatically submit multiple files for analysis and receive structured results so that I can automate my steganalysis workflow and integrate findings into my existing toolchain.

Problem / Pain

Currently, AperiSolve primarily functions as a web interface requiring manual file uploads and analysis one file at a time. This creates friction for:

  1. Users analyzing multiple related files (e.g., during a CTF)
  2. Researchers who need to integrate findings with their existing tools
  3. Teams that want to automate their steganalysis workflows

Evidence:

  • The main upload functionality in app/routes.py only handles single file uploads
  • No existing API endpoints for programmatic access in app/api/ directory
  • Current results display is HTML-focused without structured data export options
  • Multiple user comments in issues requesting ways to analyze sets of related files

Proposed Solution

Implement a RESTful API with the following endpoints:

  1. POST /api/v1/batch-analyze - Accept multiple files (multipart/form-data)
  2. GET /api/v1/results/{batch_id} - Retrieve results for a batch job
  3. GET /api/v1/results/{batch_id}/export?format=[json|csv|pdf] - Export results

The API should:

  • Use authentication tokens for access control
  • Support asynchronous processing with job status updates
  • Return consistent error messages and status codes
  • Include rate limiting to prevent abuse
  • Provide clear documentation and example usage

Implementation would leverage existing analysis modules but add batch job management and result formatting systems.

Acceptance Criteria

  • [ ] API endpoint accepts multiple files (at least 10) in a single request
  • [ ] Processing happens asynchronously with status tracking
  • [ ] Results are available in machine-readable formats (JSON, CSV)
  • [ ] Human-readable report export option (PDF)
  • [ ] API documentation is available with example code
  • [ ] Rate limiting prevents abuse
  • [ ] Authentication system protects API access
  • [ ] Existing steganalysis tools run on all submitted files

Prioritization

  • RICE: Reach=4 (all users), Impact=3 (major workflow improvement), Confidence=80%, Effort=3 (person-weeks); Score=3.2
  • MoSCoW: Should-have — Significantly expands platform utility while maintaining core functionality and architecture

Feasibility & Integration Points

  • app/api/ directory can be extended with new endpoints using Flask Blueprint
  • Existing file processing logic in app/utils/analyze.py can be reused
  • Results storage in app/models/ can be extended to handle batch jobs
  • Authentication can leverage existing user system or implement token-based auth
  • Job queue can be implemented using Celery or RQ with Redis backend

Quality Considerations

Security: API endpoints require proper authentication and rate limiting to prevent abuse Performance: Batch jobs should be queued and processed asynchronously to avoid overwhelming server resources Reliability: Failed analyses should not affect other files in the batch Accessibility: Not directly applicable to API i18n: API responses should use standard error codes with English messages Observability: Logging for API requests and job status updates Maintainability: Modular design with clear separation between API handlers and processing logic

Validation Plan

  • Unit tests for API endpoints with mocked file processing
  • Integration tests with sample steganography files
  • Load testing to determine appropriate rate limits
  • Example client implementation in Python
  • Manual testing with curl commands:

0x-Professor avatar Aug 17 '25 07:08 0x-Professor

If you want, I can provide its PR

0x-Professor avatar Aug 17 '25 07:08 0x-Professor

Hi, thanks for your long issue. Sure, PR is well accepted.

However :

  • Current app already use REST endpoints, and uploading multiple files can be achieved with multiple requests.
  • There is no "priority" on the current queue, and I don't want the batch upload block the queue : this may increase DOS risk.
  • Rate limit on production server may be high to guarantee availability for other user (the server is kinda cheap and has low performances, I have no sponsors)

Zeecka avatar Aug 17 '25 19:08 Zeecka

You can logically group multiple uploads by supplying a batch_id with each POST /upload request.

curl -F "[email protected]" -F "batch_id=ctf_round3" http://localhost:5000/upload curl -F "[email protected]" -F "batch_id=ctf_round3" http://localhost:5000/upload

Get batch summary: curl http://localhost:5000/api/v1/batches/ctf_round3

Export CSV: curl -OJ "http://localhost:5000/api/v1/batches/ctf_round3/export?format=csv"

Limits:

  • Max 25 files (or any number that you prefer) per batch (default, configurable)
  • batch_id pattern: [A-Za-z0-9_-]{1,50}

Should i implement this

0x-Professor avatar Aug 18 '25 07:08 0x-Professor