diff --git a/sedta b/sedta index c2b6f46..a559527 100755 --- a/sedta +++ b/sedta @@ -66,8 +66,9 @@ def print_transition(trans, entrypoints, setexec, dyntrans, setcur): print() -parser = argparse.ArgumentParser(description="SELinux policy domain transition analysis tool.", - epilog="If no analysis algorithm is selected, all transitions out of a domain will be calculated.") +parser = argparse.ArgumentParser( + description="SELinux policy domain transition analysis tool.", + epilog="If no analysis is selected, all forward transitions out of the source will be printed.") parser.add_argument("--version", action="version", version=setools.__version__) parser.add_argument( "-p", "--policy", help="Path to SELinux policy to analyze.", required=True) diff --git a/seinfoflow b/seinfoflow index b7ed6b1..676d23d 100755 --- a/seinfoflow +++ b/seinfoflow @@ -22,8 +22,9 @@ import setools import argparse import sys -parser = argparse.ArgumentParser(description="SELinux policy information flow analysis tool.", - epilog="If no analysis algorithm is selected, all information flow out of the source domain will be calculated.") +parser = argparse.ArgumentParser( + description="SELinux policy information flow analysis tool.", + epilog="If no analysis is selected, all information flow out of the source will be printed.") parser.add_argument("--version", action="version", version=setools.__version__) parser.add_argument("--stats", action="store_true", help="Display statistics at the end of the analysis.") diff --git a/setools/infoflow.py b/setools/infoflow.py index ecb3338..8125f9c 100644 --- a/setools/infoflow.py +++ b/setools/infoflow.py @@ -78,7 +78,7 @@ class InfoFlowAnalysis(object): """ if not isinstance(perm_map, (str, permmap.PermissionMap)): raise TypeError( - "Permission map must be a permission map object or a path to a permission map file.") + "Permission map must be an object or a path to a file.") if isinstance(perm_map, str): self.perm_map = permmap.PermissionMap(perm_map) diff --git a/setools/permmap.py b/setools/permmap.py index 5b04c38..4b23ccb 100644 --- a/setools/permmap.py +++ b/setools/permmap.py @@ -77,8 +77,9 @@ class PermissionMap(object): format(permmapfile, line_num, entry[0])) if num_classes < 1: - SyntaxError("{0}:{1}:Number of classes must be positive: {2}".format( - permmapfile, line_num, entry[2])) + SyntaxError( + "{0}:{1}:Number of classes must be 1-32: {2}". + format(permmapfile, line_num, entry[2])) state = 2 @@ -93,12 +94,14 @@ class PermissionMap(object): try: num_perms = int(entry[2]) except ValueError: - raise SyntaxError("{0}:{1}:Invalid number of permissions: {2}".format( - permmapfile, line_num, entry[2])) + raise SyntaxError( + "{0}:{1}:Invalid number of permissions: {2}". + format(permmapfile, line_num, entry[2])) if num_perms < 1: - SyntaxError("{0}:{1}:Number of permissions must be positive: {2}".format( - permmapfile, line_num, entry[2])) + SyntaxError( + "{0}:{1}:Number of permissions must be 1-32: {2}". + format(permmapfile, line_num, entry[2])) class_count += 1 perm_count = 0 @@ -116,12 +119,14 @@ class PermissionMap(object): try: weight = int(entry[2]) except ValueError: - SyntaxError("{0}:{1}:Invalid information flow weight: {2}".format( - permmapfile, line_num, entry[2])) + SyntaxError( + "{0}:{1}:Invalid permission weight: {2}". + format(permmapfile, line_num, entry[2])) if not self.min_weight <= weight <= self.max_weight: SyntaxError( - "{0}:{1}:Information flow weight must be 1-10: {2}".format(permmapfile, line_num, entry[2])) + "{0}:{1}:Permission weight must be 1-10: {2}". + format(permmapfile, line_num, entry[2])) self.permmap[class_name][perm_name] = ( flow_direction, weight) diff --git a/setools/policyrep/boolcond.py b/setools/policyrep/boolcond.py index 52b3c57..166a29d 100644 --- a/setools/policyrep/boolcond.py +++ b/setools/policyrep/boolcond.py @@ -84,7 +84,8 @@ class ConditionalExpr(symbol.PolicySymbol): for expr_node in self.qpol_symbol.expr_node_iter(self.policy): expr_node_type = expr_node.expr_type(self.policy) - if expr_node_type == qpol.QPOL_COND_EXPR_BOOL and other == boolean_factory(self.policy, expr_node.get_boolean(self.policy)): + if expr_node_type == qpol.QPOL_COND_EXPR_BOOL and other == \ + boolean_factory(self.policy, expr_node.get_boolean(self.policy)): return True return False diff --git a/setools/policyrep/constraint.py b/setools/policyrep/constraint.py index 7562f55..d9f6b77 100644 --- a/setools/policyrep/constraint.py +++ b/setools/policyrep/constraint.py @@ -28,7 +28,8 @@ def _is_mls(policy, symbol): sym_type = expr_node.sym_type(policy) expr_type = expr_node.expr_type(policy) - if expr_type == qpol.QPOL_CEXPR_TYPE_ATTR and sym_type >= qpol.QPOL_CEXPR_SYM_L1L2: + if expr_type == qpol.QPOL_CEXPR_TYPE_ATTR and \ + sym_type >= qpol.QPOL_CEXPR_SYM_L1L2: return True return False diff --git a/setools/portconquery.py b/setools/portconquery.py index 287add5..42d0941 100644 --- a/setools/portconquery.py +++ b/setools/portconquery.py @@ -162,7 +162,7 @@ class PortconQuery(compquery.ComponentQuery, contextquery.ContextQuery): if (pending_ports[0] > pending_ports[1]): raise ValueError( - "The low port of the range must be smaller than the high port: {0[0]}-{0[1]}".format(ports)) + "The low port must be smaller than the high port: {0[0]}-{0[1]}".format(ports)) self.ports = pending_ports