Feat/format#37
Open
ElijahSwiftIBM wants to merge 35 commits intodevfrom
Open
Conversation
…ile parsing, data piping support all work for python interface and tests Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
…interface and lots of testing Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
…testing Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
…ode is in base, just needs lots of testing Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
…ault to 'explore' operation Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
…kes bytes only (still needs testing) Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
Signed-off-by: Elijah Swift <Elijah.Swift@IBM.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Issue Reference
Issue: #21
💻 What does this address?
Potential exploiters of CBXP will be providing their own data rather than pulling information from a live system
📟 Implementation Details
Core cbxp functions were split into two "operations" explore (operating as before) and format (requiring input from a file or data buffer). The cli can accomodate a file/dataset and an offset into that file to look for the control block, or a buffer passed to stdin in place of the file. The python interface only deals with a data buffer and offset as a python exploiter can easily read/open files or datasets to pass in. The python interface also assumes an operation of "explore" by default.
📋 Is there a test case?
Many new test cases added to test.sh and test.py as well as samples added for consistent file behavior:
For the PR, these are the new tests added.
tests/test.sh# Formatrun_with_expected_exit_code 0 ./dist/cbxp format -F tests/samples/ascb.bin ascbrun_with_expected_exit_code 0 cat -B tests/samples/cvt.bin | ./dist/cbxp format cvtrun_with_expected_exit_code 0 ./dist/cbxp format -F tests/samples/oucb.bin oucbrun_with_expected_exit_code 0 ./dist/cbxp format -F tests/samples/ascboffset40.bin -o 0x40 ascbrun_with_expected_exit_code 0 ./dist/cbxp format -F tests/samples/ascboffset40.bin -o 64 ascbrun_with_expected_exit_code 0 cat -B tests/samples/oucboffset3A8.bin | ./dist/cbxp format -o 0x3A8 oucbrun_with_expected_exit_code 0 cat -B tests/samples/oucboffset3A8.bin | ./dist/cbxp format -o 936 oucb# Errors: Bad Usagerun_with_expected_exit_code 255 ./dist/cbxp explore -F tests/samples/ascb.bin psarun_with_expected_exit_code 255 ./dist/cbxp explore -o 1 psarun_with_expected_exit_code 255 ./dist/cbxp format psarun_with_expected_exit_code 255 ./dist/cbxp format -i cvt psarun_with_expected_exit_code 255 ./dist/cbxp format -f psapsa=PSA psarun_with_expected_exit_code 255 ./dist/cbxp format -F tests/samples/ascb.bin -o 999999 ascb# Errors: File and STDINrun_with_expected_exit_code 255 sh -c 'cat -B tests/samples/cvt.bin | ./dist/cbxp format -F tests/samples/cvt.bin cvt'# Errors: Buffer Too Smallrun_with_expected_exit_code 255 ./dist/cbxp format -F tests/samples/ascb.bin psatests/test.pytest_cbxp_can_format_ascb_from_a_file_buffertest_cbxp_can_format_cvt_from_a_file_buffertest_cbxp_can_format_oucb_from_a_file_buffertest_cbxp_can_format_ascb_with_hex_offsettest_cbxp_can_format_ascb_with_decimal_offsettest_cbxp_can_format_oucb_with_hex_offsettest_cbxp_can_format_oucb_with_decimal_offsettest_cbxp_raises_cbxp_error_if_explore_uses_data_buffertest_cbxp_raises_cbxp_error_if_explore_uses_offsettest_cbxp_raises_cbxp_error_if_bad_operation_is_providedtest_cbxp_raises_cbxp_error_if_format_uses_includestest_cbxp_raises_cbxp_error_if_format_uses_filterstest_cbxp_raises_cbxp_error_if_format_is_missing_data_buffertest_cbxp_raises_cbxp_error_if_format_offset_is_too_largetest_cbxp_raises_cbxp_error_if_format_buffer_is_too_smallSome existing tests were changed to be more dynamic in the face of some changed behavior on the system:
test_cbxp_can_use_int_filter_with_hex_field_equaltest_cbxp_can_use_hex_filter_with_equaltest_cbxp_can_use_hex_filter_with_greater_thantest_cbxp_can_use_hex_filter_with_less_thantest_cbxp_can_use_hex_filter_with_greater_than_or_equaltest_cbxp_can_use_hex_filter_with_less_than_or_equal