def get_output(inf,arch='elf'):
	"""format into a string of bytes"""
	output = ''
	if '.nasm' in inf:
		tmp = getoutput("nasm -f %s %s"%(arch,inf))
		if 'error' in tmp:
			print '[-] Error in your asm: ', tmp
			sys.exit(1)	
		inf = inf.replace(".nasm", ".o")
	tmp = getoutput("objdump -d %s"%inf)
	
	opcodes = ''
	for line in tmp.split('\n')[7:]:
		tmp = line.split(':',1)
		if len(tmp) > 1 and len(tmp[1]) > 0: tmp = tmp[1]
		else: continue

		# split on tab to get opcodes
		tmp = ''.join(tmp).split('\t')
		if len(tmp) > 1: tmp = tmp[1].strip().replace(' ','')
		if '<' in tmp: continue
		opcodes += tmp
	return opcodes
dataset/ETHPy150Open hatRiot/shellme/shellme.py/get_output/original