Skip to content

Instantly share code, notes, and snippets.

View ophirharpaz's full-sized avatar

Ophir Harpaz ophirharpaz

View GitHub Profile
@ophirharpaz
ophirharpaz / rename_functions_by_syscalls.py
Created February 16, 2020 09:04
This IDAPython script renames functions according to the Linux syscall (int 80h) they contain. The script assumes each syscall is invoked only once.
SYSCALL_OPCODE = '\xCD\x80'
REGULAR_COMMENT = 0 # as opposed to a repeatable one
def get_syscalls_addresses():
return (h for h in Heads() if SYSCALL_OPCODE == GetManyBytes(h, ItemSize(h)))
def get_syscall_name_from_addr(addr):
# Fetch the syscall name from IDA's automatic comment
@ophirharpaz
ophirharpaz / get_call_flows_from_exports.py
Created February 22, 2020 15:19
The script generates and prints a graph of all function-call flows that start in exported functions and end in the function being pointed at in IDA. This functionality is useful when you need to trigger a function in a DLL and wish to know which exported function leads to it.
"""
The script generates and prints a graph of all function-call flows that start in exported functions and end
in the function being pointed at in IDA.
This functionality is useful when you need to trigger a function in a DLL and wish to know which exported function
leads to it.
"""
import idaapi
import idautils
import idc