3
O+e[: @ s d dl Z d dlZd dlmZ d dlZd dlmZmZ ddl m
Z
mZ ddlm
Z
ddlmZ dgZG d d dZG d
d dZdS ) N)suppress)
NetworkXErrorNetworkXNoPath )EdgeAttrIntMaxEdgeAttrList)RuleNotConditional)
TERuletypeInfoFlowAnalysisc @ s e Zd ZdZd!ddZedd Zejdd Zed d
Zejdd
Zedd
Z e jdd
Z dd Z
d"ddZdd Zd#ddZ
dd Zdd Zdd Zdd ZdS )$r
zInformation flow analysis.r Nc C sJ t jt| _|| _|| _|| _|| _|| _d| _ d| _
tj | _
d| _dS )a
Parameters:
policy The policy to analyze.
perm_map The permission map or path to the permission map file.
minweight The minimum permission weight to include in the analysis.
(default is 1)
exclude The types excluded from the information flow analysis.
(default is none)
booleans If None, all rules will be added to the analysis (default).
otherwise it should be set to a dict with keys corresponding
to boolean names and values of True/False. Any unspecified
booleans will use the policy's default values.
TN)loggingZ getLogger__name__logpolicy
min_weightperm_mapexcludebooleansrebuildgraphrebuildsubgraphnxZDiGraphGsubG)selfr r r r r r /usr/lib64/python3.6/infoflow.py__init__% s
zInfoFlowAnalysis.__init__c C s | j S )N)_min_weight)r r r r r A s zInfoFlowAnalysis.min_weightc C s0 d| kodkn s t d|| _d| _d S )Nr
z4Min information flow weight must be an integer 1-10.T)
ValueErrorr r )r weightr r r r E s
c C s | j S )N) _perm_map)r r r r r N s zInfoFlowAnalysis.perm_mapc C s || _ d| _d| _d S )NT)r r r )r r r r r r R s c C s | j S )N)_exclude)r r r r r X s zInfoFlowAnalysis.excludec s* |r fdd|D _ ng _ d _d S )Nc s g | ]} j j|qS r )r lookup_type).0t)r r r