Skip to content

Hijack fd

PARSED_FILE_ARG = Tuple[Optional[ParsedSocket], Optional[str]] module-attribute

parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description='Replace a file descriptor of a debugged process.\n\nThe new file descriptor can point to:\n- a file\n- a pipe\n- a socket\n- a device, etc.\n\nExamples:\n1. Redirect STDOUT to a file:\n `hijack-fd 1 /dev/null`\n\n2. Redirect STDERR to a socket:\n `hijack-fd 2 tcp://localhost:8888`\n') module-attribute

ParsedSocket

Bases: NamedTuple

address: str instance-attribute

ip_version: Literal['ipv4', 'ipv6'] instance-attribute

port: int instance-attribute

protocol: Literal['tcp', 'udp'] instance-attribute

ShellcodeRegs

Bases: NamedTuple

newfd: str instance-attribute

stack: str instance-attribute

syscall_ret: str instance-attribute

asm_replace_file(replace_fd, filename)

asm_replace_socket(replace_fd, socket_data)

exec_shellcode_with_stack(ec, blob, stack_size) async

get_shellcode_regs()

hijack_fd(fdnum, newfile)

parse_file_or_socket(s)

parse_socket(url)

stack_size_alignment(s)