Gencoding icon indicating copy to clipboard operation
Gencoding copied to clipboard

Error in code implementation: bad implementation in basic block feature extraction

Open YuanBoXie opened this issue 2 years ago • 0 comments

In file graph_analysis_ida.py, function def calTransferIns(bl):

def calTransferIns(bl):
	x86_TI = {'jmp':1, 'jz':1, 'jnz':1, 'js':1, 'je':1, 'jne':1, 'jg':1, 'jle':1, 'jge':1, 'ja':1, 'jnc':1, 'call':1}
	mips_TI = {'beq':1, 'bne':1, 'bgtz':1, "bltz":1, "bgez":1, "blez":1, 'j':1, 'jal':1, 'jr':1, 'jalr':1}
	arm_TI = {'MVN':1, "MOV":1}
	calls = {}
	calls.update(x86_TI)
	calls.update(mips_TI)
	start = bl[0]
	end = bl[1]
	invoke_num = 0
	inst_addr = start
	while inst_addr < end:
		opcode = GetMnem(inst_addr)
		re = [v for v in calls if opcode in v]
		if len(re) > 0:
			invoke_num += 1
		inst_addr = NextHead(inst_addr)
	return invoke_num

Here:

re = [v for v in calls if opcode in v]

It‘s supposed to use opcode == v instead of opcode in v. The current code implementation here will make all the substrings of the strings in the above instructions in the assembly instructions counted.

YuanBoXie avatar Jan 11 '23 05:01 YuanBoXie