This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def spoils(f): | |
"""return the list of spoiled registers | |
default is r0-r3 | |
not too smart, but safe - i.e. if list of spoiled registers is smaller than 4 - it's quite safe to assume only these registers are spoiled | |
the opposite is false | |
""" | |
spoiled = ['R0', 'R1', 'R2', 'R3'] | |
if any(f.xrefs_from): | |
return spoiled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sark | |
import construct as ct | |
import ida_xref | |
## I have dumped the memory content to ram.bin | |
dump = open("ram.bin", "rb").read() | |
ram = sark.Segment(name='RAM') | |
## memoizing can make it more efficient but IDC | |
def in_segs(ea, segs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def db(word_size, alphabet_size): | |
L1 = alphabet_size**(word_size-1) | |
lookup_table = {} | |
i = 0 | |
for _ in range(L1*alphabet_size): | |
if i not in lookup_table: | |
lookup_table[i] = alphabet_size - 1 | |
s = lookup_table[i] | |
yield alphabet_size - s - 1 |
OlderNewer