Skip to content

rhn/edeco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fuc & xtensa deasm flow detector.
Second incarnation.

Requires Python 2.7+

For current usage, refer to edeco.py -h.

usage: edeco.py [-h] -m {fuc,xtensa} [--cmap CMAP] [-x] [-f FUNCTION]
                deasm deco

positional arguments:
  deasm                 input deasm file
  deco                  output decompiled file

required arguments:
  -m {fuc,xtensa}, --microcode {fuc,xtensa}
                        microcode name

optional arguments:
  -h, --help            show help message and exit
  --cmap CMAP           code space map file
  -x, --no-autodetect   Don't autodetect functions
  -f FUNCTION, --function FUNCTION
                        Function address: decimal (123) or hex (0x12ab)

What it does:
Takes a deasm file, analyzes gotos and outputs a nicely formatted flow structure (asm pieces inside C-like braces where appropriate). works with arbitrarily entangled control flow.

Gotchas:
This version of the program does not cope well with goto/break/return - these break hierarchical control flow and it's not really possible to determine whether they are exits in terms of original C-like source code. Therefore they will always be followed until a single exit is found, which might make output messy. The lightest example is switch (first single exit at the end of statement) interpreted as a chain of if{}else{if{}else{...}}, the heaviest is a return from within a loop (first single exit is the end of the function) - total mess.
Some of that might get improved in the future via smart guessing or hiding of control-only code.


What it will do again:
* recognize simple control flow structures
* find call addresses
* generate pseudocode for store instructions
* find and label memory structures

What new it could do:
* analyze data flow
* find branch conditions
* hide ASM blocks only used for control flow (and simplify flow graph further)
* find iowr/iost addresses
* find loop invariants
* become an emulator
* take into account custom memory labels and function names
* become interactive

About

A decompiler for envytools fuc disassembly

Resources

Stars

Watchers

Forks

Packages

No packages published