Exemplo n.º 1
0
def extract_offsets(lines):
	keywords = ['proc', 'db', 'dw', 'dd']
	offsets = {}
	for line in lines:
		if len(line) < 15:
			continue
		section, address, line = extract_data(line)
		line = utility.shrink(line)
		tokens = line.split(' ')
		if len(tokens) >= 2 and tokens[1] in keywords:
			name = tokens[0]
			offsets[name] = address
	print 'Parsed %d offsets' % len(offsets)
	return offsets
Exemplo n.º 2
0
def extract_offsets(lines):
    keywords = ["proc", "db", "dw", "dd"]
    offsets = {}
    for line in lines:
        if len(line) < 15:
            continue
        section, address, line = extract_data(line)
        line = utility.shrink(line)
        tokens = line.split(" ")
        if len(tokens) >= 2 and tokens[1] in keywords:
            name = tokens[0]
            offsets[name] = address
    print "Parsed %d offsets" % len(offsets)
    return offsets
Exemplo n.º 3
0
def extract_offsets(lines):
	keywords = ['proc', 'db', 'dw', 'dd']
	offsets = {}
	for line in lines:
		if len(line) < 15:
			continue
		section, address, line = extract_data(line)
		line = utility.shrink(line)
		tokens = line.split(' ')
		if len(tokens) >= 2 and tokens[1] in keywords:
			name = tokens[0]
			offsets[name] = address
	print 'Parsed %d offsets' % len(offsets)
	return offsets
Exemplo n.º 4
0
def find_target(lines, target, offset, address_mode):
	end = len(lines)
	for i in range(offset, end):
		line = utility.shrink(lines[i])
		if len(line) == 0:
			continue
		if address_mode:
			section, address, line = extract_data(line)
			if address == target:
				return i
		else:
			line = get_code(line)
			if line[0 : len(target)] == target:
				return i
			
	return None