/usr/lib64/python3.9/site-packages/setools/__pycache__
NameSizeModeActions
boolquery.cpython-39.opt-1.pyc21010644editdlrm
boolquery.cpython-39.pyc21010644editdlrm
boundsquery.cpython-39.opt-1.pyc18830644editdlrm
boundsquery.cpython-39.pyc18830644editdlrm
categoryquery.cpython-39.opt-1.pyc16820644editdlrm
categoryquery.cpython-39.pyc16820644editdlrm
commonquery.cpython-39.opt-1.pyc19120644editdlrm
commonquery.cpython-39.pyc19120644editdlrm
constraintquery.cpython-39.opt-1.pyc47580644editdlrm
constraintquery.cpython-39.pyc47580644editdlrm
defaultquery.cpython-39.opt-1.pyc23630644editdlrm
defaultquery.cpython-39.pyc23630644editdlrm
descriptors.cpython-39.opt-1.pyc101200644editdlrm
descriptors.cpython-39.pyc103130644editdlrm
devicetreeconquery.cpython-39.opt-1.pyc25900644editdlrm
devicetreeconquery.cpython-39.pyc25900644editdlrm
dta.cpython-39.opt-1.pyc156130644editdlrm
dta.cpython-39.pyc156130644editdlrm
exception.cpython-39.opt-1.pyc93230644editdlrm
exception.cpython-39.pyc93230644editdlrm
fsusequery.cpython-39.opt-1.pyc30420644editdlrm
fsusequery.cpython-39.pyc30420644editdlrm
genfsconquery.cpython-39.opt-1.pyc32760644editdlrm
genfsconquery.cpython-39.pyc32760644editdlrm
ibendportconquery.cpython-39.opt-1.pyc33510644editdlrm
ibendportconquery.cpython-39.pyc33510644editdlrm
ibpkeyconquery.cpython-39.opt-1.pyc47630644editdlrm
ibpkeyconquery.cpython-39.pyc47630644editdlrm
infoflow.cpython-39.opt-1.pyc130470644editdlrm
infoflow.cpython-39.pyc130470644editdlrm
initsidquery.cpython-39.opt-1.pyc26180644editdlrm
initsidquery.cpython-39.pyc26180644editdlrm
iomemconquery.cpython-39.opt-1.pyc40960644editdlrm
iomemconquery.cpython-39.pyc40960644editdlrm
ioportconquery.cpython-39.opt-1.pyc41000644editdlrm
ioportconquery.cpython-39.pyc41000644editdlrm
mixins.cpython-39.opt-1.pyc69470644editdlrm
mixins.cpython-39.pyc69470644editdlrm
mlsrulequery.cpython-39.opt-1.pyc32900644editdlrm
mlsrulequery.cpython-39.pyc32900644editdlrm
netifconquery.cpython-39.opt-1.pyc26960644editdlrm
netifconquery.cpython-39.pyc26960644editdlrm
nodeconquery.cpython-39.opt-1.pyc40320644editdlrm
nodeconquery.cpython-39.pyc40320644editdlrm
objclassquery.cpython-39.opt-1.pyc31880644editdlrm
objclassquery.cpython-39.pyc31880644editdlrm
pcideviceconquery.cpython-39.opt-1.pyc29900644editdlrm
pcideviceconquery.cpython-39.pyc29900644editdlrm
permmap.cpython-39.opt-1.pyc128200644editdlrm
permmap.cpython-39.pyc130540644editdlrm
pirqconquery.cpython-39.opt-1.pyc29120644editdlrm
pirqconquery.cpython-39.pyc29120644editdlrm
polcapquery.cpython-39.opt-1.pyc14820644editdlrm
polcapquery.cpython-39.pyc14820644editdlrm
portconquery.cpython-39.opt-1.pyc47530644editdlrm
portconquery.cpython-39.pyc47530644editdlrm
query.cpython-39.opt-1.pyc12720644editdlrm
query.cpython-39.pyc12720644editdlrm
rbacrulequery.cpython-39.opt-1.pyc43520644editdlrm
rbacrulequery.cpython-39.pyc43520644editdlrm
rolequery.cpython-39.opt-1.pyc21900644editdlrm
rolequery.cpython-39.pyc21900644editdlrm
sensitivityquery.cpython-39.opt-1.pyc24020644editdlrm
sensitivityquery.cpython-39.pyc24020644editdlrm
terulequery.cpython-39.opt-1.pyc67030644editdlrm
terulequery.cpython-39.pyc67030644editdlrm
typeattrquery.cpython-39.opt-1.pyc23520644editdlrm
typeattrquery.cpython-39.pyc23520644editdlrm
typequery.cpython-39.opt-1.pyc31460644editdlrm
typequery.cpython-39.pyc31460644editdlrm
userquery.cpython-39.opt-1.pyc40200644editdlrm
userquery.cpython-39.pyc40200644editdlrm
util.cpython-39.opt-1.pyc77230644editdlrm
util.cpython-39.pyc77230644editdlrm
__init__.cpython-39.opt-1.pyc37560644editdlrm
__init__.cpython-39.pyc37560644editdlrm
Edit: /usr/lib64/python3.9/site-packages/setools/__pycache__/dta.cpython-39.pyc (15613B)
a qéqe«Zã@sddlZddlZddlmZddlmZddlmZmZm Z m Z m Z m Z z ddl ZddlmZmZmZWn"eyŠe e¡ d¡Yn0ddlmZmZdd lmZmZmZmZgd ¢ZGd d „d e ƒZ Gd d„de ƒZ!ee!Z"eee efZ#Gdd„dƒZ$Gdd„dƒZ%dS)éN©Ú defaultdict)Úsuppress)Ú DefaultDictÚIterableÚListÚ NamedTupleÚOptionalÚUnion)Ú NetworkXErrorÚNetworkXNoPathÚ NodeNotFoundzNetworkX failed to import.é)Ú EdgeAttrDictÚ EdgeAttrList)Ú AnyTERuleÚ SELinuxPolicyÚ TERuletypeÚType)ÚDomainTransitionAnalysisÚDomainTransitionÚDomainEntrypointÚDTAPathc@s>eZdZUdZeed<eeed<eeed<eeed<dS)rz0Entrypoint list entry named tuple output format.ÚnameÚ entrypointÚexecuteÚtype_transitionN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚ__annotations__rr©r"r"ú1/usr/lib64/python3.9/site-packages/setools/dta.pyrs   rc@s^eZdZUdZeed<eed<eeed<eeed<eeed<eeed<eeed<d S) rz*Transition step output named tuple format.ÚsourceÚtargetÚ transitionÚ entrypointsÚsetexecÚ dyntransitionÚ setcurrentN) rrrr rr!rrrr"r"r"r#r#s     rc@s eZdZUdZeeed<eed<d,eee e e ee fddœdd„Z eed œd d „ƒZejdd œd d „ƒZeeed œd d„ƒZeje e e ee fddœdd„ƒZe ee fe ee fe edœdd„Zd-e ee fe ee fee edœdd„Ze ee fe ee fe edœdd„Ze ee fedœdd„Ze d œdd„Zedeed œd!d"„ƒZeeed#œd$d%„Zdd œd&d'„Zdd œd(d)„Zdd œd*d+„ZdS).rzDomain transition analysis.Ú_excludeÚ_reverseFN)ÚpolicyÚreverseÚexcludeÚreturncCsvt t¡|_||_||_||_d|_d|_zt   ¡|_ |j   ¡|_ Wn,typ|j d¡|j d¡‚Yn0dS)zþ Parameter: policy The policy to analyze. Keyword Parameters: reverse True means reverse the direction of the analysis (find parent domains). exclude An iterable of types to exclude from the analysis. TzLNetworkX is not available. This is requried for Domain Transition Analysis.z2This is typically in the python3-networkx package.N)ÚloggingÚ getLoggerrÚlogr-r/r.Ú rebuildgraphÚrebuildsubgraphÚnxZDiGraphÚGÚcopyÚsubGÚ NameErrorZcritical)Úselfr-r.r/r"r"r#Ú__init__>s     z!DomainTransitionAnalysis.__init__)r0cCs|jS©N)r,©r;r"r"r#r.Ysz DomainTransitionAnalysis.reversecCst|ƒ|_d|_dS)NT)Úboolr,r5)r;Ú directionr"r"r#r.]s cCs|jSr=)r+r>r"r"r#r/bsz DomainTransitionAnalysis.exclude)Útypesr0cs*|r‡fdd„|Dƒˆ_ngˆ_dˆ_dS)Ncsg|]}ˆj |¡‘qSr")r-Ú lookup_type)Ú.0Útr>r"r#Ú ióz4DomainTransitionAnalysis.exclude..T)r+r5)r;rAr"r>r#r/fs)r$r%r0ccs‚|j |¡}|j |¡}|jr&| ¡|j d ||¡¡ttt ƒ�*|  t j |j ||d�¡VWdƒn1st0YdS)a’ Generator which yields one shortest domain transition path between the source and target types (there may be more). Parameters: source The source type. target The target type. Yield: generator(steps) steps A generator that returns the tuple of source, target, and rules for each domain transition. z8Generating one domain transition path from {0} to {1}...)r$r%N)r-rBr5Ú_build_subgraphr3ÚinfoÚformatrr r Ú)_DomainTransitionAnalysis__generate_stepsr6Ú shortest_pathr9)r;r$r%ÚsrDr"r"r#rKos   z&DomainTransitionAnalysis.shortest_pathé)r$r%Úmaxlenr0ccsž|dkrtdƒ‚|j |¡}|j |¡}|jr6| ¡|j d |||¡¡tt t ƒ�4t   |j |||¡D]}| |¡VqjWdƒn1s�0YdS)aÏ Generator which yields all domain transition paths between the source and target up to the specified maximum path length. Parameters: source The source type. target The target type. maxlen Maximum length of paths. Yield: generator(steps) steps A generator that returns the tuple of source, target, and rules for each domain transition. rz%Maximum path length must be positive.zIGenerating all domain transition paths from {0} to {1}, max length {2}...N)Ú ValueErrorr-rBr5rGr3rHrIrr r r6Zall_simple_pathsr9rJ)r;r$r%rNrLrDÚpathr"r"r#Ú all_pathsŽs   ÿ z"DomainTransitionAnalysis.all_pathsccsŠ|j |¡}|j |¡}|jr&| ¡|j d ||¡¡ttt ƒ�2t   |j ||¡D]}|  |¡VqVWdƒn1s|0YdS)a„ Generator which yields all shortest domain transition paths between the source and target types. Parameters: source The source type. target The target type. Yield: generator(steps) steps A generator that returns the tuple of source, target, and rules for each domain transition. zBGenerating all shortest domain transition paths from {0} to {1}...N)r-rBr5rGr3rHrIrr r r6Úall_shortest_pathsr9rJ)r;r$r%rLrDrPr"r"r#rR³s   ÿ z+DomainTransitionAnalysis.all_shortest_paths)Útype_r0c csÈ|j |¡}|jr| ¡|j d ||jr0dnd¡¡tt ƒ�t|j   |¡D]V\}}t |j ||ƒ}|jrv||}}n ||}}t |||j| |¡|j|j|jƒVqNWdƒn1sº0YdS)aM Generator which yields all domain transitions out of a specified source type. Parameters: type_ The starting type. Yield: generator(steps) steps A generator that returns the tuple of source, target, and rules for each domain transition. z)Generating all domain transitions {1} {0}zin tozout fromN)r-rBr5rGr3rHrIr.rr r9Z out_edgesÚEdgerr&Ú/_DomainTransitionAnalysis__generate_entrypointsr(r)r*)r;rSrLr$r%ÚedgeÚ real_sourceÚ real_targetr"r"r#Ú transitionsÓs(  ÿ   úz$DomainTransitionAnalysis.transitionscCs.|jr| ¡dt |j¡›dt |j¡›�S)zR Get the domain transition graph statistics. Return: str z Graph nodes: z Graph edges: )r4Ú _build_graphr6Únumber_of_nodesr7Únumber_of_edgesr>r"r"r#Ú get_statsûs  ÿz"DomainTransitionAnalysis.get_statsrT)rVr0cs‡fdd„ˆjDƒS)a¢ Creates a list of entrypoint, execute, and type_transition rules for each entrypoint. Parameter: data The dictionary of entrypoints. Return: list of tuple(type, entry, exec, trans) type The entrypoint type. entry The list of entrypoint rules. exec The list of execute rules. trans The list of type_transition rules. cs,g|]$}t|ˆj|ˆj|ˆj|ƒ‘qSr")rrrr)rCÚe©rVr"r#rEsÿzCDomainTransitionAnalysis.__generate_entrypoints..)rr_r"r_r#Z__generate_entrypoints s ÿz/DomainTransitionAnalysis.__generate_entrypoints)rPr0c csztdt|ƒƒD]f}||d}||}t|j||ƒ}|jrF||}}n ||}}t|||j| |¡|j|j |j ƒVqdS)a Generator which yields the source, target, and associated rules for each domain transition. Parameter: path A list of graph node names representing an information flow path. Yield: tuple(source, target, transition, entrypoints, setexec, dyntransition, setcurrent) source The source type for this step of the domain transition. target The target type for this step of the domain transition. transition The list of transition rules. entrypoints Generator which yields entrypoint-related rules. setexec The list of setexec rules. dyntranstion The list of dynamic transition rules. setcurrent The list of setcurrent rules. rN) ÚrangeÚlenrTr9r.rr&rUr(r)r*)r;rPrLr$r%rVrWrXr"r"r#Z__generate_stepss   ûz)DomainTransitionAnalysis.__generate_stepscCsš|j ¡d |j¡|j_|j d |j¡¡ttƒ}ttƒ}tdd„ƒ}tdd„ƒ}tdd„ƒ}|j  ¡D�]}|j t j k�r"|j dvrŒql|j dk�rœd |jvrêt |j ¡|j ¡¡D].\}}||krºt|j||d d �} | j |¡qºd |jv�rBt |j ¡|j ¡¡D]2\}}||k�rt|j||d d �} | j |¡�qd |jv�rn|j ¡D]}|| |¡�qXd|jv�r |j ¡D]}|| |¡�q„n„d|jv�rÞt |j ¡|j ¡¡D]\}}||| |¡�qÀd|jv�r|t |j ¡|j ¡¡D]\}}||| |¡�qql|j t jkrl|j dk�rˆrFz7DomainTransitionAnalysis._build_graph..cSsttƒSr=rbr"r"r"r#rd‰rFcSs tdd„ƒS)NcSsttƒSr=rbr"r"r"r#rd�rFzIDomainTransitionAnalysis._build_graph....rr"r"r"r#rd�rF)ÚprocessÚfilerer&T)Úcreater)r(r*rrFz+Completed building domain transition graph.z$Graph stats: nodes: {0}, edges: {1}.)*r7ÚclearrIr-rr3rHrrcZterulesZruletyperZallowZtclassZpermsÚ itertoolsÚproductr$Úexpandr%rTr&Úappendr)rÚdefaultÚedgesÚsetÚkeysÚ intersectionrrr(Úextendr*Úremove_edges_fromr4r5Údebugr6r[r\)r;r(r*rrZ type_transZrulerLrDrVr^ÚdZ invalid_edgeZclear_transitionZclear_dyntransitionZ invalid_transZinvalid_dyntransÚentryZexeÚmatchÚmr"r"r#rZ{s    ÿ          þ       "          þz%DomainTransitionAnalysis._build_graphc Cs²g}|j ¡D]’\}}t|j||ƒ}t|jƒ}| |j¡|s@q|D]D}|j|=|j|=tt ƒ�|j |=WdƒqD1s~0YqD|js|j s|  |¡q|j  |¡dSr=)r9rnrTrorÚintersection_updater/rrÚKeyErrorrr)rlrs)r;Z invalid_edgesr$r%rVr'r^r"r"r#Z__remove_excluded_entrypointss   (  z6DomainTransitionAnalysis.__remove_excluded_entrypointscCs¼|jr| ¡|j d¡|j d |j¡¡|j d |j¡¡|jrZ|jjdd�|_ n |j  ¡|_ |jr‚|j   |j¡|  ¡d|_ |j d¡|j d t |j ¡t |j ¡¡¡dS) Nz$Building domain transition subgraph.z Excluding {0}z Reverse {0}T)r8Fz.Completed building domain transition subgraph.z'Subgraph stats: nodes: {0}, edges: {1}.)r4rZr3rHrtrIr/r.r7r9r8Zremove_nodes_fromÚ6_DomainTransitionAnalysis__remove_excluded_entrypointsr5r6r[r\r>r"r"r#rG+s"      þz(DomainTransitionAnalysis._build_subgraph)FN)rM) rrrr rrr!r?rr rr Ústrr<Úpropertyr.Úsetterr/rrKÚintrQrRrYr]Ú staticmethodrrUrJrZr{rGr"r"r"r#r7sD  ÿÿ "ÿ ÿ %ÿ (^rc@sveZdZdZedƒZedƒZedƒZedƒZe dƒZ e dƒZ e dƒZ de e ed d œd d „Zdd„Zee dœdd„Zd S)rTaS A graph edge. Also used for returning domain transition steps. Parameters: graph The NetworkX graph. source The source type of the edge. target The target tyep of the edge. Keyword Parameters: create (T/F) create the edge if it does not exist. The default is False. r&r(r)r*rrrFN)r$r%rgr0cCsj||_||_||_|j ||¡sf|s.tdƒ‚n8|j ||¡d|_d|_d|_d|_ d|_ d|_ d|_ dS)NzEdge does not exist in graph) r7r$r%Zhas_edgerOZadd_edger&rrrr(r)r*)r;Zgraphr$r%rgr"r"r#r<^s z Edge.__init__cs4t|tƒr&‡fdd„t| d¡ŽDƒSˆ |¡SdS)Ncsg|]}ˆ |¡‘qSr")Ú_index_to_item)rCÚir>r"r#rEtrFz$Edge.__getitem__..rM)Ú isinstanceÚslicer`Úindicesr�)r;Úkeyr"r>r#Ú __getitem__ps zEdge.__getitem__)Úindexr0cCs.|dkr|jS|dkr|jStd |¡ƒ‚dS)z'Return source or target based on index.rrz,Invalid index (edges only have 2 items): {0}N)r$r%Ú IndexErrorrI)r;rˆr"r"r#r�xs zEdge._index_to_item)F)rrrr rr&r(r)r*rrrrrr?r<r‡rr�r"r"r"r#rTGs rT)&rir1Ú collectionsrÚ contextlibrÚtypingrrrrr r Znetworkxr6Znetworkx.exceptionr r r Ú ImportErrorr2rrtZ descriptorsrrZ policyreprrrrÚ__all__rrrZRuleHashrrTr"r"r"r#Ús,