massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / python-nmap / nmap / nmap.pyi
1 from typing import Any, Callable, Dict, Iterable, Iterator, Text, TypeVar
2 from typing_extensions import TypedDict
3
4 _T = TypeVar("_T")
5 _Callback = Callable[[str, _Result], Any]
6
7 class _Result(TypedDict):
8     nmap: _ResultNmap
9     scan: dict[str, PortScannerHostDict]
10
11 class _ResultNmap(TypedDict):
12     command_line: str
13     scaninfo: _ResultNmapInfo
14     scanstats: _ResultNampStats
15
16 class _ResultNmapInfo(TypedDict, total=False):
17     error: str
18     warning: str
19     protocol: _ResultNampInfoProtocol
20
21 class _ResultNampInfoProtocol(TypedDict):
22     method: str
23     services: str
24
25 class _ResultNampStats(TypedDict):
26     timestr: str
27     elapsed: str
28     uphosts: str
29     downhosts: str
30     totalhosts: str
31
32 class _ResulHostUptime(TypedDict):
33     seconds: str
34     lastboot: str
35
36 class _ResultHostNames(TypedDict):
37     type: str
38     name: str
39
40 class _ResultHostPort(TypedDict):
41     conf: str
42     cpe: str
43     extrainfo: str
44     name: str
45     product: str
46     reason: str
47     state: str
48     version: str
49
50 __last_modification__: str
51
52 class PortScanner(object):
53     def __init__(self, nmap_search_path: Iterable[str] = ...) -> None: ...
54     def get_nmap_last_output(self) -> Text: ...
55     def nmap_version(self) -> tuple[int, int]: ...
56     def listscan(self, hosts: str = ...) -> list[str]: ...
57     def scan(
58         self, hosts: Text = ..., ports: Text | None = ..., arguments: Text = ..., sudo: bool = ..., timeout: int = ...
59     ) -> _Result: ...
60     def analyse_nmap_xml_scan(
61         self,
62         nmap_xml_output: str | None = ...,
63         nmap_err: str = ...,
64         nmap_err_keep_trace: str = ...,
65         nmap_warn_keep_trace: str = ...,
66     ) -> _Result: ...
67     def __getitem__(self, host: Text) -> PortScannerHostDict: ...
68     def all_hosts(self) -> list[str]: ...
69     def command_line(self) -> str: ...
70     def scaninfo(self) -> _ResultNmapInfo: ...
71     def scanstats(self) -> _ResultNampStats: ...
72     def has_host(self, host: str) -> bool: ...
73     def csv(self) -> str: ...
74
75 def __scan_progressive__(
76     self: object, hosts: Text, ports: Text, arguments: Text, callback: _Callback | None, sudo: bool, timeout: int
77 ) -> None: ...
78
79 class PortScannerAsync(object):
80     def __init__(self) -> None: ...
81     def __del__(self) -> None: ...
82     def scan(
83         self,
84         hosts: Text = ...,
85         ports: Text | None = ...,
86         arguments: Text = ...,
87         callback: _Callback | None = ...,
88         sudo: bool = ...,
89         timeout: int = ...,
90     ) -> None: ...
91     def stop(self) -> None: ...
92     def wait(self, timeout: int | None = ...) -> None: ...
93     def still_scanning(self) -> bool: ...
94
95 class PortScannerYield(PortScannerAsync):
96     def __init__(self) -> None: ...
97     def scan(  # type: ignore
98         self, hosts: str = ..., ports: str | None = ..., arguments: str = ..., sudo: bool = ..., timeout: int = ...
99     ) -> Iterator[tuple[str, _Result]]: ...
100     def stop(self) -> None: ...
101     def wait(self, timeout: int | None = ...) -> None: ...
102     def still_scanning(self) -> None: ...  # type: ignore
103
104 class PortScannerHostDict(Dict[str, Any]):
105     def hostnames(self) -> list[_ResultHostNames]: ...
106     def hostname(self) -> str: ...
107     def state(self) -> str: ...
108     def uptime(self) -> _ResulHostUptime: ...
109     def all_protocols(self) -> list[str]: ...
110     def all_tcp(self) -> list[int]: ...
111     def has_tcp(self, port: int) -> bool: ...
112     def tcp(self, port: int) -> _ResultHostPort: ...
113     def all_udp(self) -> list[int]: ...
114     def has_udp(self, port: int) -> bool: ...
115     def udp(self, port: int) -> _ResultHostPort: ...
116     def all_ip(self) -> list[int]: ...
117     def has_ip(self, port: int) -> bool: ...
118     def ip(self, port: int) -> _ResultHostPort: ...
119     def all_sctp(self) -> list[int]: ...
120     def has_sctp(self, port: int) -> bool: ...
121     def sctp(self, port: int) -> _ResultHostPort: ...
122
123 class PortScannerError(Exception):
124     value: str
125     def __init__(self, value: str) -> None: ...
126
127 class PortScannerTimeout(PortScannerError): ...
128
129 def convert_nmap_output_to_encoding(value: _T, code: str = ...) -> _T: ...