MEGMS logo - go to the home page
  1. Home

    1. MEGS_Log

    2. CoalLog tools

    3. Fortran Tools

      1. FF08Depends

      2. FF08Diff

      3. FF08FixedFormForEver

      4. FF08Obfuscate

      5. Internal test utilities

      6. aniso_varying_string

      7. Direct2D API bindings

      8. Fortran shared pointers

    4. Contact Us

  2. Site map

"Let's model me a mine"

M.E.G.M.S.


Mining & Exploration Geological Modelling Services

Previous topic Parent topic Home topic Next topic

FF08Obfuscate

FF08Obfuscate is a command line tool for generating a superficially obfuscated variant of the source of a Fortran 2008 program. It does this by modifying the identifiers in the program and rendering the code without any source comments. Bar a few exceptions (and bugs), the semantics of the resulting obfuscated source should be the same as the original program.

The tool does not change statement labels or literal constants in the source. Structurally the source code will be very similar. The degree of obfuscation is relative - perhaps the tool should be renamed FF08Irritate.

The tool itself is written in Fortran 2003. A zip archive of the latest source release (revision 3189 from 2024-08-12), available under an Apache 2.0 licence, can be found at www.megms.com.au/download/FF08Obfuscate.zip.

The obfuscation logic is limited to the information available from application of the syntax rules of the language. It does not consider the semantics of those syntax rules - the tool knows that a particular identifier is used in the program, but has no real idea what that identifier actually identifies. As a consequence, the following things are not handled correctly:

Example

The results of applying the tool to its own main program can be seen at www.megms.com.au/download/FF08Obfuscate-main-obfuscated.f90.htm.

How to use

The command line has the following syntax:

FF08Obfuscate [options] source-file-specs...

Command line options:

-? or --help
Display command line and program usage help, then exit.
--version
Display program version information, then exit.
--list[:] file
Specify a list file - each record from the given file will be added (in addition to any source file specifications provided on the command line) to the list of source file specifications for the prevailing set (as indicated by --left and --right) to be processed. May be specified multiple times.
@response-file
Nominates a response file with additional arguments and options. Each argument or option in a response file place should be in its own record. Options and arguments in response files are expanded as they are encountered into the total set of options and arguments for the program. Multiple response files may be specified, and response files may reference other response files, but a response file reference may not be recursive.

source-file-specs is a list of the names of the Fortran source files to read.

The obfuscated source is written to the console. Errors and warnings generated while parsing the supplied Fortran source are written to the error unit.

STOP codes (which may also be the program's exit code):

no code:
Program completed successfully. This will be reported by most processors back to the operating system as an exit code of zero. (I did what you asked.)
2
Obfuscation commenced, but with errors. This is likely due to errors in the supplied Fortran source. (I know what you want me to do, but I couldn't do it.)
3
There was a problem with the command line arguments. (I haven't got a clue what you want to do.)

Building from source

The source code should be compilable by a Fortran 2003 compiler.

Intel Visual Fortran 16.0 was the compiler used for development. With that compiler, the /standard-semantics switch (or its equivalent on non-Windows platforms) is required.

The file compile-order.txt in the source archive specifies the order in which the included source files may be compiled.

Note that gfortran current trunk (at the time of writing r238060) cannot be used due to PR 44265, PR 71796 and PR 71807.

Feedback

Questions, queries and quibbles can be sent to ff08@megms.com.au.