MCPcopy Create free account
hub / github.com/SentineLabs/AlphaGolang / create_string

Function create_string

4.string_cast.py:166–186  ·  view source on GitHub ↗
(addr, string_len)

Source from the content-addressed store, hash-verified

164 return False
165
166def create_string(addr, string_len):
167 if get_segm_name(addr) is None:
168 debug('Cannot load a string which has no segment - not creating string @ 0x%02x' % addr)
169 return False
170
171 debug('Found string load @ 0x%x with length of %d' % (addr, string_len))
172 # This may be overly aggressive if we found the wrong area...
173 if idc.get_str_type(addr) is not None and ida_bytes.get_strlit_contents(addr, string_len, STRTYPE_C) is not None and len(ida_bytes.get_strlit_contents(addr, string_len, STRTYPE_C)) != string_len:
174 debug('It appears that there is already a string present @ 0x%x' % addr)
175 undefine_string(addr)
176
177 if ida_bytes.get_strlit_contents(addr, string_len, STRTYPE_C) is None and ida_bytes.create_strlit(addr, string_len, STRTYPE_C):
178 return True
179 else:
180 # If something is already partially analyzed (incorrectly) we need to ida_bytes.del_items it
181 undefine_string(addr)
182 if ida_bytes.create_strlit(addr, string_len, STRTYPE_C):
183 return True
184 debug('Unable to make a string @ 0x%x with length of %d' % (addr, string_len))
185
186 return False
187
188def create_offset(addr):
189 if ida_offset.op_plain_offset(addr, 1, 0):

Callers 1

strings_initFunction · 0.85

Calls 2

undefine_stringFunction · 0.85
debugFunction · 0.70

Tested by

no test coverage detected