Skip to content

Split #3054: Add base classes [ready]#3140

Merged
gpotter2 merged 12 commits intosecdev:masterfrom
polybassa:split_3054_scanner_preparation
Apr 22, 2021
Merged

Split #3054: Add base classes [ready]#3140
gpotter2 merged 12 commits intosecdev:masterfrom
polybassa:split_3054_scanner_preparation

Conversation

@polybassa
Copy link
Copy Markdown
Contributor

Add base classes for a new and clean implementation of automotive scanners and enumerators

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2021

Codecov Report

Merging #3140 (b02a799) into master (18b71dd) will increase coverage by 0.00%.
The diff coverage is 84.33%.

@@           Coverage Diff            @@
##           master    #3140    +/-   ##
========================================
  Coverage   85.32%   85.32%            
========================================
  Files         262      265     +3     
  Lines       54731    54946   +215     
========================================
+ Hits        46697    46881   +184     
- Misses       8034     8065    +31     
Impacted Files Coverage Δ
scapy/contrib/automotive/scanner/graph.py 66.66% <0.00%> (ø)
scapy/contrib/automotive/scanner/test_case.py 76.00% <76.00%> (ø)
...apy/contrib/automotive/scanner/staged_test_case.py 87.15% <87.15%> (ø)
scapy/contrib/automotive/scanner/configuration.py 96.77% <96.77%> (ø)
scapy/contrib/automotive/enumerator.py 43.87% <100.00%> (ø)
scapy/arch/windows/__init__.py 67.73% <0.00%> (-0.57%) ⬇️
scapy/sendrecv.py 78.24% <0.00%> (+0.15%) ⬆️
... and 2 more

@polybassa polybassa closed this Mar 16, 2021
@polybassa polybassa reopened this Mar 16, 2021
@polybassa polybassa changed the title Split #3054: Add base classes Split #3054: Add base classes [ready] Mar 22, 2021
@gpotter2 gpotter2 added this to the 2.5.0 milestone Mar 29, 2021
@polybassa polybassa force-pushed the split_3054_scanner_preparation branch from c0c480e to b983299 Compare April 2, 2021 07:45
@polybassa polybassa closed this Apr 2, 2021
@polybassa polybassa reopened this Apr 2, 2021
@polybassa polybassa closed this Apr 4, 2021
@polybassa polybassa reopened this Apr 4, 2021
@polybassa
Copy link
Copy Markdown
Contributor Author

@gpotter2 Would it be possible to get this PR in, so that I can continue with the split of #3054

Copy link
Copy Markdown
Member

@gpotter2 gpotter2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense if the test-related files were in the test/ folder.
Remember that the test/ folder isn't included in builds, so it would make scapy lighter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do
@six.add_metaclass(abc.ABCMeta)
and you don't need all of that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this hint

@polybassa
Copy link
Copy Markdown
Contributor Author

polybassa commented Apr 20, 2021

@gpotter2 Sorry for the confusion with the name AutomotiveTestCase and AutomotiveTestCaseExecutor.
Prior to my refactoring, I called these classes Enumerator and Scanner. But during multiple practical tests, I found these two classes very useful for further purposes. For example, I used an Enumerator class to validate if a certain vulnerability is present in a Electronic Control Unit of a car. Therefore I came up with a more generic naming for these two classes. I changed the base class for Enumerator into AutomotiveTestCase and Scanner into AutomotiveTestCaseExecutor. The derived classes still remain the name Enumerator and Scanner.

The AutomotiveTestCase class basically defines a generic interface for the AutomotiveTestCaseExecutor. The unique part of this two classes is the automated aggregation (reverse engineering) of a device under tests "system state" in a directed graph. Since automotive control units are very state driven, for my scanners, it's very important to identify the current system state in order to obtain reproducible and reliable results.

Regarding the AutomotiveTestCaseExecutor, currently I derive Scanner classes from this base class. On my current experiments, I also use this class for a Fuzzer of automotive protocols with system state awareness. Also in this use case, I find it more natural to derive "AutomotiveFuzzer" and "Scanner" from "AutomotiveTestCaseExecutor". The old naming scheme would lead to a inheritance of "AutomotiveFuzzer" from "Scanner", which I find stranger.

To summarize that.. I've chosen this names to express a broader use of these base-classes, not only for enumeration and scanning. I'm currently experimenting with more use cases and plan to release for example AutomotiveFuzzers in the future.

@polybassa polybassa force-pushed the split_3054_scanner_preparation branch from b983299 to b02a799 Compare April 20, 2021 06:35
@polybassa
Copy link
Copy Markdown
Contributor Author

@gpotter2 could this PR get merged, please? My paper about automotive protocol scanners, I've implemented with Scapy, got accepted and will be published on 12.5.2021. I would be happy, if by that time, the relevant code (#3054) got merged.

@gpotter2 gpotter2 merged commit 693956d into secdev:master Apr 22, 2021
bzalkilani pushed a commit to bzalkilani/scapy that referenced this pull request Jun 12, 2022
* Split secdev#3054: Add base classes for a new and clean implementation of automotive scanners and enumerators
@polybassa polybassa deleted the split_3054_scanner_preparation branch July 27, 2022 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants