seinfoflow: Add -r option to get flows into the source type.

Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
This commit is contained in:
Chris PeBenito 2023-06-21 08:56:08 -04:00
parent 0c1e581141
commit b18d2d1727
2 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,8 @@ Specify the maximum number of information flows to output. The default is unlimi
A space-separated list of types to exclude from the analysis.
.SS General Options
.IP "-r, --reverse"
Display information flows into the source type. No effect if a target type is specified.
.IP "--stats"
Print information flow graph statistics at the end of the analysis.
.IP "-h, --help"

View File

@ -43,6 +43,9 @@ alg.add_argument("-A", "--all_paths", type=int, metavar="MAX_STEPS",
help="Calculate all paths, with the specified maximum path length. (Expensive)")
opts = parser.add_argument_group("Analysis options")
opts.add_argument("-r", "--reverse", action="store_false",
help="Display information flows into the source type. "
"No effect if a target type is specified.")
opts.add_argument("-w", "--min_weight", default=3, type=int,
help="Minimum permission weight. Default is 3.")
opts.add_argument("-l", "--limit_flows", default=0, type=int,
@ -126,7 +129,7 @@ try:
else: # single direct info flow
flownum = 0
for flownum, flow in enumerate(g.infoflows(args.source), start=1):
for flownum, flow in enumerate(g.infoflows(args.source, out=args.reverse), start=1):
print("Flow {0}: {1} -> {2}".format(flownum, flow.source, flow.target))
if args.full: