PAGalaxyLab / vxhunter

ToolSet for VxWorks Based Embedded Device Analyses
BSD 2-Clause "Simplified" License
334 stars 70 forks source link

faster `find_loading_address` #13

Closed liumuqing closed 4 years ago

liumuqing commented 4 years ago

Hello, this commit is to make find_loading_address faster.

It's complexity optimized from O(MNdefault_check_count) to O(M*N)

dark-lbp commented 4 years ago

Hello, @liumuqing Sorry for the delay, I tested your code and it can't find the load address with this firmware file. (please disable quick_test method before tests)

➜  example_firmware git:(master) ✗ r2 -a ppc -b 32 image_vx6_ppc_big_endian.bin
 -- Don't wait for Travis
[0x00000000]> #!pipe python3 ../firmware_tools/vxhunter_r2_py3.py
Running with python version: 3.7.7 (default, Mar 10 2020, 15:43:03)
[Clang 11.0.0 (clang-1100.0.33.17)]
Auto detected VxWorks version: None
Please input the VxWorks main version type 'c' to exit
Available (5/6/c): 6
vx_version:6
firmware_path: image_vx6_ppc_big_endian.bin
[INFO    ][vxhunter_r2_py3.find_symbol_table] symbol table start offset: 0xd35d34
[INFO    ][vxhunter_r2_py3.find_symbol_table] symbol table end offset: 0xde8c68
[INFO    ][vxhunter_r2_py3._check_vxworks_endian] VxWorks endian: Big endian

###### Start analyze firmware ######
[INFO    ][vxhunter_r2_py3.find_string_table_by_key_function_index] found string table start address at 0xc034e8
[INFO    ][vxhunter_r2_py3.find_string_table_by_key_function_index] found string table end at 0xcd6e34
[INFO    ][vxhunter_r2_py3.find_string_table_by_key_function_index] found a string tab at: 0xc034e8 to 0xcd6e34
[INFO    ][vxhunter_r2_py3.find_loading_address] Start analyse
[ERROR   ][vxhunter_r2_py3.find_loading_address] We didn't find load address in this firmware, sorry!
Can't find image load address, exit.
[0x00000000]>

Please reopen an PR to the dev branch and skip file vx_target_standalone.py, this file is outdated.

liumuqing commented 4 years ago

I see, let me close pr first