humanify icon indicating copy to clipboard operation
humanify copied to clipboard

Feature Request: Add option to specify custom output filename (not just directory)

Open NoahTheGinger opened this issue 6 months ago • 2 comments

Current Behavior

Currently, humanify only allows specifying an output directory with -o, and the output file is always named deobfuscated.js:

humanify openai -o ./output input.js
# Creates: ./output/deobfuscated.js

Problem

This makes it difficult to:

  1. Compare deobfuscation results from different models on the same file
  2. Process multiple files without overwriting previous results
  3. Keep track of which output corresponds to which input/model combination

Proposed Solution

Add a new option (e.g., --output-file or enhance -o) to specify the complete output path including filename:

# New option
humanify openai --output-file ./results/myfile-gpt4.js input.js

# Or enhance existing -o to detect file vs directory
humanify openai -o ./results/myfile-gpt4.js input.js

Use Case Examples

# Compare different models
humanify openai --model gpt-4.1-nano --output-file compare-nano.js input.js
humanify gemini --model gemini-2.0-flash --output-file compare-gemini.js input.js

# Process multiple files
humanify openai --output-file processed/file1-clean.js file1.min.js
humanify openai --output-file processed/file2-clean.js file2.min.js

Alternative

If changing the CLI is not preferred, even just preserving the input filename would help:

humanify openai -o ./output input.js
# Could create: ./output/input-deobfuscated.js (instead of deobfuscated.js)

Would love to hear your thoughts on this! Happy to help implement if you think it's a good addition.

NoahTheGinger avatar Jun 30 '25 10:06 NoahTheGinger

I haven't looked at this for a while, but off the top of my head I believe it's done this way because if you're unpacking a webpack chunk/similar it creates multiple files.

The main part that handles the unpacking/etc comes from webcrack; and I think it might be it that sets that filename even (though can't remember for sure off the top of my head)

0xdevalias avatar Jun 30 '25 14:06 0xdevalias

See also:

  • https://github.com/jehna/humanify/pull/510

Edit: I left a number of review comments on that PR, including:

  • https://github.com/jehna/humanify/pull/510#pullrequestreview-2973237888
  • https://github.com/jehna/humanify/pull/510#pullrequestreview-2973241785
  • https://github.com/jehna/humanify/pull/510#pullrequestreview-2973247554

In particular, that last review comment has a bit more of a deep dive and some of my thinking on how this could be implemented, and what might make sense to do with it.

0xdevalias avatar Jul 01 '25 01:07 0xdevalias