diff --git a/tests/pytype_exclude_list.txt b/tests/pytype_exclude_list.txt index 750bff1d8..76064deea 100644 --- a/tests/pytype_exclude_list.txt +++ b/tests/pytype_exclude_list.txt @@ -15,6 +15,8 @@ third_party/2and3/attr/__init__.pyi third_party/2and3/attr/converters.pyi third_party/2and3/attr/filters.pyi third_party/2and3/attr/validators.pyi +third_party/2and3/paramiko/_winapi.pyi +third_party/2and3/paramiko/win_pageant.pyi third_party/2and3/pynamodb/models.pyi # _pb2.pyi have some constructs that break pytype diff --git a/third_party/2and3/paramiko/__init__.pyi b/third_party/2and3/paramiko/__init__.pyi new file mode 100644 index 000000000..f3e67d07f --- /dev/null +++ b/third_party/2and3/paramiko/__init__.pyi @@ -0,0 +1,41 @@ +from paramiko.agent import Agent as Agent, AgentKey as AgentKey +from paramiko.channel import Channel as Channel +from paramiko.client import ( + AutoAddPolicy as AutoAddPolicy, + MissingHostKeyPolicy as MissingHostKeyPolicy, + RejectPolicy as RejectPolicy, + SSHClient as SSHClient, + WarningPolicy as WarningPolicy, +) +from paramiko.common import io_sleep as io_sleep +from paramiko.config import SSHConfig as SSHConfig +from paramiko.dsskey import DSSKey as DSSKey +from paramiko.ecdsakey import ECDSAKey as ECDSAKey +from paramiko.ed25519key import Ed25519Key as Ed25519Key +from paramiko.file import BufferedFile as BufferedFile +from paramiko.hostkeys import HostKeys as HostKeys +from paramiko.message import Message as Message +from paramiko.pkey import PKey as PKey +from paramiko.proxy import ProxyCommand as ProxyCommand +from paramiko.rsakey import RSAKey as RSAKey +from paramiko.server import ServerInterface as ServerInterface, SubsystemHandler as SubsystemHandler +from paramiko.sftp import SFTPError as SFTPError +from paramiko.sftp_attr import SFTPAttributes as SFTPAttributes +from paramiko.sftp_client import SFTP as SFTP, SFTPClient as SFTPClient +from paramiko.sftp_file import SFTPFile as SFTPFile +from paramiko.sftp_handle import SFTPHandle as SFTPHandle +from paramiko.sftp_server import SFTPServer as SFTPServer +from paramiko.sftp_si import SFTPServerInterface as SFTPServerInterface +from paramiko.ssh_exception import ( + AuthenticationException as AuthenticationException, + BadAuthenticationType as BadAuthenticationType, + BadHostKeyException as BadHostKeyException, + ChannelException as ChannelException, + PasswordRequiredException as PasswordRequiredException, + ProxyCommandFailure as ProxyCommandFailure, + SSHException as SSHException, +) +from paramiko.transport import SecurityOptions as SecurityOptions, Transport as Transport + +# Names in __all__ with no definition: +# util diff --git a/third_party/2and3/paramiko/_version.pyi b/third_party/2and3/paramiko/_version.pyi new file mode 100644 index 000000000..e75b91463 --- /dev/null +++ b/third_party/2and3/paramiko/_version.pyi @@ -0,0 +1,3 @@ +from typing import Tuple + +__version_info__: Tuple[int, int, int] diff --git a/third_party/2and3/paramiko/_winapi.pyi b/third_party/2and3/paramiko/_winapi.pyi new file mode 100644 index 000000000..a8277fb14 --- /dev/null +++ b/third_party/2and3/paramiko/_winapi.pyi @@ -0,0 +1,97 @@ +import builtins +import ctypes.wintypes +import sys +from types import TracebackType +from typing import Any, Optional, Type, TypeVar + +assert sys.platform == "win32" + +_T = TypeVar("_T") + +def format_system_message(errno: int) -> Optional[str]: ... + +class WindowsError(builtins.WindowsError): + def __init__(self, value: Optional[int] = ...) -> None: ... + @property + def message(self) -> str: ... + @property + def code(self) -> int: ... + +def handle_nonzero_success(result: int) -> None: ... + +GMEM_MOVEABLE: int +GlobalAlloc: Any +GlobalLock: Any +GlobalUnlock: Any +GlobalSize: Any +CreateFileMapping: Any +MapViewOfFile: Any +UnmapViewOfFile: Any +RtlMoveMemory: Any + +class MemoryMap: + name: str + length: int + security_attributes: Any = ... + pos: int + filemap: Any = ... + view: Any = ... + def __init__(self, name: str, length: int, security_attributes: Optional[Any] = ...) -> None: ... + def __enter__(self: _T) -> _T: ... + def seek(self, pos: int) -> None: ... + def write(self, msg: bytes) -> None: ... + def read(self, n: int) -> bytes: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], tb: Optional[TracebackType] + ) -> None: ... + +READ_CONTROL: int +STANDARD_RIGHTS_REQUIRED: int +STANDARD_RIGHTS_READ: int +STANDARD_RIGHTS_WRITE: int +STANDARD_RIGHTS_EXECUTE: int +STANDARD_RIGHTS_ALL: int +POLICY_VIEW_LOCAL_INFORMATION: int +POLICY_VIEW_AUDIT_INFORMATION: int +POLICY_GET_PRIVATE_INFORMATION: int +POLICY_TRUST_ADMIN: int +POLICY_CREATE_ACCOUNT: int +POLICY_CREATE_SECRET: int +POLICY_CREATE_PRIVILEGE: int +POLICY_SET_DEFAULT_QUOTA_LIMITS: int +POLICY_SET_AUDIT_REQUIREMENTS: int +POLICY_AUDIT_LOG_ADMIN: int +POLICY_SERVER_ADMIN: int +POLICY_LOOKUP_NAMES: int +POLICY_NOTIFICATION: int +POLICY_ALL_ACCESS: int +POLICY_READ: int +POLICY_WRITE: int +POLICY_EXECUTE: int + +class TokenAccess: + TOKEN_QUERY: int + +class TokenInformationClass: + TokenUser: int + +class TOKEN_USER(ctypes.Structure): + num: int + +class SECURITY_DESCRIPTOR(ctypes.Structure): + SECURITY_DESCRIPTOR_CONTROL: Any + REVISION: int + +class SECURITY_ATTRIBUTES(ctypes.Structure): + nLength: int + lpSecurityDescriptor: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + @property + def descriptor(self) -> Any: ... + @descriptor.setter + def descriptor(self, value: Any) -> None: ... + +def GetTokenInformation(token: Any, information_class: Any) -> Any: ... +def OpenProcessToken(proc_handle: Any, access: Any) -> Any: ... +def get_current_user() -> TOKEN_USER: ... +def get_security_attributes_for_user(user: Optional[TOKEN_USER] = ...) -> SECURITY_ATTRIBUTES: ... diff --git a/third_party/2and3/paramiko/agent.pyi b/third_party/2and3/paramiko/agent.pyi new file mode 100644 index 000000000..3d5aa4bc6 --- /dev/null +++ b/third_party/2and3/paramiko/agent.pyi @@ -0,0 +1,67 @@ +from socket import _RetAddress, socket +from threading import Thread +from typing import Dict, Protocol, Tuple + +from paramiko.channel import Channel +from paramiko.message import Message +from paramiko.pkey import PKey +from paramiko.transport import Transport + +class _AgentProxy(Protocol): + def connect(self) -> None: ... + def close(self) -> None: ... + +cSSH2_AGENTC_REQUEST_IDENTITIES: bytes +SSH2_AGENT_IDENTITIES_ANSWER: int +cSSH2_AGENTC_SIGN_REQUEST: bytes +SSH2_AGENT_SIGN_RESPONSE: int + +class AgentSSH: + def __init__(self) -> None: ... + def get_keys(self) -> Tuple[AgentKey, ...]: ... + +class AgentProxyThread(Thread): + def __init__(self, agent: _AgentProxy) -> None: ... + def run(self) -> None: ... + +class AgentLocalProxy(AgentProxyThread): + def __init__(self, agent: AgentServerProxy) -> None: ... + def get_connection(self) -> Tuple[socket, _RetAddress]: ... + +class AgentRemoteProxy(AgentProxyThread): + def __init__(self, agent: AgentClientProxy, chan: Channel) -> None: ... + def get_connection(self) -> Tuple[socket, _RetAddress]: ... + +class AgentClientProxy: + thread: Thread + def __init__(self, chanRemote: Channel) -> None: ... + def __del__(self) -> None: ... + def connect(self) -> None: ... + def close(self) -> None: ... + +class AgentServerProxy(AgentSSH): + thread: Thread + def __init__(self, t: Transport) -> None: ... + def __del__(self) -> None: ... + def connect(self) -> None: ... + def close(self) -> None: ... + def get_env(self) -> Dict[str, str]: ... + +class AgentRequestHandler: + def __init__(self, chanClient: Channel) -> None: ... + def __del__(self) -> None: ... + def close(self) -> None: ... + +class Agent(AgentSSH): + def __init__(self) -> None: ... + def close(self) -> None: ... + +class AgentKey(PKey): + agent: AgentSSH + blob: bytes + public_blob: None + name: str + def __init__(self, agent: AgentSSH, blob: bytes) -> None: ... + def asbytes(self) -> bytes: ... + def get_name(self) -> str: ... + def sign_ssh_data(self, data: bytes) -> Message: ... diff --git a/third_party/2and3/paramiko/auth_handler.pyi b/third_party/2and3/paramiko/auth_handler.pyi new file mode 100644 index 000000000..a631394bd --- /dev/null +++ b/third_party/2and3/paramiko/auth_handler.pyi @@ -0,0 +1,49 @@ +from threading import Event +from typing import Callable, List, Optional, Tuple + +from paramiko.message import Message +from paramiko.pkey import PKey +from paramiko.server import InteractiveQuery +from paramiko.ssh_gss import _SSH_GSSAuth +from paramiko.transport import Transport + +_InteractiveCallback = Callable[[str, str, List[Tuple[str, bool]]], List[str]] + +class AuthHandler: + transport: Transport + username: Optional[str] + authenticated: bool + auth_event: Optional[Event] + auth_method: str + banner: Optional[str] + password: Optional[str] + private_key: Optional[PKey] + interactive_handler: Optional[_InteractiveCallback] + submethods: Optional[str] + auth_username: Optional[str] + auth_fail_count: int + gss_host: Optional[str] + gss_deleg_creds: bool + def __init__(self, transport: Transport) -> None: ... + def is_authenticated(self) -> bool: ... + def get_username(self) -> Optional[str]: ... + def auth_none(self, username: str, event: Event) -> None: ... + def auth_publickey(self, username: str, key: PKey, event: Event) -> None: ... + def auth_password(self, username: str, password: str, event: Event) -> None: ... + def auth_interactive(self, username: str, handler: _InteractiveCallback, event: Event, submethods: str = ...) -> None: ... + def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool, event: Event) -> None: ... + def auth_gssapi_keyex(self, username: str, event: Event) -> None: ... + def abort(self) -> None: ... + def wait_for_response(self, event: Event) -> List[str]: ... + +class GssapiWithMicAuthHandler: + method: str + sshgss: _SSH_GSSAuth + def __init__(self, delegate: AuthHandler, sshgss: _SSH_GSSAuth) -> None: ... + def abort(self) -> None: ... + @property + def transport(self) -> Transport: ... + @property + def auth_username(self) -> str: ... + @property + def gss_host(self) -> str: ... diff --git a/third_party/2and3/paramiko/ber.pyi b/third_party/2and3/paramiko/ber.pyi new file mode 100644 index 000000000..700ebd161 --- /dev/null +++ b/third_party/2and3/paramiko/ber.pyi @@ -0,0 +1,17 @@ +from typing import Any, Iterable, List, Union + +class BERException(Exception): ... + +class BER: + content: bytes + idx: int + def __init__(self, content: bytes = ...) -> None: ... + def asbytes(self) -> bytes: ... + def decode(self) -> Union[None, int, List[int]]: ... + def decode_next(self) -> Union[None, int, List[int]]: ... + @staticmethod + def decode_sequence(data: bytes) -> List[Union[int, List[int]]]: ... + def encode_tlv(self, ident: int, val: bytes) -> None: ... + def encode(self, x: Any) -> None: ... + @staticmethod + def encode_sequence(data: Iterable[str]) -> bytes: ... diff --git a/third_party/2and3/paramiko/buffered_pipe.pyi b/third_party/2and3/paramiko/buffered_pipe.pyi new file mode 100644 index 000000000..e29b65de6 --- /dev/null +++ b/third_party/2and3/paramiko/buffered_pipe.pyi @@ -0,0 +1,16 @@ +from threading import Event +from typing import Generic, Optional, Text, TypeVar + +_T = TypeVar("_T", Text, bytes) + +class PipeTimeout(IOError): ... + +class BufferedPipe(Generic[_T]): + def __init__(self) -> None: ... + def set_event(self, event: Event) -> None: ... + def feed(self, data: _T) -> None: ... + def read_ready(self) -> bool: ... + def read(self, nbytes: int, timeout: Optional[float] = ...) -> _T: ... + def empty(self) -> _T: ... + def close(self) -> None: ... + def __len__(self) -> int: ... diff --git a/third_party/2and3/paramiko/channel.pyi b/third_party/2and3/paramiko/channel.pyi new file mode 100644 index 000000000..f22a50d27 --- /dev/null +++ b/third_party/2and3/paramiko/channel.pyi @@ -0,0 +1,99 @@ +from logging import Logger +from threading import Condition, Event, Lock +from typing import Any, Callable, Mapping, Optional, Tuple, TypeVar + +from paramiko.buffered_pipe import BufferedPipe, PipeTimeout +from paramiko.file import BufferedFile +from paramiko.message import Message +from paramiko.transport import Transport +from paramiko.util import ClosingContextManager + +_F = TypeVar("_F", bound=Callable[..., Any]) + +def open_only(func: _F) -> Callable[[_F], _F]: ... + +class Channel(ClosingContextManager): + chanid: int + remote_chanid: int + transport: Optional[Transport] + active: bool + eof_received: int + eof_sent: int + in_buffer: BufferedPipe + in_stderr_buffer: BufferedPipe + timeout: Optional[float] + closed: bool + ultra_debug: bool + lock: Lock + out_buffer_cv: Condition + in_window_size: int + out_window_size: int + in_max_packet_size: int + out_max_packet_size: int + in_window_threshold: int + in_window_sofar: int + status_event: Event + logger: Logger + event: Event + event_ready: bool + combine_stderr: bool + exit_status: int + origin_addr: None + def __init__(self, chanid: int) -> None: ... + def __del__(self) -> None: ... + def get_pty( + self, term: str = ..., width: int = ..., height: int = ..., width_pixels: int = ..., height_pixels: int = ... + ) -> None: ... + def invoke_shell(self) -> None: ... + def exec_command(self, command: str) -> None: ... + def invoke_subsystem(self, subsystem: str) -> None: ... + def resize_pty(self, width: int = ..., height: int = ..., width_pixels: int = ..., height_pixels: int = ...) -> None: ... + def update_environment(self, environment: Mapping[str, str]) -> None: ... + def set_environment_variable(self, name: str, value: str) -> None: ... + def exit_status_ready(self) -> bool: ... + def recv_exit_status(self) -> int: ... + def send_exit_status(self, status: int) -> None: ... + def request_x11( + self, + screen_number: int = ..., + auth_protocol: Optional[str] = ..., + auth_cookie: Optional[str] = ..., + single_connection: bool = ..., + handler: Optional[Callable[[Channel, Tuple[str, int]], None]] = ..., + ) -> bytes: ... + def request_forward_agent(self, handler: Callable[[Channel], None]) -> bool: ... + def get_transport(self) -> Transport: ... + def set_name(self, name: str) -> None: ... + def get_name(self) -> str: ... + def get_id(self) -> int: ... + def set_combine_stderr(self, combine: bool) -> bool: ... + def settimeout(self, timeout: Optional[float]) -> None: ... + def gettimeout(self) -> Optional[float]: ... + def setblocking(self, blocking: bool) -> None: ... + def getpeername(self) -> str: ... + def close(self) -> None: ... + def recv_ready(self) -> bool: ... + def recv(self, nbytes: int) -> bytes: ... + def recv_stderr_ready(self) -> bool: ... + def recv_stderr(self, nbytes: int) -> bytes: ... + def send_ready(self) -> bool: ... + def send(self, s: bytes) -> int: ... + def send_stderr(self, s: bytes) -> int: ... + def sendall(self, s: bytes) -> None: ... + def sendall_stderr(self, s: bytes) -> None: ... + def makefile(self, *params: Any) -> ChannelFile: ... + def makefile_stderr(self, *params: Any) -> ChannelStderrFile: ... + def makefile_stdin(self, *params: Any) -> ChannelStdinFile: ... + def fileno(self) -> int: ... + def shutdown(self, how: int) -> None: ... + def shutdown_read(self) -> None: ... + def shutdown_write(self) -> None: ... + +class ChannelFile(BufferedFile): + channel: Channel + def __init__(self, channel: Channel, mode: str = ..., bufsize: int = ...) -> None: ... + +class ChannelStderrFile(ChannelFile): ... + +class ChannelStdinFile(ChannelFile): + def close(self) -> None: ... diff --git a/third_party/2and3/paramiko/client.pyi b/third_party/2and3/paramiko/client.pyi new file mode 100644 index 000000000..486e5a4c3 --- /dev/null +++ b/third_party/2and3/paramiko/client.pyi @@ -0,0 +1,74 @@ +from socket import socket +from typing import Any, Dict, Iterable, Mapping, NoReturn, Optional, Tuple, Type, Union + +from paramiko.agent import Agent +from paramiko.channel import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile +from paramiko.hostkeys import HostKeys +from paramiko.pkey import PKey +from paramiko.sftp_client import SFTPClient +from paramiko.transport import Transport +from paramiko.util import ClosingContextManager + +class SSHClient(ClosingContextManager): + def __init__(self) -> None: ... + def load_system_host_keys(self, filename: Optional[str] = ...) -> None: ... + def load_host_keys(self, filename: str) -> None: ... + def save_host_keys(self, filename: str) -> None: ... + def get_host_keys(self) -> HostKeys: ... + def set_log_channel(self, name: str) -> None: ... + def set_missing_host_key_policy(self, policy: Union[Type[MissingHostKeyPolicy], MissingHostKeyPolicy]) -> None: ... + def connect( + self, + hostname: str, + port: int = ..., + username: Optional[str] = ..., + password: Optional[str] = ..., + pkey: Optional[PKey] = ..., + key_filename: Optional[str] = ..., + timeout: Optional[float] = ..., + allow_agent: bool = ..., + look_for_keys: bool = ..., + compress: bool = ..., + sock: Optional[socket] = ..., + gss_auth: bool = ..., + gss_kex: bool = ..., + gss_deleg_creds: bool = ..., + gss_host: Optional[str] = ..., + banner_timeout: Optional[float] = ..., + auth_timeout: Optional[float] = ..., + gss_trust_dns: bool = ..., + passphrase: Optional[str] = ..., + disabled_algorithms: Optional[Dict[str, Iterable[str]]] = ..., + ) -> None: ... + def close(self) -> None: ... + def exec_command( + self, + command: str, + bufsize: int = ..., + timeout: Optional[float] = ..., + get_pty: bool = ..., + environment: Optional[Dict[str, str]] = ..., + ) -> Tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]: ... + def invoke_shell( + self, + term: str = ..., + width: int = ..., + height: int = ..., + width_pixels: int = ..., + height_pixels: int = ..., + environment: Optional[Mapping[str, str]] = ..., + ) -> Channel: ... + def open_sftp(self) -> Optional[SFTPClient]: ... + def get_transport(self) -> Optional[Transport]: ... + +class MissingHostKeyPolicy: + def missing_host_key(self, client: SSHClient, hostname: str, key: PKey) -> None: ... + +class AutoAddPolicy(MissingHostKeyPolicy): + def missing_host_key(self, client: SSHClient, hostname: str, key: PKey) -> None: ... + +class RejectPolicy(MissingHostKeyPolicy): + def missing_host_key(self, client: SSHClient, hostname: str, key: PKey) -> NoReturn: ... + +class WarningPolicy(MissingHostKeyPolicy): + def missing_host_key(self, client: SSHClient, hostname: str, key: PKey) -> None: ... diff --git a/third_party/2and3/paramiko/common.pyi b/third_party/2and3/paramiko/common.pyi new file mode 100644 index 000000000..40855b4b7 --- /dev/null +++ b/third_party/2and3/paramiko/common.pyi @@ -0,0 +1,139 @@ +import sys +from typing import Any, Dict, Protocol, Text, Union + +MSG_DISCONNECT: int +MSG_IGNORE: int +MSG_UNIMPLEMENTED: int +MSG_DEBUG: int +MSG_SERVICE_REQUEST: int +MSG_SERVICE_ACCEPT: int +MSG_KEXINIT: int +MSG_NEWKEYS: int +MSG_USERAUTH_REQUEST: int +MSG_USERAUTH_FAILURE: int +MSG_USERAUTH_SUCCESS: int +MSG_USERAUTH_BANNER: int +MSG_USERAUTH_PK_OK: int +MSG_USERAUTH_INFO_REQUEST: int +MSG_USERAUTH_INFO_RESPONSE: int +MSG_USERAUTH_GSSAPI_RESPONSE: int +MSG_USERAUTH_GSSAPI_TOKEN: int +MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE: int +MSG_USERAUTH_GSSAPI_ERROR: int +MSG_USERAUTH_GSSAPI_ERRTOK: int +MSG_USERAUTH_GSSAPI_MIC: int +HIGHEST_USERAUTH_MESSAGE_ID: int +MSG_GLOBAL_REQUEST: int +MSG_REQUEST_SUCCESS: int +MSG_REQUEST_FAILURE: int +MSG_CHANNEL_OPEN: int +MSG_CHANNEL_OPEN_SUCCESS: int +MSG_CHANNEL_OPEN_FAILURE: int +MSG_CHANNEL_WINDOW_ADJUST: int +MSG_CHANNEL_DATA: int +MSG_CHANNEL_EXTENDED_DATA: int +MSG_CHANNEL_EOF: int +MSG_CHANNEL_CLOSE: int +MSG_CHANNEL_REQUEST: int +MSG_CHANNEL_SUCCESS: int +MSG_CHANNEL_FAILURE: int + +cMSG_DISCONNECT: bytes +cMSG_IGNORE: bytes +cMSG_UNIMPLEMENTED: bytes +cMSG_DEBUG: bytes +cMSG_SERVICE_REQUEST: bytes +cMSG_SERVICE_ACCEPT: bytes +cMSG_KEXINIT: bytes +cMSG_NEWKEYS: bytes +cMSG_USERAUTH_REQUEST: bytes +cMSG_USERAUTH_FAILURE: bytes +cMSG_USERAUTH_SUCCESS: bytes +cMSG_USERAUTH_BANNER: bytes +cMSG_USERAUTH_PK_OK: bytes +cMSG_USERAUTH_INFO_REQUEST: bytes +cMSG_USERAUTH_INFO_RESPONSE: bytes +cMSG_USERAUTH_GSSAPI_RESPONSE: bytes +cMSG_USERAUTH_GSSAPI_TOKEN: bytes +cMSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE: bytes +cMSG_USERAUTH_GSSAPI_ERROR: bytes +cMSG_USERAUTH_GSSAPI_ERRTOK: bytes +cMSG_USERAUTH_GSSAPI_MIC: bytes +cMSG_GLOBAL_REQUEST: bytes +cMSG_REQUEST_SUCCESS: bytes +cMSG_REQUEST_FAILURE: bytes +cMSG_CHANNEL_OPEN: bytes +cMSG_CHANNEL_OPEN_SUCCESS: bytes +cMSG_CHANNEL_OPEN_FAILURE: bytes +cMSG_CHANNEL_WINDOW_ADJUST: bytes +cMSG_CHANNEL_DATA: bytes +cMSG_CHANNEL_EXTENDED_DATA: bytes +cMSG_CHANNEL_EOF: bytes +cMSG_CHANNEL_CLOSE: bytes +cMSG_CHANNEL_REQUEST: bytes +cMSG_CHANNEL_SUCCESS: bytes +cMSG_CHANNEL_FAILURE: bytes + +MSG_NAMES: Dict[int, str] + +AUTH_SUCCESSFUL: int +AUTH_PARTIALLY_SUCCESSFUL: int +AUTH_FAILED: int + +OPEN_SUCCEEDED: int +OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED: int +OPEN_FAILED_CONNECT_FAILED: int +OPEN_FAILED_UNKNOWN_CHANNEL_TYPE: int +OPEN_FAILED_RESOURCE_SHORTAGE: int + +CONNECTION_FAILED_CODE: Dict[int, str] + +DISCONNECT_SERVICE_NOT_AVAILABLE: int +DISCONNECT_AUTH_CANCELLED_BY_USER: int +DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE: int + +zero_byte: bytes +one_byte: bytes +four_byte: bytes +max_byte: bytes +cr_byte: bytes +linefeed_byte: bytes +crlf: bytes +if sys.version_info < (3, 0): + cr_byte_value: bytes + linefeed_byte_value: bytes +else: + cr_byte_value: int + linefeed_byte_value: int + +class _SupportsAsBytes(Protocol): + def asbytes(self) -> bytes: ... + +_LikeBytes = Union[bytes, Text, _SupportsAsBytes] + +def asbytes(s: _LikeBytes) -> bytes: ... + +xffffffff: int +x80000000: int +o666: int +o660: int +o644: int +o600: int +o777: int +o700: int +o70: int + +DEBUG: int +INFO: int +WARNING: int +ERROR: int +CRITICAL: int + +io_sleep: float + +DEFAULT_WINDOW_SIZE: int +DEFAULT_MAX_PACKET_SIZE: int + +MIN_WINDOW_SIZE: int +MIN_PACKET_SIZE: int +MAX_WINDOW_SIZE: int diff --git a/third_party/2and3/paramiko/compress.pyi b/third_party/2and3/paramiko/compress.pyi new file mode 100644 index 000000000..da0394797 --- /dev/null +++ b/third_party/2and3/paramiko/compress.pyi @@ -0,0 +1,11 @@ +from zlib import _Compress, _Decompress + +class ZlibCompressor: + z: _Compress + def __init__(self) -> None: ... + def __call__(self, data: bytes) -> bytes: ... + +class ZlibDecompressor: + z: _Decompress + def __init__(self) -> None: ... + def __call__(self, data: bytes) -> bytes: ... diff --git a/third_party/2and3/paramiko/config.pyi b/third_party/2and3/paramiko/config.pyi new file mode 100644 index 000000000..5367be430 --- /dev/null +++ b/third_party/2and3/paramiko/config.pyi @@ -0,0 +1,31 @@ +from typing import IO, Any, Dict, Iterable, List, Optional, Pattern, Set + +from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize + +SSH_PORT: int + +class SSHConfig: + SETTINGS_REGEX: Pattern[str] + TOKENS_BY_CONFIG_KEY: Dict[str, List[str]] + def __init__(self) -> None: ... + @classmethod + def from_text(cls, text: str) -> SSHConfig: ... + @classmethod + def from_path(cls, path: str) -> SSHConfig: ... + @classmethod + def from_file(cls, flo: IO[str]) -> SSHConfig: ... + def parse(self, file_obj: IO[str]) -> None: ... + def lookup(self, hostname: str) -> SSHConfigDict: ... + def canonicalize(self, hostname: str, options: SSHConfigDict, domains: Iterable[str]) -> str: ... + def get_hostnames(self) -> Set[str]: ... + +class LazyFqdn: + fqdn: Optional[str] + config: SSHConfig + host: Optional[str] + def __init__(self, config: SSHConfigDict, host: Optional[str] = ...) -> None: ... + +class SSHConfigDict(Dict[str, str]): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def as_bool(self, key: str) -> bool: ... + def as_int(self, key: str) -> int: ... diff --git a/third_party/2and3/paramiko/dsskey.pyi b/third_party/2and3/paramiko/dsskey.pyi new file mode 100644 index 000000000..915087727 --- /dev/null +++ b/third_party/2and3/paramiko/dsskey.pyi @@ -0,0 +1,34 @@ +from typing import IO, Any, Callable, Optional, Tuple + +from paramiko.ber import BER +from paramiko.message import Message +from paramiko.pkey import PKey, PublicBlob + +class DSSKey(PKey): + p: Optional[int] + q: Optional[int] + g: Optional[int] + y: Optional[int] + x: Optional[int] + public_blob: None + size: int + def __init__( + self, + msg: Optional[Message] = ..., + data: Optional[bytes] = ..., + filename: Optional[str] = ..., + password: Optional[str] = ..., + vals: Optional[Tuple[int, int, int, int]] = ..., + file_obj: Optional[IO[str]] = ..., + ) -> None: ... + def asbytes(self) -> bytes: ... + def __hash__(self) -> int: ... + def get_name(self) -> str: ... + def get_bits(self) -> int: ... + def can_sign(self) -> bool: ... + def sign_ssh_data(self, data: bytes) -> Message: ... + def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... + def write_private_key_file(self, filename: str, password: Optional[str] = ...) -> None: ... + def write_private_key(self, file_obj: IO[str], password: Optional[str] = ...) -> None: ... + @staticmethod + def generate(bits: int = ..., progress_func: Optional[Callable[..., Any]] = ...) -> DSSKey: ... diff --git a/third_party/2and3/paramiko/ecdsakey.pyi b/third_party/2and3/paramiko/ecdsakey.pyi new file mode 100644 index 000000000..d53632528 --- /dev/null +++ b/third_party/2and3/paramiko/ecdsakey.pyi @@ -0,0 +1,53 @@ +from typing import IO, Any, Callable, List, Optional, Sequence, Tuple, Type + +from cryptography.hazmat.primitives.asymmetric.ec2 import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey +from cryptography.hazmat.primitives.hashes import HashAlgorithm +from paramiko.message import Message +from paramiko.pkey import PKey + +class _ECDSACurve: + nist_name: str + key_length: int + key_format_identifier: str + hash_object: Type[HashAlgorithm] + curve_class: Type[EllipticCurve] + def __init__(self, curve_class: Type[EllipticCurve], nist_name: str) -> None: ... + +class _ECDSACurveSet: + ecdsa_curves: Sequence[_ECDSACurve] + def __init__(self, ecdsa_curves: Sequence[_ECDSACurve]) -> None: ... + def get_key_format_identifier_list(self) -> List[str]: ... + def get_by_curve_class(self, curve_class: Type[Any]) -> Optional[_ECDSACurve]: ... + def get_by_key_format_identifier(self, key_format_identifier: str) -> Optional[_ECDSACurve]: ... + def get_by_key_length(self, key_length: int) -> Optional[_ECDSACurve]: ... + +class ECDSAKey(PKey): + verifying_key: EllipticCurvePublicKey + signing_key: EllipticCurvePrivateKey + public_blob: None + ecdsa_curve: Optional[_ECDSACurve] + def __init__( + self, + msg: Optional[Message] = ..., + data: Optional[bytes] = ..., + filename: Optional[str] = ..., + password: Optional[str] = ..., + vals: Optional[Tuple[EllipticCurvePrivateKey, EllipticCurvePublicKey]] = ..., + file_obj: Optional[IO[str]] = ..., + validate_point: bool = ..., + ) -> None: ... + @classmethod + def supported_key_format_identifiers(cls: Any) -> List[str]: ... + def asbytes(self) -> bytes: ... + def __hash__(self) -> int: ... + def get_name(self) -> str: ... + def get_bits(self) -> int: ... + def can_sign(self) -> bool: ... + def sign_ssh_data(self, data: bytes) -> Message: ... + def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... + def write_private_key_file(self, filename: str, password: Optional[str] = ...) -> None: ... + def write_private_key(self, file_obj: IO[str], password: Optional[str] = ...) -> None: ... + @classmethod + def generate( + cls, curve: EllipticCurve = ..., progress_func: Optional[Callable[..., Any]] = ..., bits: Optional[int] = ... + ) -> ECDSAKey: ... diff --git a/third_party/2and3/paramiko/ed25519key.pyi b/third_party/2and3/paramiko/ed25519key.pyi new file mode 100644 index 000000000..9a72dbf2d --- /dev/null +++ b/third_party/2and3/paramiko/ed25519key.pyi @@ -0,0 +1,22 @@ +from typing import IO, Any, Optional + +from paramiko.message import Message +from paramiko.pkey import PKey + +class Ed25519Key(PKey): + public_blob: None + def __init__( + self, + msg: Optional[Message] = ..., + data: Optional[bytes] = ..., + filename: Optional[str] = ..., + password: Optional[str] = ..., + file_obj: Optional[IO[str]] = ..., + ) -> None: ... + def asbytes(self) -> bytes: ... + def __hash__(self) -> int: ... + def get_name(self) -> str: ... + def get_bits(self) -> int: ... + def can_sign(self) -> bool: ... + def sign_ssh_data(self, data: bytes) -> Message: ... + def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... diff --git a/third_party/2and3/paramiko/file.pyi b/third_party/2and3/paramiko/file.pyi new file mode 100644 index 000000000..112b38d83 --- /dev/null +++ b/third_party/2and3/paramiko/file.pyi @@ -0,0 +1,38 @@ +from typing import AnyStr, Generic, Iterable, List, Optional, Tuple, Union + +from paramiko.util import ClosingContextManager + +class BufferedFile(ClosingContextManager, Generic[AnyStr]): + SEEK_SET: int + SEEK_CUR: int + SEEK_END: int + + FLAG_READ: int + FLAG_WRITE: int + FLAG_APPEND: int + FLAG_BINARY: int + FLAG_BUFFERED: int + FLAG_LINE_BUFFERED: int + FLAG_UNIVERSAL_NEWLINE: int + + newlines: Union[None, AnyStr, Tuple[AnyStr, ...]] + def __init__(self) -> None: ... + def __del__(self) -> None: ... + def __iter__(self) -> BufferedFile: ... + def close(self) -> None: ... + def flush(self) -> None: ... + def __next__(self) -> AnyStr: ... + def readable(self) -> bool: ... + def writable(self) -> bool: ... + def seekable(self) -> bool: ... + def readinto(self, buff: bytearray) -> int: ... + def read(self, size: Optional[int] = ...) -> AnyStr: ... + def readline(self, size: Optional[int] = ...) -> AnyStr: ... + def readlines(self, sizehint: Optional[int] = ...) -> List[AnyStr]: ... + def seek(self, offset: int, whence: int = ...) -> None: ... + def tell(self) -> int: ... + def write(self, data: AnyStr) -> None: ... + def writelines(self, sequence: Iterable[AnyStr]) -> None: ... + def xreadlines(self) -> BufferedFile: ... + @property + def closed(self) -> bool: ... diff --git a/third_party/2and3/paramiko/hostkeys.pyi b/third_party/2and3/paramiko/hostkeys.pyi new file mode 100644 index 000000000..f0cd193b5 --- /dev/null +++ b/third_party/2and3/paramiko/hostkeys.pyi @@ -0,0 +1,47 @@ +import collections +import typing +from typing import Dict, Iterator, List, Optional + +from paramiko.pkey import PKey + +class _SubDict(typing.MutableMapping[str, PKey]): + # Internal to HostKeys.lookup() + def __init__(self, hostname: str, entries: List[HostKeyEntry], hostkeys: HostKeys) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + def __delitem__(self, key: str) -> None: ... + def __getitem__(self, key: str) -> PKey: ... + def __setitem__(self, key: str, val: PKey) -> None: ... + def keys(self) -> List[str]: ... # type: ignore + +class HostKeys(collections.MutableMapping): + def __init__(self, filename: Optional[str] = ...) -> None: ... + def add(self, hostname: str, keytype: str, key: PKey) -> None: ... + def load(self, filename: str) -> None: ... + def save(self, filename: str) -> None: ... + def lookup(self, hostname: str) -> Optional[_SubDict]: ... + def check(self, hostname: str, key: PKey) -> bool: ... + def clear(self) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + def __getitem__(self, key: str) -> _SubDict: ... + def __delitem__(self, key: str) -> None: ... + def __setitem__(self, hostname: str, entry: Dict[str, PKey]) -> None: ... + def keys(self) -> List[str]: ... # type: ignore + def values(self) -> List[_SubDict]: ... # type: ignore + @staticmethod + def hash_host(hostname: str, salt: Optional[str] = ...) -> str: ... + +class InvalidHostKey(Exception): + line: str + exc: Exception + def __init__(self, line: str, exc: Exception) -> None: ... + +class HostKeyEntry: + valid: bool + hostnames: str + key: PKey + def __init__(self, hostnames: Optional[List[str]] = ..., key: Optional[PKey] = ...) -> None: ... + @classmethod + def from_line(cls, line: str, lineno: Optional[int] = ...) -> Optional[HostKeyEntry]: ... + def to_line(self) -> Optional[str]: ... diff --git a/third_party/2and3/paramiko/kex_curve25519.pyi b/third_party/2and3/paramiko/kex_curve25519.pyi new file mode 100644 index 000000000..b408c4182 --- /dev/null +++ b/third_party/2and3/paramiko/kex_curve25519.pyi @@ -0,0 +1,25 @@ +import sys +from _typeshed import ReadableBuffer as ReadableBuffer +from typing import Any, Callable, Optional + +from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey +from paramiko.message import Message +from paramiko.transport import Transport + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +c_MSG_KEXECDH_INIT: bytes +c_MSG_KEXECDH_REPLY: bytes + +class KexCurve25519: + hash_algo: Callable[[ReadableBuffer], _Hash] + transport: Transport + key: Optional[X25519PrivateKey] + def __init__(self, transport: Transport) -> None: ... + @classmethod + def is_available(cls) -> bool: ... + def start_kex(self) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... diff --git a/third_party/2and3/paramiko/kex_ecdh_nist.pyi b/third_party/2and3/paramiko/kex_ecdh_nist.pyi new file mode 100644 index 000000000..223d7d4ab --- /dev/null +++ b/third_party/2and3/paramiko/kex_ecdh_nist.pyi @@ -0,0 +1,37 @@ +import sys +from _typeshed import ReadableBuffer +from typing import Callable, Optional, Union + +from cryptography.hazmat.primitives.asymmetric.ec2 import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey +from paramiko.message import Message +from paramiko.transport import Transport + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +c_MSG_KEXECDH_INIT: bytes +c_MSG_KEXECDH_REPLY: bytes + +class KexNistp256: + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] + curve: EllipticCurve + transport: Transport + P: Union[int, EllipticCurvePrivateKey] + Q_C: Optional[EllipticCurvePublicKey] + Q_S: Optional[EllipticCurvePublicKey] + def __init__(self, transport: Transport) -> None: ... + def start_kex(self) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... + +class KexNistp384(KexNistp256): + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] + curve: EllipticCurve + +class KexNistp521(KexNistp256): + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] + curve: EllipticCurve diff --git a/third_party/2and3/paramiko/kex_gex.pyi b/third_party/2and3/paramiko/kex_gex.pyi new file mode 100644 index 000000000..50bb4e4a3 --- /dev/null +++ b/third_party/2and3/paramiko/kex_gex.pyi @@ -0,0 +1,39 @@ +import sys +from _typeshed import ReadableBuffer +from typing import Callable, Optional + +from paramiko.message import Message +from paramiko.transport import Transport + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +c_MSG_KEXDH_GEX_REQUEST_OLD: bytes +c_MSG_KEXDH_GEX_GROUP: bytes +c_MSG_KEXDH_GEX_INIT: bytes +c_MSG_KEXDH_GEX_REPLY: bytes +c_MSG_KEXDH_GEX_REQUEST: bytes + +class KexGex: + name: str + min_bits: int + max_bits: int + preferred_bits: int + hash_algo: Callable[[ReadableBuffer], _Hash] = ... + transport: Transport + p: Optional[int] + q: Optional[int] + g: Optional[int] + x: Optional[int] + e: Optional[int] + f: Optional[int] + old_style: bool + def __init__(self, transport: Transport) -> None: ... + def start_kex(self, _test_old_style: bool = ...) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... + +class KexGexSHA256(KexGex): + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] = ... diff --git a/third_party/2and3/paramiko/kex_group1.pyi b/third_party/2and3/paramiko/kex_group1.pyi new file mode 100644 index 000000000..8bdbe1384 --- /dev/null +++ b/third_party/2and3/paramiko/kex_group1.pyi @@ -0,0 +1,29 @@ +import sys +from _typeshed import ReadableBuffer +from typing import Callable + +from paramiko.message import Message +from paramiko.transport import Transport + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +c_MSG_KEXDH_INIT: bytes +c_MSG_KEXDH_REPLY: bytes +b7fffffffffffffff: bytes +b0000000000000000: bytes + +class KexGroup1: + P: int + G: int + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] + transport: Transport + x: int + e: int + f: int + def __init__(self, transport: Transport) -> None: ... + def start_kex(self) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... diff --git a/third_party/2and3/paramiko/kex_group14.pyi b/third_party/2and3/paramiko/kex_group14.pyi new file mode 100644 index 000000000..beaf4b4cc --- /dev/null +++ b/third_party/2and3/paramiko/kex_group14.pyi @@ -0,0 +1,20 @@ +import sys +from _typeshed import ReadableBuffer +from typing import Callable + +from paramiko.kex_group1 import KexGroup1 as KexGroup1 + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +class KexGroup14(KexGroup1): + P: int + G: int + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] + +class KexGroup14SHA256(KexGroup14): + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] diff --git a/third_party/2and3/paramiko/kex_group16.pyi b/third_party/2and3/paramiko/kex_group16.pyi new file mode 100644 index 000000000..b495410c9 --- /dev/null +++ b/third_party/2and3/paramiko/kex_group16.pyi @@ -0,0 +1,16 @@ +import sys +from _typeshed import ReadableBuffer +from typing import Callable + +from paramiko.kex_group1 import KexGroup1 as KexGroup1 + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +class KexGroup16SHA512(KexGroup1): + name: str + P: int + G: int + hash_algo: Callable[[ReadableBuffer], _Hash] diff --git a/third_party/2and3/paramiko/kex_gss.pyi b/third_party/2and3/paramiko/kex_gss.pyi new file mode 100644 index 000000000..255aee3dc --- /dev/null +++ b/third_party/2and3/paramiko/kex_gss.pyi @@ -0,0 +1,66 @@ +from typing import Optional + +from paramiko.message import Message +from paramiko.ssh_gss import _SSH_GSSAuth +from paramiko.transport import Transport + +MSG_KEXGSS_INIT: int +MSG_KEXGSS_CONTINUE: int +MSG_KEXGSS_COMPLETE: int +MSG_KEXGSS_HOSTKEY: int +MSG_KEXGSS_ERROR: int +MSG_KEXGSS_GROUPREQ: int +MSG_KEXGSS_GROUP: int + +c_MSG_KEXGSS_INIT: bytes +c_MSG_KEXGSS_CONTINUE: bytes +c_MSG_KEXGSS_COMPLETE: bytes +c_MSG_KEXGSS_HOSTKEY: bytes +c_MSG_KEXGSS_ERROR: bytes +c_MSG_KEXGSS_GROUPREQ: bytes +c_MSG_KEXGSS_GROUP: bytes + +class KexGSSGroup1: + P: int + G: int + b7fffffffffffffff: bytes + b0000000000000000: bytes + NAME: str + transport: Transport + kexgss: _SSH_GSSAuth + gss_host: Optional[str] + x: int + e: int + f: int + def __init__(self, transport: Transport) -> None: ... + def start_kex(self) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... + +class KexGSSGroup14(KexGSSGroup1): + P: int + G: int + NAME: str + +class KexGSSGex: + NAME: str + min_bits: int + max_bits: int + preferred_bits: int + transport: Transport + kexgss: _SSH_GSSAuth + gss_host: Optional[str] + p: Optional[int] + q: Optional[int] + g: Optional[int] + x: Optional[int] + e: Optional[int] + f: Optional[int] + old_style: bool + def __init__(self, transport: Transport) -> None: ... + def start_kex(self) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... + +class NullHostKey: + key: str + def __init__(self) -> None: ... + def get_name(self) -> str: ... diff --git a/third_party/2and3/paramiko/message.pyi b/third_party/2and3/paramiko/message.pyi new file mode 100644 index 000000000..49614a2b2 --- /dev/null +++ b/third_party/2and3/paramiko/message.pyi @@ -0,0 +1,42 @@ +import sys +from typing import Any, Iterable, List, Optional, Text + +from .common import _LikeBytes + +if sys.version_info < (3, 0): + from StringIO import StringIO + + BytesIO = StringIO[bytes] +else: + from io import BytesIO + +class Message: + big_int: int + packet: BytesIO + seqno: int # only when packet.Packetizer.read_message() is used + def __init__(self, content: Optional[bytes] = ...) -> None: ... + def asbytes(self) -> bytes: ... + def rewind(self) -> None: ... + def get_remainder(self) -> bytes: ... + def get_so_far(self) -> bytes: ... + def get_bytes(self, n: int) -> bytes: ... + def get_byte(self) -> bytes: ... + def get_boolean(self) -> bool: ... + def get_adaptive_int(self) -> int: ... + def get_int(self) -> int: ... + def get_int64(self) -> int: ... + def get_mpint(self) -> int: ... + def get_string(self) -> bytes: ... + def get_text(self) -> Text: ... + def get_binary(self) -> bytes: ... + def get_list(self) -> List[str]: ... + def add_bytes(self, b: bytes) -> Message: ... + def add_byte(self, b: bytes) -> Message: ... + def add_boolean(self, b: bool) -> Message: ... + def add_int(self, n: int) -> Message: ... + def add_adaptive_int(self, n: int) -> Message: ... + def add_int64(self, n: int) -> Message: ... + def add_mpint(self, z: int) -> Message: ... + def add_string(self, s: _LikeBytes) -> Message: ... + def add_list(self, l: Iterable[str]) -> Message: ... + def add(self, *seq: Any) -> None: ... diff --git a/third_party/2and3/paramiko/packet.pyi b/third_party/2and3/paramiko/packet.pyi new file mode 100644 index 000000000..fdd1e801d --- /dev/null +++ b/third_party/2and3/paramiko/packet.pyi @@ -0,0 +1,60 @@ +import sys +from logging import Logger +from socket import socket +from typing import Any, Callable, Tuple + +from cryptography.hazmat.primitives.ciphers import Cipher +from paramiko.compress import ZlibCompressor, ZlibDecompressor +from paramiko.message import Message + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +def compute_hmac(key: bytes, message: bytes, digest_class: _Hash) -> bytes: ... + +class NeedRekeyException(Exception): ... + +def first_arg(e: Exception) -> Any: ... + +class Packetizer: + REKEY_PACKETS: int + REKEY_BYTES: int + REKEY_PACKETS_OVERFLOW_MAX: int + REKEY_BYTES_OVERFLOW_MAX: int + def __init__(self, socket: socket) -> None: ... + @property + def closed(self) -> bool: ... + def set_log(self, log: Logger) -> None: ... + def set_outbound_cipher( + self, + block_engine: Cipher, + block_size: int, + mac_engine: _Hash, + mac_size: int, + mac_key: bytes, + sdctr: bool = ..., + etm: bool = ..., + ) -> None: ... + def set_inbound_cipher( + self, block_engine: Cipher, block_size: int, mac_engine: _Hash, mac_size: int, mac_key: bytes, etm: bool = ... + ) -> None: ... + def set_outbound_compressor(self, compressor: ZlibCompressor) -> None: ... + def set_inbound_compressor(self, compressor: ZlibDecompressor) -> None: ... + def close(self) -> None: ... + def set_hexdump(self, hexdump: bool) -> None: ... + def get_hexdump(self) -> bool: ... + def get_mac_size_in(self) -> int: ... + def get_mac_size_out(self) -> int: ... + def need_rekey(self) -> bool: ... + def set_keepalive(self, interval: int, callback: Callable[[], None]) -> None: ... + def read_timer(self) -> None: ... + def start_handshake(self, timeout: float) -> None: ... + def handshake_timed_out(self) -> bool: ... + def complete_handshake(self) -> None: ... + def read_all(self, n: int, check_rekey: bool = ...) -> bytes: ... + def write_all(self, out: bytes) -> None: ... + def readline(self, timeout: float) -> str: ... + def send_message(self, data: Message) -> None: ... + def read_message(self) -> Tuple[int, Message]: ... diff --git a/third_party/2and3/paramiko/pipe.pyi b/third_party/2and3/paramiko/pipe.pyi new file mode 100644 index 000000000..92bf86fa6 --- /dev/null +++ b/third_party/2and3/paramiko/pipe.pyi @@ -0,0 +1,35 @@ +from typing import Protocol, Tuple + +class _BasePipe(Protocol): + def clear(self) -> None: ... + def set(self) -> None: ... + +class _Pipe(_BasePipe, Protocol): + def close(self) -> None: ... + def fileno(self) -> int: ... + def set_forever(self) -> None: ... + +def make_pipe() -> _Pipe: ... + +class PosixPipe(object): + def __init__(self) -> None: ... + def close(self) -> None: ... + def fileno(self) -> int: ... + def clear(self) -> None: ... + def set(self) -> None: ... + def set_forever(self) -> None: ... + +class WindowsPipe(object): + def __init__(self) -> None: ... + def close(self) -> None: ... + def fileno(self) -> int: ... + def clear(self) -> None: ... + def set(self) -> None: ... + def set_forever(self) -> None: ... + +class OrPipe: + def __init__(self, pipe: _Pipe) -> None: ... + def set(self) -> None: ... + def clear(self) -> None: ... + +def make_or_pipe(pipe: _Pipe) -> Tuple[OrPipe, OrPipe]: ... diff --git a/third_party/2and3/paramiko/pkey.pyi b/third_party/2and3/paramiko/pkey.pyi new file mode 100644 index 000000000..3cbe74a93 --- /dev/null +++ b/third_party/2and3/paramiko/pkey.pyi @@ -0,0 +1,44 @@ +from typing import IO, Any, Optional, Pattern, Text, Union + +from paramiko.message import Message + +OPENSSH_AUTH_MAGIC: bytes = ... + +def _unpad_openssh(data: bytes) -> bytes: ... + +class PKey: + public_blob: Optional[PublicBlob] + BEGIN_TAG: Pattern[str] + END_TAG: Pattern[str] + def __init__(self, msg: Optional[Message] = ..., data: Optional[str] = ...) -> None: ... + def asbytes(self) -> bytes: ... + def __cmp__(self, other: object) -> int: ... + def __eq__(self, other: object) -> bool: ... + def get_name(self) -> str: ... + def get_bits(self) -> int: ... + def can_sign(self) -> bool: ... + def get_fingerprint(self) -> bytes: ... + def get_base64(self) -> str: ... + def sign_ssh_data(self, data: bytes) -> Message: ... + def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... + @classmethod + def from_private_key_file(cls: Any, filename: str, password: Optional[str] = ...) -> PKey: ... + @classmethod + def from_private_key(cls, file_obj: IO[str], password: Optional[str] = ...) -> PKey: ... + def write_private_key_file(self, filename: str, password: Optional[str] = ...) -> None: ... + def write_private_key(self, file_obj: IO[str], password: Optional[str] = ...) -> None: ... + def load_certificate(self, value: Union[Message, str]) -> None: ... + +class PublicBlob: + key_type: str + key_blob: str + comment: str + def __init__(self, type_: str, blob: bytes, comment: Optional[str] = ...) -> None: ... + @classmethod + def from_file(cls, filename: str) -> PublicBlob: ... + @classmethod + def from_string(cls, string: str) -> PublicBlob: ... + @classmethod + def from_message(cls, message: Message) -> PublicBlob: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... diff --git a/third_party/2and3/paramiko/primes.pyi b/third_party/2and3/paramiko/primes.pyi new file mode 100644 index 000000000..a8c716d41 --- /dev/null +++ b/third_party/2and3/paramiko/primes.pyi @@ -0,0 +1,8 @@ +from typing import Dict, List, Tuple + +class ModulusPack: + pack: Dict[int, List[Tuple[int, int]]] + discarded: List[Tuple[int, str]] + def __init__(self) -> None: ... + def read_file(self, filename: str) -> None: ... + def get_modulus(self, min: int, prefer: int, max: int) -> Tuple[int, int]: ... diff --git a/third_party/2and3/paramiko/proxy.pyi b/third_party/2and3/paramiko/proxy.pyi new file mode 100644 index 000000000..da57f589d --- /dev/null +++ b/third_party/2and3/paramiko/proxy.pyi @@ -0,0 +1,16 @@ +from subprocess import Popen +from typing import List, Optional + +from paramiko.util import ClosingContextManager + +class ProxyCommand(ClosingContextManager): + cmd: List[str] + process: Popen + timeout: Optional[float] + def __init__(self, command_line: str) -> None: ... + def send(self, content: bytes) -> int: ... + def recv(self, size: int) -> bytes: ... + def close(self) -> None: ... + @property + def closed(self) -> bool: ... + def settimeout(self, timeout: float) -> None: ... diff --git a/third_party/2and3/paramiko/py3compat.pyi b/third_party/2and3/paramiko/py3compat.pyi new file mode 100644 index 000000000..b9a7a9b9c --- /dev/null +++ b/third_party/2and3/paramiko/py3compat.pyi @@ -0,0 +1,41 @@ +import sys +from typing import Any, Iterable, Sequence, Text, Type, TypeVar, Union + +_T = TypeVar("_T") + +PY2: bool + +string_types: Union[Type, Sequence[Type]] +text_type: Union[Type, Sequence[Type]] +bytes_types: Union[Type, Sequence[Type]] +bytes = bytes +integer_types: Union[Type, Sequence[Type]] +long = int + +def input(prompt: Any) -> str: ... +def decodebytes(s: bytes) -> bytes: ... +def encodebytes(s: bytes) -> bytes: ... + +if sys.version_info < (3, 0): + import __builtin__ as builtins + import cStringIO + + StringIO = cStringIO.StringIO + BytesIO = StringIO +else: + import builtins as builtins + import io + + StringIO = io.StringIO + BytesIO = io.BytesIO + +def byte_ord(c: Union[int, str]) -> int: ... +def byte_chr(c: int) -> bytes: ... +def byte_mask(c: int, mask: int) -> bytes: ... +def b(s: Union[bytes, str], encoding: str = ...) -> bytes: ... +def u(s: Union[bytes, str], encoding: str = ...) -> Text: ... +def b2s(s: Union[bytes, str]) -> str: ... +def is_callable(c: Any) -> bool: ... +def next(c: Iterable[_T]) -> _T: ... + +MAXSIZE: int diff --git a/third_party/2and3/paramiko/rsakey.pyi b/third_party/2and3/paramiko/rsakey.pyi new file mode 100644 index 000000000..f0920d4a0 --- /dev/null +++ b/third_party/2and3/paramiko/rsakey.pyi @@ -0,0 +1,33 @@ +from typing import IO, Any, Callable, Optional, Union + +from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey, RSAPublicNumbers +from paramiko.message import Message +from paramiko.pkey import PKey + +class RSAKey(PKey): + key: Union[None, RSAPublicKey, RSAPrivateKey] + public_blob: None + def __init__( + self, + msg: Optional[Message] = ..., + data: Optional[bytes] = ..., + filename: Optional[str] = ..., + password: Optional[str] = ..., + key: Union[None, RSAPublicKey, RSAPrivateKey] = ..., + file_obj: Optional[IO[str]] = ..., + ) -> None: ... + @property + def size(self) -> int: ... + @property + def public_numbers(self) -> RSAPublicNumbers: ... + def asbytes(self) -> bytes: ... + def __hash__(self) -> int: ... + def get_name(self) -> str: ... + def get_bits(self) -> int: ... + def can_sign(self) -> bool: ... + def sign_ssh_data(self, data: bytes) -> Message: ... + def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... + def write_private_key_file(self, filename: str, password: Optional[str] = ...) -> None: ... + def write_private_key(self, file_obj: IO[str], password: Optional[str] = ...) -> None: ... + @staticmethod + def generate(bits: int, progress_func: Optional[Callable[..., Any]] = ...) -> RSAKey: ... diff --git a/third_party/2and3/paramiko/server.pyi b/third_party/2and3/paramiko/server.pyi new file mode 100644 index 000000000..584fb62fb --- /dev/null +++ b/third_party/2and3/paramiko/server.pyi @@ -0,0 +1,51 @@ +import threading +from typing import Any, List, Optional, Tuple, Union + +from paramiko.channel import Channel +from paramiko.message import Message +from paramiko.pkey import PKey +from paramiko.transport import Transport + +class ServerInterface: + def check_channel_request(self, kind: str, chanid: int) -> int: ... + def get_allowed_auths(self, username: str) -> str: ... + def check_auth_none(self, username: str) -> int: ... + def check_auth_password(self, username: str, password: str) -> int: ... + def check_auth_publickey(self, username: str, key: PKey) -> int: ... + def check_auth_interactive(self, username: str, submethods: str) -> Union[int, InteractiveQuery]: ... + def check_auth_interactive_response(self, responses: List[str]) -> Union[int, InteractiveQuery]: ... + def check_auth_gssapi_with_mic(self, username: str, gss_authenticated: int = ..., cc_file: Optional[str] = ...) -> int: ... + def check_auth_gssapi_keyex(self, username: str, gss_authenticated: int = ..., cc_file: Optional[str] = ...) -> int: ... + def enable_auth_gssapi(self) -> bool: ... + def check_port_forward_request(self, address: str, port: int) -> int: ... + def cancel_port_forward_request(self, address: str, port: int) -> None: ... + def check_global_request(self, kind: str, msg: Message) -> Union[bool, Tuple[Any, ...]]: ... + def check_channel_pty_request( + self, channel: Channel, term: str, width: int, height: int, pixelwidth: int, pixelheight: int, modes: str + ) -> bool: ... + def check_channel_shell_request(self, channel: Channel) -> bool: ... + def check_channel_exec_request(self, channel: Channel, command: bytes) -> bool: ... + def check_channel_subsystem_request(self, channel: Channel, name: str) -> bool: ... + def check_channel_window_change_request( + self, channel: Channel, width: int, height: int, pixelwidth: int, pixelheight: int + ) -> bool: ... + def check_channel_x11_request( + self, channel: Channel, single_connection: bool, auth_protocol: str, auth_cookie: bytes, screen_number: int + ) -> bool: ... + def check_channel_forward_agent_request(self, channel: Channel) -> bool: ... + def check_channel_direct_tcpip_request(self, chanid: int, origin: Tuple[str, int], destination: Tuple[str, int]) -> int: ... + def check_channel_env_request(self, channel: Channel, name: str, value: str) -> bool: ... + def get_banner(self) -> Tuple[Optional[str], Optional[str]]: ... + +class InteractiveQuery: + name: str + instructions: str + prompts: List[Tuple[str, bool]] + def __init__(self, name: str = ..., instructions: str = ..., *prompts: Union[str, Tuple[str, bool]]) -> None: ... + def add_prompt(self, prompt: str, echo: bool = ...) -> None: ... + +class SubsystemHandler(threading.Thread): + def __init__(self, channel: Channel, name: str, server: ServerInterface) -> None: ... + def get_server(self) -> ServerInterface: ... + def start_subsystem(self, name: str, transport: Transport, channel: Channel) -> None: ... + def finish_subsystem(self) -> None: ... diff --git a/third_party/2and3/paramiko/sftp.pyi b/third_party/2and3/paramiko/sftp.pyi new file mode 100644 index 000000000..d7a9ad7f8 --- /dev/null +++ b/third_party/2and3/paramiko/sftp.pyi @@ -0,0 +1,61 @@ +from logging import Logger +from typing import Dict, List, Optional + +from paramiko.channel import Channel + +CMD_INIT: int +CMD_VERSION: int +CMD_OPEN: int +CMD_CLOSE: int +CMD_READ: int +CMD_WRITE: int +CMD_LSTAT: int +CMD_FSTAT: int +CMD_SETSTAT: int +CMD_FSETSTAT: int +CMD_OPENDIR: int +CMD_READDIR: int +CMD_REMOVE: int +CMD_MKDIR: int +CMD_RMDIR: int +CMD_REALPATH: int +CMD_STAT: int +CMD_RENAME: int +CMD_READLINK: int +CMD_SYMLINK: int +CMD_STATUS: int +CMD_HANDLE: int +CMD_DATA: int +CMD_NAME: int +CMD_ATTRS: int +CMD_EXTENDED: int +CMD_EXTENDED_REPLY: int + +SFTP_OK: int +SFTP_EOF: int +SFTP_NO_SUCH_FILE: int +SFTP_PERMISSION_DENIED: int +SFTP_FAILURE: int +SFTP_BAD_MESSAGE: int +SFTP_NO_CONNECTION: int +SFTP_CONNECTION_LOST: int +SFTP_OP_UNSUPPORTED: int + +SFTP_DESC: List[str] + +SFTP_FLAG_READ: int +SFTP_FLAG_WRITE: int +SFTP_FLAG_APPEND: int +SFTP_FLAG_CREATE: int +SFTP_FLAG_TRUNC: int +SFTP_FLAG_EXCL: int + +CMD_NAMES: Dict[int, str] + +class SFTPError(Exception): ... + +class BaseSFTP: + logger: Logger + sock: Optional[Channel] + ultra_debug: bool + def __init__(self) -> None: ... diff --git a/third_party/2and3/paramiko/sftp_attr.pyi b/third_party/2and3/paramiko/sftp_attr.pyi new file mode 100644 index 000000000..97f534a7d --- /dev/null +++ b/third_party/2and3/paramiko/sftp_attr.pyi @@ -0,0 +1,22 @@ +from os import stat_result +from typing import Dict, Optional + +class SFTPAttributes: + FLAG_SIZE: int + FLAG_UIDGID: int + FLAG_PERMISSIONS: int + FLAG_AMTIME: int + FLAG_EXTENDED: int + st_size: Optional[int] + st_uid: Optional[int] + st_gid: Optional[int] + st_mode: Optional[int] + st_atime: Optional[int] + st_mtime: Optional[int] + filename: str # only when from_stat() is used + longname: str # only when from_stat() is used + attr: Dict[str, str] + def __init__(self) -> None: ... + @classmethod + def from_stat(cls, obj: stat_result, filename: Optional[str] = ...) -> SFTPAttributes: ... + def asbytes(self) -> bytes: ... diff --git a/third_party/2and3/paramiko/sftp_client.pyi b/third_party/2and3/paramiko/sftp_client.pyi new file mode 100644 index 000000000..26d041f8c --- /dev/null +++ b/third_party/2and3/paramiko/sftp_client.pyi @@ -0,0 +1,67 @@ +from logging import Logger +from typing import IO, Any, Callable, Iterator, List, Optional, Text, Tuple, Union + +from paramiko.channel import Channel +from paramiko.sftp import BaseSFTP +from paramiko.sftp_attr import SFTPAttributes +from paramiko.sftp_file import SFTPFile +from paramiko.transport import Transport +from paramiko.util import ClosingContextManager + +_Callback = Callable[[int, int], Any] + +b_slash: bytes + +class SFTPClient(BaseSFTP, ClosingContextManager): + sock: Channel + ultra_debug: bool + request_number: int + logger: Logger + def __init__(self, sock: Channel) -> None: ... + @classmethod + def from_transport( + cls, t: Transport, window_size: Optional[int] = ..., max_packet_size: Optional[int] = ... + ) -> Optional[SFTPClient]: ... + def close(self) -> None: ... + def get_channel(self) -> Optional[Channel]: ... + def listdir(self, path: str = ...) -> List[str]: ... + def listdir_attr(self, path: str = ...) -> List[SFTPAttributes]: ... + def listdir_iter(self, path: Union[bytes, Text] = ..., read_aheads: int = ...) -> Iterator[SFTPAttributes]: ... + def open(self, filename: Union[bytes, Text], mode: str = ..., bufsize: int = ...) -> SFTPFile: ... + file = open + def remove(self, path: Union[bytes, Text]) -> None: ... + unlink = remove + def rename(self, oldpath: Union[bytes, Text], newpath: Union[bytes, Text]) -> None: ... + def posix_rename(self, oldpath: Union[bytes, Text], newpath: Union[bytes, Text]) -> None: ... + def mkdir(self, path: Union[bytes, Text], mode: int = ...) -> None: ... + def rmdir(self, path: Union[bytes, Text]) -> None: ... + def stat(self, path: Union[bytes, Text]) -> SFTPAttributes: ... + def lstat(self, path: Union[bytes, Text]) -> SFTPAttributes: ... + def symlink(self, source: Union[bytes, Text], dest: Union[bytes, Text]) -> None: ... + def chmod(self, path: Union[bytes, Text], mode: int) -> None: ... + def chown(self, path: Union[bytes, Text], uid: int, gid: int) -> None: ... + def utime(self, path: Union[bytes, Text], times: Optional[Tuple[float, float]]) -> None: ... + def truncate(self, path: Union[bytes, Text], size: int) -> None: ... + def readlink(self, path: Union[bytes, Text]) -> Optional[Text]: ... + def normalize(self, path: Union[bytes, Text]) -> Text: ... + def chdir(self, path: Union[None, bytes, Text] = ...) -> None: ... + def getcwd(self) -> Optional[Text]: ... + def putfo( + self, + fl: IO[bytes], + remotepath: Union[bytes, Text], + file_size: int = ..., + callback: Optional[_Callback] = ..., + confirm: bool = ..., + ) -> SFTPAttributes: ... + def put( + self, + localpath: Union[bytes, Text], + remotepath: Union[bytes, Text], + callback: Optional[_Callback] = ..., + confirm: bool = ..., + ) -> SFTPAttributes: ... + def getfo(self, remotepath: Union[bytes, Text], fl: IO[bytes], callback: Optional[_Callback] = ...) -> int: ... + def get(self, remotepath: Union[bytes, Text], localpath: Union[bytes, Text], callback: Optional[_Callback] = ...) -> None: ... + +class SFTP(SFTPClient): ... diff --git a/third_party/2and3/paramiko/sftp_file.pyi b/third_party/2and3/paramiko/sftp_file.pyi new file mode 100644 index 000000000..b2f4d5fa5 --- /dev/null +++ b/third_party/2and3/paramiko/sftp_file.pyi @@ -0,0 +1,29 @@ +from typing import Iterator, Optional, Sequence, Tuple + +from paramiko.file import BufferedFile +from paramiko.sftp_attr import SFTPAttributes +from paramiko.sftp_client import SFTPClient +from paramiko.sftp_handle import SFTPHandle + +class SFTPFile(BufferedFile): + MAX_REQUEST_SIZE: int + sftp: SFTPClient + handle: SFTPHandle + pipelined: bool + def __init__(self, sftp: SFTPClient, handle: bytes, mode: str = ..., bufsize: int = ...) -> None: ... + def __del__(self) -> None: ... + def close(self) -> None: ... + def settimeout(self, timeout: float) -> None: ... + def gettimeout(self) -> float: ... + def setblocking(self, blocking: bool) -> None: ... + def seekable(self) -> bool: ... + def seek(self, offset: int, whence: int = ...) -> None: ... + def stat(self) -> SFTPAttributes: ... + def chmod(self, mode: int) -> None: ... + def chown(self, uid: int, gid: int) -> None: ... + def utime(self, times: Optional[Tuple[float, float]]) -> None: ... + def truncate(self, size: int) -> None: ... + def check(self, hash_algorithm: str, offset: int = ..., length: int = ..., block_size: int = ...) -> bytes: ... + def set_pipelined(self, pipelined: bool = ...) -> None: ... + def prefetch(self, file_size: Optional[int] = ...) -> None: ... + def readv(self, chunks: Sequence[Tuple[int, int]]) -> Iterator[bytes]: ... diff --git a/third_party/2and3/paramiko/sftp_handle.pyi b/third_party/2and3/paramiko/sftp_handle.pyi new file mode 100644 index 000000000..ed0891532 --- /dev/null +++ b/third_party/2and3/paramiko/sftp_handle.pyi @@ -0,0 +1,13 @@ +from typing import Union + +from paramiko.sftp_attr import SFTPAttributes +from paramiko.sftp_server import SFTPServer +from paramiko.util import ClosingContextManager + +class SFTPHandle(ClosingContextManager): + def __init__(self, flags: int = ...) -> None: ... + def close(self) -> None: ... + def read(self, offset: int, length: int) -> Union[bytes, int]: ... + def write(self, offset: int, data: bytes) -> int: ... + def stat(self) -> Union[int, SFTPAttributes]: ... + def chattr(self, attr: SFTPAttributes) -> int: ... diff --git a/third_party/2and3/paramiko/sftp_server.pyi b/third_party/2and3/paramiko/sftp_server.pyi new file mode 100644 index 000000000..7c0cb9de1 --- /dev/null +++ b/third_party/2and3/paramiko/sftp_server.pyi @@ -0,0 +1,28 @@ +from logging import Logger +from typing import Any, Dict, Optional, Type + +from paramiko.channel import Channel +from paramiko.server import ServerInterface, SubsystemHandler +from paramiko.sftp import BaseSFTP +from paramiko.sftp_attr import SFTPAttributes +from paramiko.sftp_handle import SFTPHandle +from paramiko.sftp_si import SFTPServerInterface +from paramiko.transport import Transport + +class SFTPServer(BaseSFTP, SubsystemHandler): + logger: Logger + ultra_debug: bool + next_handle: int + file_table: Dict[bytes, SFTPHandle] + folder_table: Dict[bytes, SFTPHandle] + server: SFTPServerInterface + sock: Optional[Channel] + def __init__( + self, channel: Channel, name: str, server: ServerInterface, sftp_si: Type[SFTPServerInterface], *largs: Any, **kwargs: Any + ) -> None: ... + def start_subsystem(self, name: str, transport: Transport, channel: Channel) -> None: ... + def finish_subsystem(self) -> None: ... + @staticmethod + def convert_errno(e: int) -> int: ... + @staticmethod + def set_file_attr(filename: str, attr: SFTPAttributes) -> None: ... diff --git a/third_party/2and3/paramiko/sftp_si.pyi b/third_party/2and3/paramiko/sftp_si.pyi new file mode 100644 index 000000000..849051814 --- /dev/null +++ b/third_party/2and3/paramiko/sftp_si.pyi @@ -0,0 +1,23 @@ +from typing import Any, List, Union + +from paramiko.server import ServerInterface +from paramiko.sftp_attr import SFTPAttributes +from paramiko.sftp_handle import SFTPHandle + +class SFTPServerInterface: + def __init__(self, server: ServerInterface, *largs: Any, **kwargs: Any) -> None: ... + def session_started(self) -> None: ... + def session_ended(self) -> None: ... + def open(self, path: str, flags: int, attr: SFTPAttributes) -> Union[SFTPHandle, int]: ... + def list_folder(self, path: str) -> Union[List[SFTPAttributes], int]: ... + def stat(self, path: str) -> Union[SFTPAttributes, int]: ... + def lstat(self, path: str) -> Union[SFTPAttributes, int]: ... + def remove(self, path: str) -> int: ... + def rename(self, oldpath: str, newpath: str) -> int: ... + def posix_rename(self, oldpath: str, newpath: str) -> int: ... + def mkdir(self, path: str, attr: SFTPAttributes) -> int: ... + def rmdir(self, path: str) -> int: ... + def chattr(self, path: str, attr: SFTPAttributes) -> int: ... + def canonicalize(self, path: str) -> str: ... + def readlink(self, path: str) -> Union[str, int]: ... + def symlink(self, target_path: str, path: str) -> int: ... diff --git a/third_party/2and3/paramiko/ssh_exception.pyi b/third_party/2and3/paramiko/ssh_exception.pyi new file mode 100644 index 000000000..d9ba145f2 --- /dev/null +++ b/third_party/2and3/paramiko/ssh_exception.pyi @@ -0,0 +1,41 @@ +import socket +from typing import List, Mapping, Tuple, Union + +from paramiko.pkey import PKey + +class SSHException(Exception): ... +class AuthenticationException(SSHException): ... +class PasswordRequiredException(AuthenticationException): ... + +class BadAuthenticationType(AuthenticationException): + allowed_types: List[str] + explanation: str + def __init__(self, explanation: str, types: List[str]) -> None: ... + +class PartialAuthentication(AuthenticationException): + allowed_types: List[str] + def __init__(self, types: List[str]) -> None: ... + +class ChannelException(SSHException): + code: int + text: str + def __init__(self, code: int, text: str) -> None: ... + +class BadHostKeyException(SSHException): + hostname: str + key: PKey + expected_key: PKey + def __init__(self, hostname: str, got_key: PKey, expected_key: PKey) -> None: ... + +class ProxyCommandFailure(SSHException): + command: str + error: str + def __init__(self, command: str, error: str) -> None: ... + +class NoValidConnectionsError(socket.error): + errors: Mapping[Union[Tuple[str, int], Tuple[str, int, int, int]], Exception] + def __init__(self, errors: Mapping[Union[Tuple[str, int], Tuple[str, int, int, int]], Exception]) -> None: ... + def __reduce__(self) -> Tuple[type, Tuple[Mapping[Union[Tuple[str, int], Tuple[str, int, int, int]], Exception]]]: ... + +class CouldNotCanonicalize(SSHException): ... +class ConfigParseError(SSHException): ... diff --git a/third_party/2and3/paramiko/ssh_gss.pyi b/third_party/2and3/paramiko/ssh_gss.pyi new file mode 100644 index 000000000..bbb8d7edf --- /dev/null +++ b/third_party/2and3/paramiko/ssh_gss.pyi @@ -0,0 +1,54 @@ +from typing import Any, Optional, Tuple, Type + +from paramiko.ssh_exception import SSHException + +GSS_AUTH_AVAILABLE: bool +GSS_EXCEPTIONS: Tuple[Type[Exception], ...] + +def GSSAuth(auth_method: str, gss_deleg_creds: bool = ...) -> _SSH_GSSAuth: ... + +class _SSH_GSSAuth: + cc_file: None + def __init__(self, auth_method: str, gss_deleg_creds: bool) -> None: ... + def set_service(self, service: str) -> None: ... + def set_username(self, username: str) -> None: ... + def ssh_gss_oids(self, mode: str = ...) -> bytes: ... + def ssh_check_mech(self, desired_mech: str) -> bool: ... + +class _SSH_GSSAPI_OLD(_SSH_GSSAuth): + def __init__(self, auth_method: str, gss_deleg_creds: bool) -> None: ... + def ssh_init_sec_context( + self, target: str, desired_mech: Optional[str] = ..., username: Optional[str] = ..., recv_token: Optional[str] = ... + ) -> Optional[str]: ... + def ssh_get_mic(self, session_id: bytes, gss_kex: bool = ...) -> Any: ... + def ssh_accept_sec_context(self, hostname: str, recv_token: str, username: Optional[str] = ...) -> Optional[str]: ... + def ssh_check_mic(self, mic_token: str, session_id: bytes, username: Optional[str] = ...) -> None: ... + @property + def credentials_delegated(self) -> bool: ... + def save_client_creds(self, client_token: str) -> None: ... + +_SSH_GSSAPI = _SSH_GSSAPI_OLD + +class _SSH_GSSAPI_NEW(_SSH_GSSAuth): + def __init__(self, auth_method: str, gss_deleg_creds: bool) -> None: ... + def ssh_init_sec_context( + self, target: str, desired_mech: Optional[str] = ..., username: Optional[str] = ..., recv_token: Optional[str] = ... + ) -> str: ... + def ssh_get_mic(self, session_id: bytes, gss_kex: bool = ...) -> Any: ... + def ssh_accept_sec_context(self, hostname: str, recv_token: str, username: Optional[str] = ...) -> Optional[str]: ... + def ssh_check_mic(self, mic_token: str, session_id: bytes, username: Optional[str] = ...) -> None: ... + @property + def credentials_delegated(self) -> bool: ... + def save_client_creds(self, client_token: str) -> None: ... + +class _SSH_SSPI(_SSH_GSSAuth): + def __init__(self, auth_method: str, gss_deleg_creds: bool) -> None: ... + def ssh_init_sec_context( + self, target: str, desired_mech: Optional[str] = ..., username: Optional[str] = ..., recv_token: Optional[str] = ... + ) -> str: ... + def ssh_get_mic(self, session_id: bytes, gss_kex: bool = ...) -> Any: ... + def ssh_accept_sec_context(self, hostname: str, username: str, recv_token: str) -> Optional[str]: ... + def ssh_check_mic(self, mic_token: str, session_id: bytes, username: Optional[str] = ...) -> None: ... + @property + def credentials_delegated(self) -> bool: ... + def save_client_creds(self, client_token: str) -> None: ... diff --git a/third_party/2and3/paramiko/transport.pyi b/third_party/2and3/paramiko/transport.pyi new file mode 100644 index 000000000..aabc1b0e3 --- /dev/null +++ b/third_party/2and3/paramiko/transport.pyi @@ -0,0 +1,194 @@ +from logging import Logger +from socket import socket +from threading import Condition, Event, Lock, Thread +from types import ModuleType +from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Sequence, Tuple, Type, Union + +from paramiko.auth_handler import AuthHandler, _InteractiveCallback +from paramiko.channel import Channel +from paramiko.compress import ZlibCompressor, ZlibDecompressor +from paramiko.message import Message +from paramiko.packet import NeedRekeyException, Packetizer +from paramiko.pkey import PKey +from paramiko.primes import ModulusPack +from paramiko.server import ServerInterface, SubsystemHandler +from paramiko.sftp_client import SFTPClient +from paramiko.ssh_gss import _SSH_GSSAuth +from paramiko.util import ClosingContextManager + +_Addr = Tuple[str, int] + +class _KexEngine(Protocol): + def start_kex(self) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... + +class Transport(Thread, ClosingContextManager): + active: bool + hostname: Optional[str] + sock: socket + packetizer: Packetizer + local_version: str + remote_version: str + local_cipher: str + local_kex_init: Optional[bytes] + local_mac: Optional[str] + local_compression: Optional[str] + session_id: Optional[bytes] + host_key_type: Optional[str] + host_key: Optional[PKey] + use_gss_kex: bool + gss_kex_used: bool + kexgss_ctxt: Optional[_SSH_GSSAuth] + gss_host: str + kex_engine: Optional[_KexEngine] + H: Optional[bytes] + K: Optional[int] + initial_kex_done: bool + in_kex: bool + authenticated: bool + lock: Lock + channel_events: Dict[int, Event] + channels_seen: Dict[int, bool] + default_max_packet_size: int + default_window_size: int + saved_exception: Optional[Exception] + clear_to_send: Event + clear_to_send_lock: Lock + clear_to_send_timeout: float + log_name: str + logger: Logger + auth_handler: Optional[AuthHandler] + global_response: Optional[Message] + completion_event: Optional[Event] + banner_timeout: float + handshake_timeout: float + auth_timeout: float + disabled_algorithms: Optional[Dict[str, Iterable[str]]] + server_mode: bool + server_object: Optional[ServerInterface] + server_key_dict: Dict[str, PKey] + server_accepts: List[Channel] + server_accept_cv: Condition + subsystem_table: Dict[str, Tuple[Type[SubsystemHandler], Tuple[Any, ...], Dict[str, Any]]] + sys: ModuleType + def __init__( + self, + sock: Union[str, Tuple[str, int], socket], + default_window_size: int = ..., + default_max_packet_size: int = ..., + gss_kex: bool = ..., + gss_deleg_creds: bool = ..., + disabled_algorithms: Optional[Dict[str, Iterable[str]]] = ..., + ) -> None: ... + @property + def preferred_ciphers(self) -> Sequence[str]: ... + @property + def preferred_macs(self) -> Sequence[str]: ... + @property + def preferred_keys(self) -> Sequence[str]: ... + @property + def preferred_kex(self) -> Sequence[str]: ... + @property + def preferred_compression(self) -> Sequence[str]: ... + def atfork(self) -> None: ... + def get_security_options(self) -> SecurityOptions: ... + def set_gss_host(self, gss_host: Optional[str], trust_dns: bool = ..., gssapi_requested: bool = ...) -> None: ... + def start_client(self, event: Optional[Event] = ..., timeout: Optional[float] = ...) -> None: ... + def start_server(self, event: Event = ..., server: Optional[ServerInterface] = ...) -> None: ... + def add_server_key(self, key: PKey) -> None: ... + def get_server_key(self) -> Optional[PKey]: ... + @staticmethod + def load_server_moduli(filename: Optional[str] = ...) -> bool: ... + def close(self) -> None: ... + def get_remote_server_key(self) -> PKey: ... + def is_active(self) -> bool: ... + def open_session( + self, window_size: Optional[int] = ..., max_packet_size: Optional[int] = ..., timeout: Optional[float] = ... + ) -> Channel: ... + def open_x11_channel(self, src_addr: _Addr = ...) -> Channel: ... + def open_forward_agent_channel(self) -> Channel: ... + def open_forwarded_tcpip_channel(self, src_addr: _Addr, dest_addr: _Addr) -> Channel: ... + def open_channel( + self, + kind: str, + dest_addr: Optional[_Addr] = ..., + src_addr: Optional[_Addr] = ..., + window_size: Optional[int] = ..., + max_packet_size: Optional[int] = ..., + timeout: Optional[float] = ..., + ) -> Channel: ... + def request_port_forward( + self, address: str, port: int, handler: Optional[Callable[[Channel, _Addr, _Addr], None]] = ... + ) -> int: ... + def cancel_port_forward(self, address: str, port: int) -> None: ... + def open_sftp_client(self) -> Optional[SFTPClient]: ... + def send_ignore(self, byte_count: int = ...) -> None: ... + def renegotiate_keys(self) -> None: ... + def set_keepalive(self, interval: int) -> None: ... + def global_request(self, kind: str, data: Optional[Iterable[Any]] = ..., wait: bool = ...) -> Optional[Message]: ... + def accept(self, timeout: Optional[float] = ...) -> Optional[Channel]: ... + def connect( + self, + hostkey: Optional[PKey] = ..., + username: str = ..., + password: Optional[str] = ..., + pkey: Optional[PKey] = ..., + gss_host: Optional[str] = ..., + gss_auth: bool = ..., + gss_kex: bool = ..., + gss_deleg_creds: bool = ..., + gss_trust_dns: bool = ..., + ) -> None: ... + def get_exception(self) -> Optional[Exception]: ... + def set_subsystem_handler(self, name: str, handler: Type[SubsystemHandler], *larg: Any, **kwarg: Any) -> None: ... + def is_authenticated(self) -> bool: ... + def get_username(self) -> Optional[str]: ... + def get_banner(self) -> Optional[str]: ... + def auth_none(self, username: str) -> List[str]: ... + def auth_password(self, username: str, password: str, event: Optional[Event] = ..., fallback: bool = ...) -> List[str]: ... + def auth_publickey(self, username: str, key: PKey, event: Optional[Event] = ...) -> List[str]: ... + def auth_interactive(self, username: str, handler: _InteractiveCallback, submethods: str = ...) -> List[str]: ... + def auth_interactive_dumb( + self, username: str, handler: Optional[_InteractiveCallback] = ..., submethods: str = ... + ) -> List[str]: ... + def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool) -> List[str]: ... + def auth_gssapi_keyex(self, username: str) -> List[str]: ... + def set_log_channel(self, name: str) -> None: ... + def get_log_channel(self) -> str: ... + def set_hexdump(self, hexdump: bool) -> None: ... + def get_hexdump(self) -> bool: ... + def use_compression(self, compress: bool = ...) -> None: ... + def getpeername(self) -> Tuple[str, int]: ... + def stop_thread(self) -> None: ... + def run(self) -> None: ... + +class SecurityOptions: + def __init__(self, transport: Transport) -> None: ... + @property + def ciphers(self) -> Sequence[str]: ... + @ciphers.setter + def ciphers(self, x: Sequence[str]) -> None: ... + @property + def digests(self) -> Sequence[str]: ... + @digests.setter + def digests(self, x: Sequence[str]) -> None: ... + @property + def key_types(self) -> Sequence[str]: ... + @key_types.setter + def key_types(self, x: Sequence[str]) -> None: ... + @property + def kex(self) -> Sequence[str]: ... + @kex.setter + def kex(self, x: Sequence[str]) -> None: ... + @property + def compression(self) -> Sequence[str]: ... + @compression.setter + def compression(self, x: Sequence[str]) -> None: ... + +class ChannelMap: + def __init__(self) -> None: ... + def put(self, chanid: int, chan: Channel) -> None: ... + def get(self, chanid: int) -> Channel: ... + def delete(self, chanid: int) -> None: ... + def values(self) -> List[Channel]: ... + def __len__(self) -> int: ... diff --git a/third_party/2and3/paramiko/util.pyi b/third_party/2and3/paramiko/util.pyi new file mode 100644 index 000000000..404017e41 --- /dev/null +++ b/third_party/2and3/paramiko/util.pyi @@ -0,0 +1,52 @@ +import sys +from logging import Logger, LogRecord +from types import TracebackType +from typing import IO, AnyStr, Callable, Generic, List, Optional, Protocol, Text, Type, TypeVar, Union + +from paramiko.config import SSHConfig, SSHConfigDict +from paramiko.hostkeys import HostKeys + +if sys.version_info < (3, 0): + from hashlib import _hash as _Hash +else: + from hashlib import _Hash + +class SupportsClose(Protocol): + def close(self) -> None: ... + +_T = TypeVar("_T") +_TC = TypeVar("_TC", bound=SupportsClose) + +def inflate_long(s: bytes, always_positive: bool = ...) -> int: ... + +deflate_zero: int +deflate_ff: int + +def deflate_long(n: int, add_sign_padding: bool = ...) -> bytes: ... +def format_binary(data: bytes, prefix: str = ...) -> List[str]: ... +def format_binary_line(data: bytes) -> str: ... +def safe_string(s: bytes) -> bytes: ... +def bit_length(n: int) -> int: ... +def tb_strings() -> List[str]: ... +def generate_key_bytes(hash_alg: Type[_Hash], salt: bytes, key: Union[bytes, str], nbytes: int) -> bytes: ... +def load_host_keys(filename: str) -> HostKeys: ... +def parse_ssh_config(file_obj: IO[str]) -> SSHConfig: ... +def lookup_ssh_host_config(hostname: str, config: SSHConfig) -> SSHConfigDict: ... +def mod_inverse(x: int, m: int) -> int: ... +def get_thread_id() -> int: ... +def log_to_file(filename: str, level: int = ...) -> None: ... + +class PFilter: + def filter(self, record: LogRecord) -> bool: ... + +def get_logger(name: str) -> Logger: ... +def retry_on_signal(function: Callable[[], _T]) -> _T: ... +def constant_time_bytes_eq(a: AnyStr, b: AnyStr) -> bool: ... + +class ClosingContextManager: + def __enter__(self: _TC) -> _TC: ... + def __exit__( + self: _TC, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> None: ... + +def clamp_value(minimum: int, val: int, maximum: int) -> int: ... diff --git a/third_party/2and3/paramiko/win_pageant.pyi b/third_party/2and3/paramiko/win_pageant.pyi new file mode 100644 index 000000000..70750912b --- /dev/null +++ b/third_party/2and3/paramiko/win_pageant.pyi @@ -0,0 +1,16 @@ +import ctypes.wintypes +import sys + +assert sys.platform == "win32" + +win32con_WM_COPYDATA: int + +def can_talk_to_agent(): ... + +class COPYDATASTRUCT(ctypes.Structure): ... + +class PageantConnection: + def __init__(self) -> None: ... + def send(self, data: bytes) -> None: ... + def recv(self, n: int) -> bytes: ... + def close(self) -> None: ...