Skip to main content

πŸ”’ Obfuscate Your Code

Obfuscation makes your shell scripts harder to read, deterring casual users from modifying them. While it’s not a full security solution against advanced users, it’s a solid first step.


Obfuscation Steps​

  1. Set Up Test Mode
    See Test Mode for full instructions.

  2. Understand the obfuscate Tool
    The obfuscate command encodes your script into a less readable form. It supports:

    FlagDescription
    -base64 (-b64)Encodes in base64 first, preserving all code.
    TEXTThe script text to obfuscate (or piped input).
  3. Obfuscate Your Script
    Choose a method:

    • Direct: Inline obfuscation.
      obfuscate '
      ui_print "Hello World"
      ' > /sdcard/obfuscated.sh
    • With Base64: Better for complex scripts.
      obfuscate -b64 '
      ui_print "Hello World"
      ' > /sdcard/obfuscated.sh
    • From File: Obfuscate an existing script.
      cat /sdcard/updater-script | obfuscate -b64 > /sdcard/obfuscated.sh
  4. Test Your Obfuscated Script
    Replace your updater-script content with the obfuscated code and flash the ZIP.

warning

Do not obfuscate setdefault lines in updater-script (e.g., setdefault magisk_support on). They must remain readable for DI to work.

note

The obfuscated code can be mixed with readable code. For example, the obfuscated code of this case defines the ole variable, and although it is unknown what value it has, it can continue to be used.

cjifh="=";gegb=" ";bjbij=",";iagg=\";bhbcb="a";ichh="b";dafa="c";chaa="d";hb="e";cjdeb="f";gfah="H";bjac="i";caddf="l";bgfgf="n";bhcj="o";daafj="s";cdefi="t";cdaib="u";caedc="w";bgacd="v";${hb}${bgacd}${bhbcb}${caddf}${gegb}"${gegb}${gegb}${gegb}${bhcj}${caddf}${hb}${cjifh}${iagg}${gfah}${bjac}${bjbij}${gegb}${cdefi}h${bjac}${daafj}${gegb}${bhbcb}${dafa}${cdefi}${bjac}${bhcj}${bgfgf}${gegb}${caedc}${bjac}${caddf}${caddf}${gegb}${ichh}${hb}${gegb}${bhcj}${ichh}${cjdeb}${cdaib}${daafj}${dafa}${bhbcb}${cdefi}${hb}${chaa}${iagg}${gegb}${gegb}"

ui_print "$ole"