REVEN-Axion 2015v1.1-r3
incremental_search.py

This shows how to use the search incrementally. This can allow you to have a progress bar, or do some background work while searching.

This will demonstrate the use of the following services:

1 import reven
2 
3 rvn = reven.reven_connection("localhost", 13370)
4 count = rvn.run_get_sequence_count("Execution run") - 1
5 
6 range = reven.execution_range(0, count)
7 
8 # Create any search object
9 search = reven.search_request(reven.filter_criterion_address(0x400000))
10 
11 # Stop after one result only
12 search.max_results = 1
13 
14 # The service returns each time we process 1% of the sequences (to print a progress bar)
15 search.max_sequences = count / 100
16 
17 while range.begin() < range.end():
18  # Progress bar display
19  print 'Searching... %d%% done.' % ((range.sequence_identifier * 100) / count)
20  result = rvn.run_search_sequences(range, search)
21 
22  if len(result.content) > 0:
23  print 'Found result at %d' % result.content[0].sequence.index
24  break
25 
26  # After each step, we request only the remaining range
27  range = result.remaining_range