Commit Graph

24 Commits

Author SHA1 Message Date
Chris PeBenito
8e082f70cf Replace license text in sources with SPDX license indentifiers.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2021-11-20 14:12:15 -05:00
Chris PeBenito
bd5393bac8 PolicyQuery: Add type annotations, including to sublcasses.
Revise code in a few places to resolve type checking issues.

Includes ignore in NodeconQuery for this error:
setools/nodeconquery.py:110: error: Argument 1 to "overlaps" of "_BaseNetwork" has incompatible type "Union[IPv4Network, IPv6Network]"; expected "IPv4Network"
setools/nodeconquery.py:110: error: Argument 1 to "overlaps" of "_BaseNetwork" has incompatible type "Union[IPv4Network, IPv6Network]"; expected "IPv6Network"

Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2020-10-14 10:16:54 -04:00
Chris PeBenito
57e51ec69b Implement an enumeration for portcon protocol. 2016-09-03 16:42:06 -04:00
Chris PeBenito
c526264f52 policyrep: Make helper class naming consistent. 2016-04-26 13:29:26 -04:00
Chris PeBenito
bb1acd1c7f Refactor ComponentQuery and ContextQuery into mixins
Also move generic matching functions in PolicyQuery into new util module.
2016-04-06 09:59:41 -04:00
Chris PeBenito
87c8b85c98 PortconQuery: add missing debug statement 2016-04-01 10:45:05 -04:00
Chris PeBenito
60ac053ce3 PortconQuery: move protocol type checking into PortconProtocol.
Also import useful policyrep classes in its __init__.py
2016-03-21 10:55:13 -04:00
Chris PeBenito
c3425b3656 Improve analysis INFO level logging.
Make it more informative for GUI use.
2016-03-04 14:29:33 -05:00
Chris PeBenito
c017bd7cfa Apply logging best practices.
* Use __name__ for the logger name
* Add top-level library NullHandlers
2016-03-04 13:49:03 -05:00
Chris PeBenito
e6f59d04e5 Refactor SETools queries/analyses to use descriptors instead of get/setters
This is Pythonic.
2015-05-16 21:59:10 -04:00
Chris PeBenito
82b021a5a4 Portcon: implement port ranges using a namedtuple
Has the benefit of unifying the object attributes for port range and MLS
range objects, making the PolicyQuery._match_range() function work
naturally for both object types.
2015-04-27 14:15:31 -04:00
Chris PeBenito
f3ca479a27 Address remaining pylint errors.
Also implement some suggested changes.
2015-04-06 09:51:32 -04:00
Chris PeBenito
9d51dcc7e3 Misc cleanups suggested by pylint
* unnecessary parentheses on return
* variable shadowing
* unused variables
* classmethod variable naming
2015-04-02 14:50:21 -04:00
Chris PeBenito
a4ab5b64d5 Implement logging in all Queries. 2015-03-20 12:02:13 -04:00
Chris PeBenito
ea01e19215 PortconQuery: fix naming of port range options 2015-03-20 10:28:57 -04:00
Chris PeBenito
f216d7cf24 setools.*: standardize queries to None defaults instead of empty strings.
Clearer intent and nicer for logging output.  Removes unnecessary type
conversions.
2015-03-19 14:03:36 -04:00
Chris PeBenito
e7f4caf1a6 Remove unnecessary inheritance in PortconQuery. 2015-03-08 11:46:24 -04:00
Chris PeBenito
43c438f14e Lookup objects in Queries as much as possible.
Eliminates many string conversions and informs user immediately that
something is wrong when they enter e.g. an invalid type.
2015-03-01 15:27:56 -05:00
Chris PeBenito
fa02fdfbb5 ContextQuery: implement range matching criteria.
Implement unit tests on FSUseQuery for initial testing.

closes #22
2015-02-24 09:44:12 -05:00
Chris PeBenito
cf601f08fd Make range matching a generic function.
Move port range matching algorithm out of PortconQuery so it can be
used for matching MLS ranges.
2015-02-19 12:50:35 -05:00
Chris PeBenito
2f44b599ca Reflow lines with new max line length.
Undo past whitespace fixes that are now unnecessary now that the max
line length increased to 100.
2015-02-14 10:40:38 -05:00
Chris PeBenito
15a8b2de2c String changes to meet PEP8 standards.
Except max line length of 100.

Also use escaping to fix long lines.
2015-02-12 14:01:44 -05:00
Chris PeBenito
02c5e72f0a Whitespace changes to meet PEP8 standards.
Except max line length of 100.
2015-02-12 13:52:46 -05:00
Chris PeBenito
9fec147c52 Implement portcon query. 2014-11-24 22:08:34 -05:00