text
stringlengths
1
93.6k
self.text.tokens += [tokens]
return (old_lines != self.text.lines) or (old_tokens != self.text.tokens)
result = ""
operation = instr.operation.replace(".", "")
if len(operation) < 7:
operation += " " * (7 - len(operation))
result += operation + " "
for j in range(0, len(instr.operands)):
if j != 0:
result += ", "
if type(instr.operands[j]) == list:
if instr.operands[j][0][0] == "-":
tokens += [[x + len(result) + 1, len(instr.operands[j][0]) - 1, "reg", instr.operands[j][0][1:]]]
elif instr.operands[j][0][-1] == "!":
tokens += [[x + len(result), len(instr.operands[j][0]) - 1, "reg", instr.operands[j][0][:-1]]]
else:
tokens += [[x + len(result), len(instr.operands[j][0]), "reg", instr.operands[j][0]]]
result += instr.operands[j][0] + " "
if len(instr.operands[j]) == 2:
result += instr.operands[j][1]
elif type(instr.operands[j][2]) == str:
result += instr.operands[j][1] + " "
if instr.operands[j][2][0] == "-":
tokens += [[x + len(result) + 1, len(instr.operands[j][2]) - 1, "reg", instr.operands[j][2][1:]]]
elif instr.operands[j][0][-1] == "!":
tokens += [[x + len(result), len(instr.operands[j][2]) - 1, "reg", instr.operands[j][2][:-1]]]
else:
tokens += [[x + len(result), len(instr.operands[j][2]), "reg", instr.operands[j][2]]]
result += instr.operands[j][2]
else:
result += " %s %d" % (instr.operands[j][1], instr.operands[j][2])
elif instr.operands[j].__class__ == Arm.MemoryOperand:
result += "["
for k in range(0, len(instr.operands[j].components)):
if k != 0:
result += ", "
if type(instr.operands[j].components[k]) == str:
if instr.operands[j].components[k][0] == "-":
tokens += [[x + len(result) + 1, len(instr.operands[j].components[k]) - 1, "reg", instr.operands[j].components[k][1:]]]
elif instr.operands[j].components[k][-1] == "!":
tokens += [[x + len(result), len(instr.operands[j].components[k]) - 1, "reg", instr.operands[j].components[k][:-1]]]
else:
tokens += [[x + len(result), len(instr.operands[j].components[k]), "reg", instr.operands[j].components[k]]]
result += instr.operands[j].components[k]
elif type(instr.operands[j].components[k]) == list:
if instr.operands[j].components[k][0][0] == "-":
tokens += [[x + len(result) + 1, len(instr.operands[j].components[k][0]) - 1, "reg", instr.operands[j].components[k][0][1:]]]
elif instr.operands[j].components[k][0][-1] == "!":
tokens += [[x + len(result), len(instr.operands[j].components[k][0]) - 1, "reg", instr.operands[j].components[k][0][:-1]]]
else:
tokens += [[x + len(result), len(instr.operands[j].components[k][0]), "reg", instr.operands[j].components[k][0]]]
result += instr.operands[j].components[k][0] + " "
if len(instr.operands[j].components[k]) == 2:
result += instr.operands[j].components[k][1]
elif type(instr.operands[j].components[k][2]) == str:
result += instr.operands[j].components[k][1] + " "
if instr.operands[j].components[k][2][0] == "-":
tokens += [[x + len(result) + 1, len(instr.operands[j].components[k][2]) - 1, "reg", instr.operands[j].components[k][2][1:]]]
elif instr.operands[j][2][-1] == "!":
tokens += [[x + len(result), len(instr.operands[j].components[k][2]) - 1, "reg", instr.operands[j].components[k][2][:-1]]]
else:
tokens += [[x + len(result), len(instr.operands[j].components[k][2]), "reg", instr.operands[j].components[k][2]]]
result += instr.operands[j].components[k][2]
else:
result += "%s %d" % (instr.operands[j].components[k][1], instr.operands[j].components[k][2])
else:
value = instr.operands[j].components[k]
if instr.operands[j].components[k] < 0:
string = "-0x%x" % -instr.operands[j].components[k]
else:
string = "0x%x" % instr.operands[j].components[k]
if block.analysis.functions.has_key(value):
# Pointer to existing function
func = block.analysis.functions[value]
string = func.name
if func.plt:
color = QColor(192, 0, 192)
else:
color = QColor(0, 0, 192)
if len(result) > 0:
line += [[result, Qt.black]]
x += len(result)
result = ""
line += [[string, color]]
tokens += [[x, len(string), "ptr", value, string]]
x += len(string)
elif (value >= block.exe.start()) and (value < block.exe.end()) and (not self.isLocalJump()):
# Pointer within module
if len(result) > 0:
line += [[result, Qt.black]]
x += len(result)
result = ""
if value in block.exe.symbols_by_addr:
string = block.exe.symbols_by_addr[value]
line += [[string, QColor(0, 0, 192)]]
tokens += [[x, len(string), "ptr", value, string]]
x += len(string)
else: