454
455 totalcost = costMat + costChainCond + costDeref + costLength
456
457 # if totalcost > self.max_cost:458 # print(str(costMat), str(costChainCond), str(costDeref), str(costLength))
459
460 return totalcost
340
341 self.gadgetMatrix = GadgetMatrix(arch)
342
343 # self.gadgetMatrix.matrix = sparse.identity(arch.size, dtype=bool).tocsr()344
345 for i in range(len(self.instList) - 1, -1, -1):
346 self.gadgetMatrix.addInst(self.instList[i])
219 if self.inst == None:
220 self.inst = chainInst
221 self.matrix = sparse.identity(self.arch.size, dtype=bool).tocsr()
222 # groups = chainInst.groups223 self.chainCond = sparse.lil_matrix((1, self.arch.size), dtype=bool)
224 len_chainInst_operands = len(chainInst.operands)
225 if capstone.CS_GRP_RET in chainInst.groups:
116 return self.arch.stackOverWrite
117 else:
118 pass
119 # if "stack_" in name:120
121 # index = index - self.arch.stackTop
122 # if index < 0:
78 self.gadgets.append(gadget)
79
80 def defaultCallback(self, gadget, context):
81 # print(str(gadget.max_cost)) 82 if gadget.cost() > gadget.max_cost:
83 return False
84 else:
It is recommended to remove any commented code in your codebase.
for item in sequence:
# print(item)
do_something(item)
# def old_function():
# '''Older implementation that has been replaced'''
# data = get_data()
# api.post(data)
for item in sequence:
do_something(item)