Created
October 18, 2023 07:38
-
-
Save kasperis7/22dafe3cc9e3e0b2f6bb7bdd7e61f08d to your computer and use it in GitHub Desktop.
script for dumping the disassambly of specific function from vmlinux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os, sys | |
fn = sys.argv[1] | |
f = open("./System.map") | |
lines = f.readlines() | |
candi_lines = [] | |
for l in lines: | |
if (fn in l): | |
candi_lines.append(lines.index(l)) | |
target = None | |
for l in candi_lines: | |
if lines[l].split()[-1] == fn: | |
target = l | |
break | |
if (target): | |
start_addr = lines[l].split()[0] | |
end_addr = lines[l+1].split()[0] | |
os.system('objdump -d ./vmlinux --start-address=0x%s --stop-address=0x%s' %(start_addr, end_addr)) | |
else: | |
print("function not found") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment