Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/generated/ts/net.ts
2070 views
1
2
3
/**
4
* Open opens a new connection to the address with a timeout.
5
* supported protocols: tcp, udp
6
* @example
7
* ```javascript
8
* const net = require('nuclei/net');
9
* const conn = net.Open('tcp', 'acme.com:80');
10
* ```
11
*/
12
export function Open(protocol: string): NetConn | null {
13
return null;
14
}
15
16
17
18
/**
19
* Open opens a new connection to the address with a timeout.
20
* supported protocols: tcp, udp
21
* @example
22
* ```javascript
23
* const net = require('nuclei/net');
24
* const conn = net.OpenTLS('tcp', 'acme.com:443');
25
* ```
26
*/
27
export function OpenTLS(protocol: string): NetConn | null {
28
return null;
29
}
30
31
32
33
/**
34
* NetConn is a connection to a remote host.
35
* this is returned/create by Open and OpenTLS functions.
36
* @example
37
* ```javascript
38
* const net = require('nuclei/net');
39
* const conn = net.Open('tcp', 'acme.com:80');
40
* ```
41
*/
42
export class NetConn {
43
44
45
// Constructor of NetConn
46
constructor() {}
47
/**
48
* Close closes the connection.
49
* @example
50
* ```javascript
51
* const net = require('nuclei/net');
52
* const conn = net.Open('tcp', 'acme.com:80');
53
* conn.Close();
54
* ```
55
*/
56
public Close(): void {
57
return;
58
}
59
60
61
/**
62
* SetTimeout sets read/write timeout for the connection (in seconds).
63
* @example
64
* ```javascript
65
* const net = require('nuclei/net');
66
* const conn = net.Open('tcp', 'acme.com:80');
67
* conn.SetTimeout(10);
68
* ```
69
*/
70
public SetTimeout(value: number): void {
71
return;
72
}
73
74
75
/**
76
* SendArray sends array data to connection
77
* @example
78
* ```javascript
79
* const net = require('nuclei/net');
80
* const conn = net.Open('tcp', 'acme.com:80');
81
* conn.SendArray(['hello', 'world']);
82
* ```
83
*/
84
public SendArray(data: any): void {
85
return;
86
}
87
88
89
/**
90
* SendHex sends hex data to connection
91
* @example
92
* ```javascript
93
* const net = require('nuclei/net');
94
* const conn = net.Open('tcp', 'acme.com:80');
95
* conn.SendHex('68656c6c6f');
96
* ```
97
*/
98
public SendHex(data: string): void {
99
return;
100
}
101
102
103
/**
104
* Send sends data to the connection with a timeout.
105
* @example
106
* ```javascript
107
* const net = require('nuclei/net');
108
* const conn = net.Open('tcp', 'acme.com:80');
109
* conn.Send('hello');
110
* ```
111
*/
112
public Send(data: string): void {
113
return;
114
}
115
116
117
/**
118
* RecvFull receives data from the connection with a timeout.
119
* If N is 0, it will read all data sent by the server with 8MB limit.
120
* it tries to read until N bytes or timeout is reached.
121
* @example
122
* ```javascript
123
* const net = require('nuclei/net');
124
* const conn = net.Open('tcp', 'acme.com:80');
125
* const data = conn.RecvFull(1024);
126
* ```
127
*/
128
public RecvFull(N: number): Uint8Array | null {
129
return null;
130
}
131
132
133
/**
134
* Recv is similar to RecvFull but does not guarantee full read instead
135
* it creates a buffer of N bytes and returns whatever is returned by the connection
136
* for reading headers or initial bytes from the server this is usually used.
137
* for reading a fixed number of already known bytes (ex: body based on content-length) use RecvFull.
138
* @example
139
* ```javascript
140
* const net = require('nuclei/net');
141
* const conn = net.Open('tcp', 'acme.com:80');
142
* const data = conn.Recv(1024);
143
* log(`Received ${data.length} bytes from the server`)
144
* ```
145
*/
146
public Recv(N: number): Uint8Array | null {
147
return null;
148
}
149
150
151
/**
152
* RecvFullString receives data from the connection with a timeout
153
* output is returned as a string.
154
* If N is 0, it will read all data sent by the server with 8MB limit.
155
* @example
156
* ```javascript
157
* const net = require('nuclei/net');
158
* const conn = net.Open('tcp', 'acme.com:80');
159
* const data = conn.RecvFullString(1024);
160
* ```
161
*/
162
public RecvFullString(N: number): string | null {
163
return null;
164
}
165
166
167
/**
168
* RecvString is similar to RecvFullString but does not guarantee full read, instead
169
* it creates a buffer of N bytes and returns whatever is returned by the connection
170
* for reading headers or initial bytes from the server this is usually used.
171
* for reading a fixed number of already known bytes (ex: body based on content-length) use RecvFullString.
172
* @example
173
* ```javascript
174
* const net = require('nuclei/net');
175
* const conn = net.Open('tcp', 'acme.com:80');
176
* const data = conn.RecvString(1024);
177
* ```
178
*/
179
public RecvString(N: number): string | null {
180
return null;
181
}
182
183
184
/**
185
* RecvFullHex receives data from the connection with a timeout
186
* in hex format.
187
* If N is 0,it will read all data sent by the server with 8MB limit.
188
* until N bytes or timeout is reached.
189
* @example
190
* ```javascript
191
* const net = require('nuclei/net');
192
* const conn = net.Open('tcp', 'acme.com:80');
193
* const data = conn.RecvFullHex(1024);
194
* ```
195
*/
196
public RecvFullHex(N: number): string | null {
197
return null;
198
}
199
200
201
/**
202
* RecvHex is similar to RecvFullHex but does not guarantee full read instead
203
* it creates a buffer of N bytes and returns whatever is returned by the connection
204
* for reading headers or initial bytes from the server this is usually used.
205
* for reading a fixed number of already known bytes (ex: body based on content-length) use RecvFull.
206
* @example
207
* ```javascript
208
* const net = require('nuclei/net');
209
* const conn = net.Open('tcp', 'acme.com:80');
210
* const data = conn.RecvHex(1024);
211
* ```
212
*/
213
public RecvHex(N: number): string | null {
214
return null;
215
}
216
217
218
}
219
220
221