progfiguration.remotebrute

A dumbfuck remoting module

It is something to fear. It contains the “danger of violent death”. We endeavor to keep it “nasty, brutish, and short”.

TODO: * Wrapper of scp for multi-host scp * Use a thread pool for multi-host execution * Wrapper of scp that will mkdir the destination parent * Make sure dest is always clear/consistent. Does it make a new dest directory? * Implement ControlMaster for faster repeated copies/commands

Functions

generate_random_string(length)

Generate a secure random string of the specified length.

scp(host, sources, dest)

Use scp to copy a file, directory, or list

cpexec(host, source[, args, dest, interpreter, ...])

Copy a file to a remote host, then execute and delete the remote copy

Package Contents

progfiguration.remotebrute.generate_random_string(length)

Generate a secure random string of the specified length.

progfiguration.remotebrute.scp(host: str, sources: str | List[str], dest: str)

Use scp to copy a file, directory, or list

progfiguration.remotebrute.cpexec(host: str, source: str, args: List[str] | None = None, dest: str = '', interpreter: List[str] | None = None, ssh_tty: bool = True, ssh_stdin: Any = None, keep_remote_file: bool = False)

Copy a file to a remote host, then execute and delete the remote copy

host: the remote host to connect to source: the local file to copy args: arguments to pass to the command dest: the destination path on the remote host. If not specified, a random name will be generated. interpreter: arguments to prepend to the command, like [“python3”] or [“python3”, “-u”] ssh_tty: whether to allocate a tty for the ssh connection ssh_stdin: a file-like object which we pass to run() as stdin (e.g. subprocess.DEVNULL) keep_remote_file: if True, the remote file will not be deleted after execution