Reputation: 11
I have binary for example https://github.com/andrew-d/static-binaries/blob/master/binaries/linux/x86_64/nmap
1) How to find what is the address of this series of bytes :48 8B 45 A8 48 8D 1C 02 48 8B 45 C8
? , the result need to be 0x6B0C67
2)How to find out the 12 bytes that in address 0x6B0C67
? the result need to be 48 8B 45 A8 48 8D 1C 02 48 8B 45 C8
.
3) How to find which address call to specific string? for example i + 1 == features[i].index
that locate in 0x6FC272
? the result need to be 0x4022F6
How can I find all of this without open Ida? only with python/c code?
thanks
Upvotes: 0
Views: 1325
Reputation: 4689
For 1) Is your file small enough to be loaded into memory? Then it's as simple as
offset = open(file, 'rb').read().find(
bytes.fromhex("48 8B 45 A8 48 8D 1C 02 48 8B 45 C8")
)
# offset will be -1 if not found
If not, you will need to read it in chunks.
For 2), do
with open(file, 'rb') as stream:
stream.seek(0x6b0c67)
data = stream.read(12)
I'm afraid I don't understand the question in 3)...
Upvotes: 1