Package: cfg-explorer
cfg-explorerCFG explorer is a simple utility which can be used to explore control flow graphs of binary programs.It usesangrbinary analysis framework, for CFG recovery, and renders the CFG to SVGs, with the help ofbingraphvis.The generated SVGs can be navigated by clicking on thefunctionor thecallsitenodes.Besides, now it can also export multiple formats of static CFG files to your local machine, including:.canon.cmap.cmapx.cmapx_np.dot.fig.gd.gd2.gif.imap.imap_np.ismap.jpe.jpeg.jpg.mp.pdf.plain.plain-ext.png.ps.ps2.svg.svgz.vml.vmlz.vrml.wbmp.xdot.rawCFGs starting from multiple start addresses or for multiple functions can also be automatically exported to multiple files at once with different suffixes in their filenames.NoteThis project is in its very early stage!Install$ pip install cfg-explorerUsageCLIAfter installation,cfg_explorercan be easily called in command lines as:$ cfgexplorer --help

usage: cfgexplorer [-h] [-v] [-s [STARTS [STARTS ...]]] [-P PORT] [-p] [-l]
                   [-o OUTFILE]
                   binary

positional arguments:
  binary                the binary to explore

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         increase output verbosity
  -s [STARTS [STARTS ...]], --start [STARTS [STARTS ...]]
                        start addresses
  -P PORT, --port PORT  server port
  -p, --pie             is position independent
  -l, --launch          launch browser
  -o OUTFILE, --output OUTFILE
                        output file path, only support for ['canon', 'cmap',
                        'cmapx', 'cmapx_np', 'dot', 'fig', 'gd', 'gd2', 'gif',
                        'imap', 'imap_np', 'ismap', 'jpe', 'jpeg', 'jpg',
                        'mp', 'pdf', 'plain', 'plain-ext', 'png', 'ps', 'ps2',
                        'svg', 'svgz', 'vml', 'vmlz', 'vrml', 'wbmp', 'xdot',
                        'raw']For example:$ cfgexplorer /your/binary -lThe command above will build the CFG, spawn a web server, and open it in your browser.ModuleYou can also utilizecfg_explorefunction in it as other common modules in Python:fromcfgexplorerimportcfg_explorecfg_explore(binary=r'/your/binary',launch=True)The codes will do what thecfgexplorerdoes in the previous example. If you want to shut down the app, you need to interrupt your Python interpreter as well. So the function is more often used by specifyingoutputto generate output files in a Python program like:cfg_explore(binary=r'/your/binary',output='./cfg_output.svg')The code above exports CFG assvgformat to file path./cfg_output.svgThe function is defined as follow:cfg_explore(binary,starts=[],port=5000,pie=False,launch=False,output='')binary(str): the path of the binary file to analysisstarts(list): the start points (address) in CFGs, if none, the CFG will start with main func entry addressport(int): server port to host the web app. make sure the port is idle now.pie(bool): whether the analysis position-independentlaunch(bool): Whether launch a browser to view CFG immediatelyoutput(str): the output file path. only support certain formats. If you leave it an empty string, no output will be generated and the interactive web app will start. Otherwise, no app will be launched and the CFGs will be exported to specified files.Detailed usages of this function are available inexamples/demo.ipynb.Annotation StyleEdges:Edge classColorStyleConditional TrueGreenConditional FalseRedUnconditionalBlueNextBlueDashedCallBlackReturnGrayFake ReturnGrayDottedUnknownOrangeLimitationsworks on Linux onlyat the moment, the result is simply an SVG file, i plan to add a small frontend around itScreenshotsFunction graph mode (/function/0x123456)CFG mode (/cfg/0x123456)