Package IDAscope :: Package idascope :: Package core :: Module AnnotationsProvider
[hide private]
[frames] | no frames]

Source Code for Module IDAscope.idascope.core.AnnotationsProvider

 1  #!/usr/bin/python 
 2  ######################################################################## 
 3  # Copyright (c) 2012 
 4  # Daniel Plohmann <daniel.plohmann<at>gmail<dot>com> 
 5  # Alexander Hanel <alexander.hanel<at>gmail<dot>com> 
 6  # All rights reserved. 
 7  ######################################################################## 
 8  # 
 9  #  This file is part of IDAscope 
10  # 
11  #  IDAscope is free software: you can redistribute it and/or modify it 
12  #  under the terms of the GNU General Public License as published by 
13  #  the Free Software Foundation, either version 3 of the License, or 
14  #  (at your option) any later version. 
15  # 
16  #  This program is distributed in the hope that it will be useful, but 
17  #  WITHOUT ANY WARRANTY; without even the implied warranty of 
18  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
19  #  General Public License for more details. 
20  # 
21  #  You should have received a copy of the GNU General Public License 
22  #  along with this program.  If not, see 
23  #  <http://www.gnu.org/licenses/>. 
24  # 
25  ######################################################################## 
26   
27  import json 
28   
29  import idc 
30  import idaapi 
31  import idautils 
32   
33  import JsonHelper 
34   
35  annotations = { 
36                 0x401000: 
37                   { 
38                    "function_name": "a_function_name", 
39                    "basic_blocks": 
40                      { 
41                       0x401010: 
42                         { 
43                          "color": 0xFF0000, 
44                          "annotations": 
45                            { 
46                             0x401012: 
47                               { 
48                                "instruction": "int 2d", 
49                                "comment": "a_comment", 
50                                "repeatable_comment": "a_repeatable_comment", 
51                                "color": 0xFF0000 
52                               } 
53                            } 
54                         } 
55                      } 
56                   } 
57                } 
58   
59   
60 -class AnnotationsProvider():
61
62 - def __init__(self):
63 # when calling from a PyQt object, the reference to the IDA python modules are not available. 64 # We add references to idc, idaapi, and idautils to our class to overcome this. 65 # 2012-07-01 TODO Figure out why the reference is broken and fix this. 66 self.idc = idc 67 self.idaapi = idaapi 68 self.idautils = idautils 69 return
70
71 - def load_config(self, config_filename):
72 # TODO adapt implementation for this module 73 config_file = open(config_filename, "r") 74 config = config_file.read() 75 parsed_config = json.loads(config, object_hook=JsonHelper.decode_dict) 76 self.renaming_seperator = parsed_config["renaming_seperator"] 77 self.semantic_definitions = parsed_config["semantic_definitions"] 78 return
79
80 - def get_annotations(self):
81 # return: function: 82 83 # FLAGs that help to identify names: 84 # iterate via Names() to get addresses 85 # use the following functions to dissect the names 86 # idaapi.isCode() 87 # idaapi.isData() 88 # idaapi.has_cmt() 89 # idaapi.isVar() 90 # idaapi.has_name() 91 # idaapi.has_user_name() 92 # idaapi.has_auto_name() 93 # idaapi.has_dummy_name() 94 # open issues 95 # names of stackvars? 96 pass
97