From 7cbe99cc2eb50babe7a004b719dbe20fe6159638 Mon Sep 17 00:00:00 2001 From: MTlls <matheustellestab8@gmail.com> Date: Mon, 24 Mar 2025 01:50:55 -0300 Subject: [PATCH] fix: staticfg/build_cfg.py recriado --- src/staticfg/examples/build_cfg.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/staticfg/examples/build_cfg.py diff --git a/src/staticfg/examples/build_cfg.py b/src/staticfg/examples/build_cfg.py new file mode 100644 index 0000000..6f2fc39 --- /dev/null +++ b/src/staticfg/examples/build_cfg.py @@ -0,0 +1,16 @@ +#!usr/bin/python3 + +import argparse +from staticfg import CFGBuilder + +parser = argparse.ArgumentParser(description='Generate the control flow graph\ + of a Python program') +parser.add_argument('input_file', help='Path to a file containing a Python\ + program for which the CFG must be generated') +parser.add_argument('output_file', help='Path to a file where the produced\ + visualisation of the CFG must be saved') + +args = parser.parse_args() +cfg_name = args.input_file.split('/')[-1] +cfg = CFGBuilder().build_from_file(cfg_name, args.input_file) +cfg.build_visual(args.output_file, format='png', calls=True) -- GitLab