sshmitm.forwarders.tunnel module

class sshmitm.forwarders.tunnel.LocalPortForwardingBaseForwarder(args: Optional[Sequence[str]] = None, namespace: Optional[Namespace] = None, **kwargs: Any)

Bases: BaseModule

class sshmitm.forwarders.tunnel.LocalPortForwardingForwarder(session: Session, chanid: int, origin: Optional[Tuple[str, int]], destination: Optional[Tuple[str, int]])

Bases: TunnelForwarder, LocalPortForwardingBaseForwarder

Handles tunnel forwarding when the client is requesting a tunnel connection

Then forward traffic between direct-tcpip channels connecting to local and to remote through the ssh-mitm
  • implements Proxyjump (-W / -J) feature, client side port forwarding (-L)

run() None

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

classmethod setup(session: Session) None
class sshmitm.forwarders.tunnel.RemotePortForwardingBaseForwarder(args: Optional[Sequence[str]] = None, namespace: Optional[Namespace] = None, **kwargs: Any)

Bases: BaseModule

class sshmitm.forwarders.tunnel.RemotePortForwardingForwarder(session: Session, server_interface: ServerInterface, destination: Optional[Tuple[str, int]])

Bases: RemotePortForwardingBaseForwarder

Handles Tunnel forwarding when the server is requesting a tunnel connection

Actually just used to wrap data around a handler to parse to the transport.request_port_forward -> that is why it does not inherit the TunnelForwarder; it just uses it in the handler

close() None
handler(channel: Channel, origin: Optional[Tuple[str, int]], destination: Optional[Tuple[str, int]]) None
join() None
class sshmitm.forwarders.tunnel.TunnelForwarder(local_ch: Optional[Union[socket, Channel]], remote_ch: Optional[Union[socket, Channel]])

Bases: Thread

close() None

Comparable with Channels and Sockets

close_channel(channel: Union[socket, Channel]) None
handle_data(data: bytes) bytes
handle_data_from_local(data: bytes) bytes
handle_data_from_remote(data: bytes) bytes
run() None

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

tunnel(chunk_size: int = 1024) None

Connect two SSH channels (socket like objects).