
Obfuscate integer and/or string literals (such as 42 or "42").
Literal integers can be replaced with opaque expressions, which
requires that the InitOpaque transformation has been previously issued. Literal strings can be
replaced with code that rebuilds them at runtime, so the readable text no longer appears in the
generated source or the compiled binary. Use --EncodeLiteralsStringKinds to choose how;
see Encoding strings below.
| Option | Arguments | Description |
|---|---|---|
| --Transform | EncodeLiterals | Replace literal integers and strings with less obvious expressions. |
| --EncodeLiteralsKinds | integer, string, * | Specify the types of literals to encode Default=integer,string.
|
| --EncodeLiteralsEncoderName | string | The name of the generated encoder function (only for encoded strings). Default=None. |
| --EncodeLiteralsMaxLevel | INTSPEC | How deep to recurse into split integer expressions. Default=100. |
| --EncodeLiteralsMaxTransforms | INTSPEC | How many transformations to perform on each split integer expression. Default=100. |
| --EncodeLiteralsIntegerKinds | opaque, split | Specify how to encode integer literals. Default=opaque.
|
You can apply this transformation to a part of a function. First, include tigress.h as usual, then enclose the regions you
want to transform using the ENCODE_INTEGER_BEGIN and ENCODE_INTEGER_END macros:
void foo () {
...
ENCODE_INTEGER_BEGIN(obfuscateThis);
int x = 1234567;
ENCODE_INTEGER_END(obfuscateThis);
...
ENCODE_INTEGER_BEGIN(obfuscateThat);
int y = 7654321;
ENCODE_INTEGER_END(obfuscateThat);
...
}
The arguments to the macros (obfuscateThis and obfuscateThat) are tags that you specify in the -Regions=... option
in your tigress command:
tigress ... \
--Transform=EncodeLiterals \
--Functions=foo \
--Regions=obfuscateThis,obfuscateThat \
--EncodeLiteralsIntegerKinds=split \
...
| Option | Arguments | Description |
|---|---|---|
| --EncodeLiteralsStringKinds | fsm, chunk, * | How to encode string literals. When you list several, one is chosen at random each run. Default=fsm.
|
For example, to encode strings so no readable text remains in the output:
tigress ... \
--Transform=EncodeLiterals \
--Functions=main \
--EncodeLiteralsKinds=string \
--EncodeLiteralsStringKinds=chunk \
...
The generated string decoder is deliberately simple. To make it less conspicuous, transform it
further — for example with
Virtualize (to hide the string contents) and
RndArgs (to hide the interface).
This matters especially with chunk: without a following transform, a compiler's optimizer
may fold the decoding back to the original string.