sshmitm.plugins.sftp.replace_file module

class sshmitm.plugins.sftp.replace_file.SFTPProxyReplaceHandler(sftp, filename)

Bases: SFTPHandlerPlugin

Replaces a SFTP transmitted File during transit

Parameters:
class SFTPInterface(serverinterface)

Bases: SFTPProxyServerInterface

Parameters:

serverinterface (BaseServerInterface)

lstat(path)

Return an .SFTPAttributes object for a path on the server, or an error code. If your server supports symbolic links (also known as “aliases”), you should not follow them – instead, you should return data on the symlink or alias itself. (stat is the corresponding call that follows symlinks/aliases.)

Parameters:
  • path (str) – the requested path (relative or absolute) to fetch file statistics for.

  • path

Return type:

Union[SFTPAttributes, int]

Returns:

an .SFTPAttributes object for the given file, or an SFTP error code (like SFTP_PERMISSION_DENIED).

stat(path)

Return an .SFTPAttributes object for a path on the server, or an error code. If your server supports symbolic links (also known as “aliases”), you should follow them. (lstat is the corresponding call that doesn’t follow symlinks/aliases.)

Parameters:
  • path (str) – the requested path (relative or absolute) to fetch file statistics for.

  • path

Return type:

Union[SFTPAttributes, int]

Returns:

an .SFTPAttributes object for the given file, or an SFTP error code (like SFTP_PERMISSION_DENIED).

close()
Return type:

None

classmethod get_interface()
Return type:

Optional[Type[BaseSFTPServerInterface]]

handle_data(data, *, offset=None, length=None)
Parameters:
  • data (bytes)

  • offset (Optional[int], default: None)

  • length (Optional[int], default: None)

Return type:

bytes

classmethod parser_arguments()
Return type:

None