@@ -13,7 +13,65 @@ export function IsTelnet(host: string, port: number): IsTelnetResponse | null {
1313 return null ;
1414}
1515
16+ /**
17+ * TelnetClient is a client for Telnet servers.
18+ * @example
19+ * ```javascript
20+ * const telnet = require('nuclei/telnet');
21+ * const client = new telnet.TelnetClient();
22+ * ```
23+ */
24+ export class TelnetClient {
25+
26+ /**
27+ * Connect tries to connect to provided host and port with telnet.
28+ * Optionally provides username and password for authentication.
29+ * Returns state of connection. If the connection is successful,
30+ * the function will return true, otherwise false.
31+ * @example
32+ * ```javascript
33+ * const telnet = require('nuclei/telnet');
34+ * const client = new telnet.TelnetClient();
35+ * const connected = client.Connect('acme.com', 23, 'username', 'password');
36+ * ```
37+ */
38+ public Connect ( host : string , port : number , username : string , password : string ) : boolean {
39+ return false ;
40+ }
1641
42+ /**
43+ * Info gathers information about the telnet server including encryption support.
44+ * Uses the telnetmini library's DetectEncryption helper function.
45+ * WARNING: The connection used for detection becomes unusable after this call.
46+ * @example
47+ * ```javascript
48+ * const telnet = require('nuclei/telnet');
49+ * const client = new telnet.TelnetClient();
50+ * const info = client.Info('acme.com', 23);
51+ * log(toJSON(info));
52+ * ```
53+ */
54+ public Info ( host : string , port : number ) : TelnetInfoResponse | null {
55+ return null ;
56+ }
57+
58+ /**
59+ * GetTelnetNTLMInfo implements the Nmap telnet-ntlm-info.nse script functionality.
60+ * This function uses the telnetmini library and SMB packet crafting functions to send
61+ * MS-TNAP NTLM authentication requests with null credentials. It might work only on
62+ * Microsoft Telnet servers.
63+ * @example
64+ * ```javascript
65+ * const telnet = require('nuclei/telnet');
66+ * const client = new telnet.TelnetClient();
67+ * const ntlmInfo = client.GetTelnetNTLMInfo('acme.com', 23);
68+ * log(toJSON(ntlmInfo));
69+ * ```
70+ */
71+ public GetTelnetNTLMInfo ( host : string , port : number ) : NTLMInfoResponse | null {
72+ return null ;
73+ }
74+ }
1775
1876/**
1977 * IsTelnetResponse is the response from the IsTelnet function.
@@ -32,3 +90,76 @@ export interface IsTelnetResponse {
3290 Banner ?: string ,
3391}
3492
93+ /**
94+ * TelnetInfoResponse is the response from the Info function.
95+ * @example
96+ * ```javascript
97+ * const telnet = require('nuclei/telnet');
98+ * const client = new telnet.TelnetClient();
99+ * const info = client.Info('acme.com', 23);
100+ * log(toJSON(info));
101+ * ```
102+ */
103+ export interface TelnetInfoResponse {
104+
105+ SupportsEncryption ?: boolean ,
106+
107+ Banner ?: string ,
108+
109+ Options ?: { [ key : number ] : number [ ] } ,
110+ }
111+
112+ /**
113+ * NTLMInfoResponse represents the response from NTLM information gathering.
114+ * This matches exactly the output structure from the Nmap telnet-ntlm-info.nse script.
115+ * @example
116+ * ```javascript
117+ * const telnet = require('nuclei/telnet');
118+ * const client = new telnet.TelnetClient();
119+ * const ntlmInfo = client.GetTelnetNTLMInfo('acme.com', 23);
120+ * log(toJSON(ntlmInfo));
121+ * ```
122+ */
123+ export interface NTLMInfoResponse {
124+
125+ /**
126+ * Target_Name from script (target_realm in script)
127+ */
128+ TargetName ?: string ,
129+
130+ /**
131+ * NetBIOS_Domain_Name from script
132+ */
133+ NetBIOSDomainName ?: string ,
134+
135+ /**
136+ * NetBIOS_Computer_Name from script
137+ */
138+ NetBIOSComputerName ?: string ,
139+
140+ /**
141+ * DNS_Domain_Name from script
142+ */
143+ DNSDomainName ?: string ,
144+
145+ /**
146+ * DNS_Computer_Name from script (fqdn in script)
147+ */
148+ DNSComputerName ?: string ,
149+
150+ /**
151+ * DNS_Tree_Name from script (dns_forest_name in script)
152+ */
153+ DNSTreeName ?: string ,
154+
155+ /**
156+ * Product_Version from script
157+ */
158+ ProductVersion ?: string ,
159+
160+ /**
161+ * Raw timestamp for skew calculation
162+ */
163+ Timestamp ?: number ,
164+ }
165+
0 commit comments