├── AngryIDA.py ├── LICENSE └── README.md /AngryIDA.py: -------------------------------------------------------------------------------- 1 | ''' 2 | angr plug-in for IDA Pro. 3 | 4 | Integrates point and click use of the angr binary analysis framework 5 | inside of IDA Pro. The plug-in adds a sub menu, called AngryIDA, to 6 | IDA View-A's pop-up context menu. Inside the IDA View-A window 7 | right-click and expand the AngryIDA menu item to use. 8 | ''' 9 | 10 | from __future__ import print_function 11 | import angr 12 | import claripy 13 | import idaapi #pylint: disable=import-error 14 | from idaapi import Form #pylint: disable=import-error 15 | 16 | 17 | FIND_ADDRS = [] 18 | AVOID_ADDRS = [] 19 | EXP_OPTS = { 20 | "load":{ 21 | "auto_load_libs":False 22 | }, 23 | "state":{ 24 | "discard_lazy_solves":True 25 | }, 26 | "path_group":{ 27 | "immutable":False 28 | }, 29 | "time_limit":{ 30 | "minutes":10 31 | }, 32 | "stdin":{ 33 | "length":-1, 34 | "ascii":False, 35 | "null":False, 36 | "white_space":False, 37 | "newline":True 38 | }, 39 | "args":{ 40 | "length":-1 41 | } 42 | } 43 | 44 | #---------------------------------------------------------------------------------- 45 | # Possible solution to limiting angr exploring the binary. Ideas: 46 | # - Limit time 47 | # - Limit RAM 48 | # - Limit CPU 49 | # 50 | # import sys 51 | # import thread 52 | # import threading 53 | # from time import sleep 54 | # 55 | # def quit_thread(fn_name): 56 | # print('{0} took too long'.format(fn_name), file=sys.stderr) 57 | # thread.interrupt_main() 58 | # 59 | # def time_limit(minutes): 60 | # def decorate(fn): 61 | # def internal(*args, **kwargs): 62 | # timer = threading.Timer(minutes, quit_thread, args=[fn.__name__]) 63 | # timer.start() 64 | # try: 65 | # result = fn(*args, **kwargs) 66 | # finally: 67 | # timer.cancel() 68 | # return result 69 | # return internal 70 | # return decorate 71 | #---------------------------------------------------------------------------------- 72 | 73 | class TestEmbeddedChooserClass(Choose2): 74 | """ 75 | Arguments: 76 | Return Value: 77 | Description: 78 | - 79 | TODO: 80 | - Doc String 81 | """ 82 | def __init__(self, title, nb=5, flags=0): 83 | """ 84 | Arguments: 85 | Return Value: 86 | Description: 87 | - 88 | TODO: 89 | - Doc String 90 | """ 91 | Choose2.__init__( 92 | self, 93 | title, 94 | [["Address", 10], ["Name", 30]], 95 | embedded=True, 96 | width=30, 97 | height=20, 98 | flags=flags 99 | ) 100 | self.n = 0 101 | self.items = [self.make_item()]*(nb+1) 102 | self.icon = 5 103 | self.selcount = 0 104 | 105 | def make_item(self): 106 | """ 107 | Arguments: 108 | Return Value: 109 | Description: 110 | - 111 | TODO: 112 | - Doc String 113 | """ 114 | r = [str(self.n), "func_%04d" % self.n] 115 | self.n += 1 116 | return r 117 | 118 | def OnClose(self): 119 | """ 120 | Arguments: 121 | Return Value: 122 | Description: 123 | - 124 | TODO: 125 | - Doc String 126 | """ 127 | pass 128 | 129 | def OnGetLine(self, n): 130 | """ 131 | Arguments: 132 | Return Value: 133 | Description: 134 | - 135 | TODO: 136 | - Doc String 137 | """ 138 | print("getline %d" % n) 139 | return self.items[n] 140 | 141 | def OnGetSize(self): 142 | """ 143 | Arguments: 144 | Return Value: 145 | Description: 146 | - 147 | TODO: 148 | - Doc String 149 | """ 150 | n = len(self.items) 151 | print("getsize -> %d" % n) 152 | return n 153 | 154 | class ExpFormOpts(Form): 155 | """ 156 | Arguments: 157 | Return Value: 158 | Description: 159 | - 160 | TODO: 161 | - Doc String 162 | """ 163 | def __init__(self): 164 | """ 165 | Arguments: 166 | Return Value: 167 | Description: 168 | - 169 | TODO: 170 | - Doc String 171 | """ 172 | self.invert = False 173 | self.EChooser = TestEmbeddedChooserClass("E1", flags=Choose2.CH_MULTI) 174 | Form.__init__(self, r"""STARTITEM {id:rDiscardLazySolves} 175 | Options 176 | 177 | 178 | {cGroup1}> 179 |