コマンドライン
Babel Obfuscator には、Windows、macOS、Linux で使用できるコマンドラインツールがあります。ここでは、Babel Obfuscator をコマンドラインから使用する方法を説明します。
Babel Obfuscator はコマンドラインツールとして提供されているため、ビルドパイプラインに簡単に組み込んで、難読化の処理を自動化できます。「babel」という名前のこのコマンドラインツールでは、入力アセンブリ、出力ファイル、さまざまな難読化オプションを簡単に指定できます。コマンドラインから「babel」を起動するには、Windows では PowerShell、macOS ではターミナルを開いて、次のように入力します。
> babel「babel」コマンドは、実行可能なコマンドラインツール「babel」を起動します。このコマンドは次の構文を受け付けます。
babel <primary assembly source> [<other assemblies>...] [options]最初のパラメーター「<primary assembly source>」は、難読化するターゲットアセンブリ(プライマリアセンブリ)で、必須のパラメーターです。
[<other assemblies>…] は、プライマリアセンブリにマージするアセンブリのリストで、省略できます。
[options] は、Babel Obfuscator を設定するコマンドラインスイッチのリストです。各コマンドラインスイッチの先頭には、ハイフンを 2 つ付けます。たとえば、次のように指定します。
--embed
コマンドラインオプションのバンドル
コマンドラインオプションは、短い構文を使ってまとめて指定できます。ハイフンを 1 つ付けると、複数のオプションを 1 つの式にまとめて入力できます。
babel myapp.exe --types --methods --properties --fields --events
これは次と同じです。
babel myapp.exe -tmpfe
使用できるコマンドラインオプションをすべて表示するには、次のコマンドラインを入力します。
babel --help各コマンドラインスイッチの詳しい説明を表示するには、次のように入力します。
babel --help [command name]たとえば、次のコマンドは
babel --help controlflow「controlflow」コマンドラインスイッチの詳しいヘルプを出力します。
> babel --help controlflow
controlflow (nocontrolflow, no-controlflow, control-flow, no-control-flow, i)
usage: --[no]controlflow
Enable ([no]disable) MSIL control flow obfuscation (default: disabled)
Use this option to alter the method control flow.
Key-value pairs can optionally be entered to configure code scrambling:
Produces verifiable MSIL code
goto=[on/off] Whether to insert irrelevant branches
switch=[on/off] Whether to enable switch scrambling
case=[on/off] Whether to hide case constants
if=[on/off] Whether to enable if scrambling
call=[on/off] Whether to enable random calls
value=[on/off] Whether to use value encryption
token=[on/off] Whether to enable emission of method tokens
Produces not verifiable MSIL code
underflow=[on/off] Whether to enable stack underflow ()
Examples:
--controlflow switch=on --controlflow case=on
This option can be entered multiple times. AI に適した機械可読な出力(11.7.0 以降)
Babel Obfuscator は、CI パイプラインや、AI やエージェントとの連携向けに、構造化ストリームを stdout に出力することもできます。--format=json または --format=ndjson を渡すと、babel.cli.v1 スキーマに切り替わります。必要に応じて、--quiet(ロゴなし、プロンプトでは失敗)と --strict-exit(意味を持つ終了コード 10/20/30/40/50)も指定できます。同じフラグで、--help と --version も機械可読になります。完全なリファレンスは、AI に適したモードを参照してください。