polikolog 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/.idea/5lab.iml +12 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +10 -0
  3. package/.idea/jsLibraryMappings.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/06-02.js +48 -0
  7. package/06-03.js +22 -0
  8. package/06-04.js +22 -0
  9. package/index.html +41 -0
  10. package/m0603.js +28 -0
  11. package/mypackage/m0603.js +28 -0
  12. package/mypackage/node_modules/.package-lock.json +24 -0
  13. package/mypackage/node_modules/nodemailer/.gitattributes +6 -0
  14. package/mypackage/node_modules/nodemailer/.prettierrc.js +8 -0
  15. package/mypackage/node_modules/nodemailer/CHANGELOG.md +725 -0
  16. package/mypackage/node_modules/nodemailer/CODE_OF_CONDUCT.md +76 -0
  17. package/mypackage/node_modules/nodemailer/CONTRIBUTING.md +67 -0
  18. package/mypackage/node_modules/nodemailer/LICENSE +16 -0
  19. package/mypackage/node_modules/nodemailer/README.md +97 -0
  20. package/mypackage/node_modules/nodemailer/SECURITY.txt +22 -0
  21. package/mypackage/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  22. package/mypackage/node_modules/nodemailer/lib/base64/index.js +142 -0
  23. package/mypackage/node_modules/nodemailer/lib/dkim/index.js +251 -0
  24. package/mypackage/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  25. package/mypackage/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  26. package/mypackage/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  27. package/mypackage/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  28. package/mypackage/node_modules/nodemailer/lib/fetch/index.js +274 -0
  29. package/mypackage/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  30. package/mypackage/node_modules/nodemailer/lib/mail-composer/index.js +558 -0
  31. package/mypackage/node_modules/nodemailer/lib/mailer/index.js +427 -0
  32. package/mypackage/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  33. package/mypackage/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
  34. package/mypackage/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  35. package/mypackage/node_modules/nodemailer/lib/mime-node/index.js +1290 -0
  36. package/mypackage/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  37. package/mypackage/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  38. package/mypackage/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  39. package/mypackage/node_modules/nodemailer/lib/nodemailer.js +143 -0
  40. package/mypackage/node_modules/nodemailer/lib/qp/index.js +219 -0
  41. package/mypackage/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  42. package/mypackage/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
  43. package/mypackage/node_modules/nodemailer/lib/shared/index.js +638 -0
  44. package/mypackage/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  45. package/mypackage/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  46. package/mypackage/node_modules/nodemailer/lib/smtp-connection/index.js +1796 -0
  47. package/mypackage/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
  48. package/mypackage/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
  49. package/mypackage/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
  50. package/mypackage/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  51. package/mypackage/node_modules/nodemailer/lib/well-known/index.js +47 -0
  52. package/mypackage/node_modules/nodemailer/lib/well-known/services.json +286 -0
  53. package/mypackage/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
  54. package/mypackage/node_modules/nodemailer/package.json +46 -0
  55. package/mypackage/node_modules/nodemailer/postinstall.js +101 -0
  56. package/mypackage/package.json +15 -0
  57. package/package.json +15 -0
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ const stream = require('stream');
4
+ const Transform = stream.Transform;
5
+
6
+ /**
7
+ * Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
8
+ * Also makes sure that only <CR><LF> sequences are used for linebreaks
9
+ *
10
+ * @param {Object} options Stream options
11
+ */
12
+ class DataStream extends Transform {
13
+ constructor(options) {
14
+ super(options);
15
+ // init Transform
16
+ this.options = options || {};
17
+ this._curLine = '';
18
+
19
+ this.inByteCount = 0;
20
+ this.outByteCount = 0;
21
+ this.lastByte = false;
22
+ }
23
+
24
+ /**
25
+ * Escapes dots
26
+ */
27
+ _transform(chunk, encoding, done) {
28
+ let chunks = [];
29
+ let chunklen = 0;
30
+ let i,
31
+ len,
32
+ lastPos = 0;
33
+ let buf;
34
+
35
+ if (!chunk || !chunk.length) {
36
+ return done();
37
+ }
38
+
39
+ if (typeof chunk === 'string') {
40
+ chunk = Buffer.from(chunk);
41
+ }
42
+
43
+ this.inByteCount += chunk.length;
44
+
45
+ for (i = 0, len = chunk.length; i < len; i++) {
46
+ if (chunk[i] === 0x2e) {
47
+ // .
48
+ if ((i && chunk[i - 1] === 0x0a) || (!i && (!this.lastByte || this.lastByte === 0x0a))) {
49
+ buf = chunk.slice(lastPos, i + 1);
50
+ chunks.push(buf);
51
+ chunks.push(Buffer.from('.'));
52
+ chunklen += buf.length + 1;
53
+ lastPos = i + 1;
54
+ }
55
+ } else if (chunk[i] === 0x0a) {
56
+ // .
57
+ if ((i && chunk[i - 1] !== 0x0d) || (!i && this.lastByte !== 0x0d)) {
58
+ if (i > lastPos) {
59
+ buf = chunk.slice(lastPos, i);
60
+ chunks.push(buf);
61
+ chunklen += buf.length + 2;
62
+ } else {
63
+ chunklen += 2;
64
+ }
65
+ chunks.push(Buffer.from('\r\n'));
66
+ lastPos = i + 1;
67
+ }
68
+ }
69
+ }
70
+
71
+ if (chunklen) {
72
+ // add last piece
73
+ if (lastPos < chunk.length) {
74
+ buf = chunk.slice(lastPos);
75
+ chunks.push(buf);
76
+ chunklen += buf.length;
77
+ }
78
+
79
+ this.outByteCount += chunklen;
80
+ this.push(Buffer.concat(chunks, chunklen));
81
+ } else {
82
+ this.outByteCount += chunk.length;
83
+ this.push(chunk);
84
+ }
85
+
86
+ this.lastByte = chunk[chunk.length - 1];
87
+ done();
88
+ }
89
+
90
+ /**
91
+ * Finalizes the stream with a dot on a single line
92
+ */
93
+ _flush(done) {
94
+ let buf;
95
+ if (this.lastByte === 0x0a) {
96
+ buf = Buffer.from('.\r\n');
97
+ } else if (this.lastByte === 0x0d) {
98
+ buf = Buffer.from('\n.\r\n');
99
+ } else {
100
+ buf = Buffer.from('\r\n.\r\n');
101
+ }
102
+ this.outByteCount += buf.length;
103
+ this.push(buf);
104
+ done();
105
+ }
106
+ }
107
+
108
+ module.exports = DataStream;
@@ -0,0 +1,143 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Minimal HTTP/S proxy client
5
+ */
6
+
7
+ const net = require('net');
8
+ const tls = require('tls');
9
+ const urllib = require('url');
10
+
11
+ /**
12
+ * Establishes proxied connection to destinationPort
13
+ *
14
+ * httpProxyClient("http://localhost:3128/", 80, "google.com", function(err, socket){
15
+ * socket.write("GET / HTTP/1.0\r\n\r\n");
16
+ * });
17
+ *
18
+ * @param {String} proxyUrl proxy configuration, etg "http://proxy.host:3128/"
19
+ * @param {Number} destinationPort Port to open in destination host
20
+ * @param {String} destinationHost Destination hostname
21
+ * @param {Function} callback Callback to run with the rocket object once connection is established
22
+ */
23
+ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
24
+ let proxy = urllib.parse(proxyUrl);
25
+
26
+ // create a socket connection to the proxy server
27
+ let options;
28
+ let connect;
29
+ let socket;
30
+
31
+ options = {
32
+ host: proxy.hostname,
33
+ port: Number(proxy.port) ? Number(proxy.port) : proxy.protocol === 'https:' ? 443 : 80
34
+ };
35
+
36
+ if (proxy.protocol === 'https:') {
37
+ // we can use untrusted proxies as long as we verify actual SMTP certificates
38
+ options.rejectUnauthorized = false;
39
+ connect = tls.connect.bind(tls);
40
+ } else {
41
+ connect = net.connect.bind(net);
42
+ }
43
+
44
+ // Error harness for initial connection. Once connection is established, the responsibility
45
+ // to handle errors is passed to whoever uses this socket
46
+ let finished = false;
47
+ let tempSocketErr = err => {
48
+ if (finished) {
49
+ return;
50
+ }
51
+ finished = true;
52
+ try {
53
+ socket.destroy();
54
+ } catch (E) {
55
+ // ignore
56
+ }
57
+ callback(err);
58
+ };
59
+
60
+ let timeoutErr = () => {
61
+ let err = new Error('Proxy socket timed out');
62
+ err.code = 'ETIMEDOUT';
63
+ tempSocketErr(err);
64
+ };
65
+
66
+ socket = connect(options, () => {
67
+ if (finished) {
68
+ return;
69
+ }
70
+
71
+ let reqHeaders = {
72
+ Host: destinationHost + ':' + destinationPort,
73
+ Connection: 'close'
74
+ };
75
+ if (proxy.auth) {
76
+ reqHeaders['Proxy-Authorization'] = 'Basic ' + Buffer.from(proxy.auth).toString('base64');
77
+ }
78
+
79
+ socket.write(
80
+ // HTTP method
81
+ 'CONNECT ' +
82
+ destinationHost +
83
+ ':' +
84
+ destinationPort +
85
+ ' HTTP/1.1\r\n' +
86
+ // HTTP request headers
87
+ Object.keys(reqHeaders)
88
+ .map(key => key + ': ' + reqHeaders[key])
89
+ .join('\r\n') +
90
+ // End request
91
+ '\r\n\r\n'
92
+ );
93
+
94
+ let headers = '';
95
+ let onSocketData = chunk => {
96
+ let match;
97
+ let remainder;
98
+
99
+ if (finished) {
100
+ return;
101
+ }
102
+
103
+ headers += chunk.toString('binary');
104
+ if ((match = headers.match(/\r\n\r\n/))) {
105
+ socket.removeListener('data', onSocketData);
106
+
107
+ remainder = headers.substr(match.index + match[0].length);
108
+ headers = headers.substr(0, match.index);
109
+ if (remainder) {
110
+ socket.unshift(Buffer.from(remainder, 'binary'));
111
+ }
112
+
113
+ // proxy connection is now established
114
+ finished = true;
115
+
116
+ // check response code
117
+ match = headers.match(/^HTTP\/\d+\.\d+ (\d+)/i);
118
+ if (!match || (match[1] || '').charAt(0) !== '2') {
119
+ try {
120
+ socket.destroy();
121
+ } catch (E) {
122
+ // ignore
123
+ }
124
+ return callback(new Error('Invalid response from proxy' + ((match && ': ' + match[1]) || '')));
125
+ }
126
+
127
+ socket.removeListener('error', tempSocketErr);
128
+ socket.removeListener('timeout', timeoutErr);
129
+ socket.setTimeout(0);
130
+
131
+ return callback(null, socket);
132
+ }
133
+ };
134
+ socket.on('data', onSocketData);
135
+ });
136
+
137
+ socket.setTimeout(httpProxyClient.timeout || 30 * 1000);
138
+ socket.on('timeout', timeoutErr);
139
+
140
+ socket.once('error', tempSocketErr);
141
+ }
142
+
143
+ module.exports = httpProxyClient;