onegadget ¤
Classes:
-
CheckSatResult– -
Lambda–Modified from onegadget's Lambda class
Functions:
-
colorize_reg– -
colorize_integer– -
colorize_psuedo_code–Colorize the pseudo code of onegadget
-
compute_file_hash–Compute the MD5 hash of the file, return the hash
-
run_onegadget–Run onegadget and return the output
-
parse_expression–Parse expression, return the result, colorized string and error message
-
check_stack_argv–Check argv that's on the stack, return the result and the message
-
check_non_stack_argv–Check argv that's not on the stack, return the result and the message
-
check_argv–Check argv, return the result and the message
-
check_envp–Check envp, return the result and the message
-
check_constraint–Parse constraint, return the result and the message
-
check_gadget–Check status of each gadget, return the gadget's status
-
find_gadgets–Find gadgets by parsing the output of onegadget, return there's any valid gadget
Attributes:
-
ADDRESS_WRITABLE_PATTERN– -
WRITABLE_COLON_PATTERN– -
EQUAL_NULL_PATTERN– -
VALID_POSIX_SPAWN_FILE_ACTIONS_PATTERN– -
VALID_ARGV_PATTERN– -
VALID_ENVP_PATTERN– -
IS_ALIGNED_PATTERN– -
IS_GOT_ADDRESS_PATTERN– -
CAST_PATTERN– -
XMM_SHIFT– -
CONSTRAINT_SEPARATOR– -
CAST_DEREF_MAPPING– -
CAST_MAPPING– -
ONEGADGET_COLOR– -
ONEGADGET_CACHEDIR– -
SAT– -
UNSAT– -
UNKNOWN–
ADDRESS_WRITABLE_PATTERN module-attribute ¤
VALID_POSIX_SPAWN_FILE_ACTIONS_PATTERN module-attribute ¤
IS_GOT_ADDRESS_PATTERN module-attribute ¤
CAST_DEREF_MAPPING module-attribute ¤
CAST_DEREF_MAPPING = {
"(u16)": u16,
"(s16)": s16,
"(u32)": u32,
"(s32)": s32,
"(u64)": u64,
"(s64)": s64,
}
CAST_MAPPING module-attribute ¤
CAST_MAPPING = {
"(u16)": lambda x: value,
"(s16)": lambda x: value,
"(u32)": lambda x: value,
"(s32)": lambda x: value,
"(u64)": lambda x: value,
"(s64)": lambda x: value,
}
ONEGADGET_COLOR module-attribute ¤
ONEGADGET_COLOR = {
"light_green": lambda x: colorize(x, "\x1b[38;5;82m"),
"light_purple": lambda x: colorize(x, "\x1b[38;5;153m"),
}
CheckSatResult ¤
Bases: Enum
Methods:
Attributes:
Lambda ¤
Lambda(obj: str | Lambda)
Modified from onegadget's Lambda class
Methods:
Attributes:
-
immi– -
obj– -
deref_count– -
gdb_expr(str) – -
color_str(str) –
compute_file_hash ¤
Compute the MD5 hash of the file, return the hash
parse_expression ¤
Parse expression, return the result, colorized string and error message
check_stack_argv ¤
check_stack_argv(expr: str) -> tuple[CheckSatResult, str]
Check argv that's on the stack, return the result and the message
check_non_stack_argv ¤
check_non_stack_argv(expr: str) -> tuple[CheckSatResult, str]
Check argv that's not on the stack, return the result and the message
check_argv ¤
check_argv(expr: str) -> tuple[CheckSatResult, str]
Check argv, return the result and the message
check_envp ¤
Check envp, return the result and the message
check_constraint ¤
check_constraint(constraint: str) -> tuple[CheckSatResult, str]
Parse constraint, return the result and the message
check_gadget ¤
check_gadget(
gadget: str,
show_unsat: bool = False,
no_unknown: bool = False,
verbose: bool = False,
) -> CheckSatResult
Check status of each gadget, return the gadget's status
find_gadgets ¤
find_gadgets(
show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False
) -> dict[CheckSatResult, int]
Find gadgets by parsing the output of onegadget, return there's any valid gadget