@indra.ai/deva.guard 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/feature/methods.js +174 -103
- package/package.json +1 -1
package/feature/methods.js
CHANGED
|
@@ -79,10 +79,11 @@ export default {
|
|
|
79
79
|
|
|
80
80
|
this.state('set', `client:${transport}`); //set the client state for the proxy
|
|
81
81
|
const client = this.client(); // the client requesting the proxy
|
|
82
|
-
const {profile} = client; // set the client profile
|
|
83
82
|
|
|
84
83
|
this.state('set', `meta:${transport}`); //set the meta state for the proxy
|
|
85
84
|
const {meta} = packet.q; // set the meta information from the packet question.
|
|
85
|
+
|
|
86
|
+
this.state('set', `params:${transport}`); //set the meta state for the proxy
|
|
86
87
|
const {params} = meta; // set params from the meta information.
|
|
87
88
|
|
|
88
89
|
this.state('set', `opts:${transport}`); //set the opts state for the proxy
|
|
@@ -93,37 +94,42 @@ export default {
|
|
|
93
94
|
|
|
94
95
|
this.state('set', `message:${transport}`); //set the message state for the proxy
|
|
95
96
|
const message = packet.q.text; // set packet.q.text as the message of the proxy.
|
|
96
|
-
|
|
97
|
-
this.state('set', `
|
|
98
|
-
const
|
|
97
|
+
|
|
98
|
+
this.state('set', `write:${transport}`); //set the message state for the proxy
|
|
99
|
+
const write = `OM:${client.profile.write.split(' ').join(':').toUpperCase()}:PROXY`; // set proxy write string.
|
|
99
100
|
|
|
100
101
|
this.state('set', `data:${transport}`); // set the state to set data
|
|
101
102
|
// data packet
|
|
102
103
|
const data = {
|
|
103
104
|
uid,
|
|
105
|
+
message,
|
|
106
|
+
time,
|
|
104
107
|
transport,
|
|
108
|
+
write,
|
|
109
|
+
case: client.profile.caseid,
|
|
105
110
|
opts: opts.length? `:${opts.join(':')}` : '',
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
client,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
caseid,
|
|
111
|
+
agent: agent.profile,
|
|
112
|
+
client: client.profile,
|
|
113
|
+
name: client.profile.name,
|
|
114
|
+
fullname: client.profile.fullname,
|
|
115
|
+
nickname: client.profile.nickname,
|
|
116
|
+
birthname: client.profile.birthname,
|
|
117
|
+
gender: client.profile.gender,
|
|
118
|
+
pronouns: client.profile.pronouns,
|
|
119
|
+
emojis: client.profile.emojis,
|
|
120
|
+
company: client.profile.company,
|
|
121
|
+
address: `${client.profile.address} ${client.profile.city} ${client.profile.state} ${client.profile.zipcode}`,
|
|
122
|
+
family: client.profile.family,
|
|
123
|
+
friends: client.profile.friends,
|
|
124
|
+
token: client.profile.token,
|
|
125
|
+
warning: client.profile.warning,
|
|
122
126
|
concerns,
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
meta,
|
|
128
|
+
params,
|
|
129
|
+
command,
|
|
125
130
|
created,
|
|
126
|
-
|
|
131
|
+
copyright: client.profile.copyright,
|
|
132
|
+
};
|
|
127
133
|
|
|
128
134
|
this.state('secure', `md5:${transport}`); // set state to secure hashing
|
|
129
135
|
data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
@@ -133,32 +139,38 @@ export default {
|
|
|
133
139
|
|
|
134
140
|
this.state('secure', `sha512:${transport}`); // set state to secure hashing
|
|
135
141
|
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
136
|
-
|
|
142
|
+
|
|
137
143
|
// Text data that is joined by line breaks and then trimmed.
|
|
138
|
-
|
|
139
144
|
this.state('set', `text:${transport}`); // set state to text for output formatting.
|
|
140
145
|
const text = [
|
|
141
146
|
`:::`,
|
|
142
|
-
`::BEGIN
|
|
143
|
-
|
|
144
|
-
`::begin:vector:guard:proxy:${data.
|
|
147
|
+
`::BEGIN:${data.write}:${data.transport}`,
|
|
148
|
+
`#VectorGuardProxy${data.opts} ${data.message}`,
|
|
149
|
+
`::begin:vector:guard:proxy:${transport}:${data.emojis}`,
|
|
150
|
+
`time: ${data.time}`,
|
|
145
151
|
`transport: ${data.transport}`,
|
|
146
152
|
`agent: ${data.agent.id}`,
|
|
147
153
|
`client: ${data.client.id}`,
|
|
148
154
|
`name: ${data.name}`,
|
|
149
155
|
`fullname: ${data.fullname}`,
|
|
150
|
-
`
|
|
156
|
+
`nickname: ${data.nickname}`,
|
|
157
|
+
`family: ${data.family}`,
|
|
158
|
+
`friends: ${data.friends}`,
|
|
159
|
+
`gender: ${data.gender}`,
|
|
160
|
+
`pronouns: ${data.pronouns}`,
|
|
161
|
+
`company: ${data.company}`,
|
|
162
|
+
`address: ${data.address}`,
|
|
151
163
|
`token: ${data.token}`,
|
|
152
|
-
`concerns: ${data.concerns
|
|
153
|
-
`
|
|
154
|
-
`
|
|
164
|
+
`concerns: ${data.concerns}`,
|
|
165
|
+
`warning: ${data.warning}`,
|
|
166
|
+
`caseid: ${data.caseid}`,
|
|
155
167
|
`created: ${data.created}`,
|
|
156
168
|
`md5: ${data.md5}`,
|
|
157
169
|
`sha256: ${data.sha256}`,
|
|
158
170
|
`sha512: ${data.sha512}`,
|
|
159
171
|
`copyright: ${data.copyright}`,
|
|
160
|
-
`::end:vector:guard:proxy:${data.
|
|
161
|
-
`::END
|
|
172
|
+
`::end:vector:guard:proxy:${data.transport}:${data.emojis}`,
|
|
173
|
+
`::END:${data.write}:${data.transport}`,
|
|
162
174
|
].join('\n').trim();
|
|
163
175
|
|
|
164
176
|
// send the text data to #feecting to parse and return valid text, html, and data.
|
|
@@ -219,34 +231,41 @@ export default {
|
|
|
219
231
|
this.state('set', `message:${transport}`); //set the message state for the proxy
|
|
220
232
|
const message = packet.q.text; // set packet.q.text as the message of the proxy.
|
|
221
233
|
|
|
222
|
-
this.state('set', `
|
|
223
|
-
const
|
|
234
|
+
this.state('set', `writestr:${transport}`);
|
|
235
|
+
const write = `OM:${client.profile.write.split(' ').join(':').toUpperCase()}:SHIELD`;
|
|
224
236
|
|
|
225
|
-
this.state('
|
|
237
|
+
this.state('hash')
|
|
238
|
+
this.state('set', `data:${transport}`); // set the state to set data
|
|
239
|
+
// data packet
|
|
226
240
|
const data = {
|
|
227
241
|
uid,
|
|
242
|
+
message,
|
|
243
|
+
time,
|
|
228
244
|
transport,
|
|
245
|
+
write,
|
|
246
|
+
case: client.profile.caseid,
|
|
229
247
|
opts: opts.length? `:${opts.join(':')}` : '',
|
|
230
248
|
agent: agent.profile,
|
|
231
249
|
client: client.profile,
|
|
232
|
-
name,
|
|
233
|
-
fullname,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
name: client.profile.name,
|
|
251
|
+
fullname: client.profile.fullname,
|
|
252
|
+
nickname: client.profile.nickname,
|
|
253
|
+
birthname: client.profile.birthname,
|
|
254
|
+
gender: client.profile.gender,
|
|
255
|
+
pronouns: client.profile.pronouns,
|
|
256
|
+
emojis: client.profile.emojis,
|
|
257
|
+
company: client.profile.company,
|
|
258
|
+
address: `${client.profile.address} ${client.profile.city} ${client.profile.state} ${client.profile.zipcode}`,
|
|
259
|
+
family: client.profile.family,
|
|
260
|
+
friends: client.profile.friends,
|
|
261
|
+
token: client.profile.token,
|
|
262
|
+
warning: client.profile.warning,
|
|
263
|
+
concerns,
|
|
264
|
+
meta,
|
|
265
|
+
params,
|
|
266
|
+
command,
|
|
249
267
|
created,
|
|
268
|
+
copyright: client.profile.copyright,
|
|
250
269
|
};
|
|
251
270
|
|
|
252
271
|
this.state('secure', `md5:${transport}`); // set state to secure hashing
|
|
@@ -257,29 +276,37 @@ export default {
|
|
|
257
276
|
|
|
258
277
|
this.state('secure', `sha512:${transport}`); // set state to secure hashing
|
|
259
278
|
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
260
|
-
|
|
279
|
+
|
|
261
280
|
this.state('set', `text:${transport}`); // set state to text for output formatting.
|
|
262
281
|
const text = [
|
|
263
282
|
'::::',
|
|
264
|
-
`::BEGIN
|
|
265
|
-
|
|
266
|
-
`::begin:vector:guard:shield:${data.
|
|
283
|
+
`::BEGIN:${data.write}:${transport}`,
|
|
284
|
+
`#VectorGuardShield${data.opts} ${data.message}`,
|
|
285
|
+
`::begin:vector:guard:shield:${transport}:${data.emojis}`,
|
|
286
|
+
`time: ${data.time}`,
|
|
267
287
|
`transport: ${data.transport}`,
|
|
268
|
-
`agent: ${agent.
|
|
269
|
-
`client: ${client.
|
|
288
|
+
`agent: ${data.agent.id}`,
|
|
289
|
+
`client: ${data.client.id}`,
|
|
270
290
|
`name: ${data.name}`,
|
|
271
291
|
`fullname: ${data.fullname}`,
|
|
272
|
-
`
|
|
292
|
+
`nickname: ${data.nickname}`,
|
|
293
|
+
`family: ${data.family}`,
|
|
294
|
+
`friends: ${data.friends}`,
|
|
295
|
+
`gender: ${data.gender}`,
|
|
296
|
+
`pronouns: ${data.pronouns}`,
|
|
297
|
+
`company: ${data.company}`,
|
|
298
|
+
`address: ${data.address}`,
|
|
299
|
+
`token: ${data.token}`,
|
|
300
|
+
`concerns: ${data.concerns}`,
|
|
273
301
|
`warning: ${data.warning}`,
|
|
274
|
-
`
|
|
275
|
-
`time: ${data.timestamp}`,
|
|
302
|
+
`caseid: ${data.caseid}`,
|
|
276
303
|
`created: ${data.created}`,
|
|
277
304
|
`md5: ${data.md5}`,
|
|
278
305
|
`sha256: ${data.sha256}`,
|
|
279
306
|
`sha512: ${data.sha512}`,
|
|
280
307
|
`copyright: ${data.copyright}`,
|
|
281
|
-
`::end:vector:guard:shield:${data.
|
|
282
|
-
`::END
|
|
308
|
+
`::end:vector:guard:shield:${data.transport}:${data.emojis}`,
|
|
309
|
+
`::END:${data.write}:${transport}`,
|
|
283
310
|
'::::',
|
|
284
311
|
].join('\n').trim();
|
|
285
312
|
|
|
@@ -296,69 +323,113 @@ export default {
|
|
|
296
323
|
},
|
|
297
324
|
|
|
298
325
|
async wall(packet) {
|
|
299
|
-
this.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
326
|
+
this.state('set', `transport:${packet.id}`);
|
|
327
|
+
const transport = packet.id; // set the transport from packet.id
|
|
328
|
+
|
|
329
|
+
this.zone('wall', transport); // set the current zone to wall
|
|
330
|
+
this.feature('wall', transport); // set the Wall feature.
|
|
331
|
+
this.context('wall', transport); // set context to shield
|
|
332
|
+
this.action('method', `wall:${transport}`); // action set to shield
|
|
333
|
+
|
|
334
|
+
this.state('set', `uid:${transport}`); //set the uid state for the proxy
|
|
335
|
+
const uid = this.lib.uid(true); // The UID for the proxy
|
|
336
|
+
this.state('set', `time:${transport}`); //set the time state for the proxy
|
|
337
|
+
const time = Date.now(); // current timestamp
|
|
338
|
+
this.state('created', `created:${transport}`); //set the uid state for the proxy
|
|
339
|
+
const created = this.lib.formatDate(time, 'long', true); // Formatted created date.
|
|
340
|
+
|
|
341
|
+
this.state('set', `wall:${transport}`); //set the wall state for the proxy
|
|
342
|
+
const guard = this.guard(); // load the Guard profile
|
|
343
|
+
const {concerns} = guard; // load concerns from client guard profile.
|
|
344
|
+
|
|
345
|
+
this.state('set', `agent:${transport}`); //set the agent state for the proxy
|
|
346
|
+
const agent = this.agent(); // the agent processing the proxy
|
|
347
|
+
|
|
348
|
+
this.state('set', `client:${transport}`); //set the client state for the proxy
|
|
349
|
+
const client = this.client(); // the client requesting the proxy
|
|
350
|
+
const {profile} = client; // set the client profile
|
|
351
|
+
|
|
352
|
+
this.state('set', `meta:${transport}`); //set the meta state for the proxy
|
|
353
|
+
const {meta} = packet.q; // set the meta information from the packet question.
|
|
354
|
+
const {params} = meta; // set params from the meta information.
|
|
355
|
+
|
|
356
|
+
this.state('set', `opts:${transport}`); //set the opts state for the proxy
|
|
357
|
+
const opts = this.lib.copy(params); // copy the params and set as opts.
|
|
358
|
+
|
|
359
|
+
this.state('set', `command:${transport}`); //set the opts state for the proxy
|
|
360
|
+
const command = opts.shift(); // extract the command first array item out of opts.
|
|
361
|
+
|
|
362
|
+
this.state('set', `message:${transport}`); //set the message state for the proxy
|
|
363
|
+
const message = packet.q.text; // set packet.q.text as the message of the proxy.
|
|
318
364
|
|
|
365
|
+
this.state('set', `profile:${transport}`); //set the profile constants state for the proxy
|
|
366
|
+
const {name, fullname, nickname, title, write, religion, companies, ssn, emojis, warning, computer, hardware, provision, network, caseid, token, copyright} = profile; // constants saved from profile.
|
|
367
|
+
|
|
368
|
+
this.state('set', `data:${transport}`); // set the state to set data
|
|
369
|
+
// data packet
|
|
319
370
|
const data = {
|
|
320
371
|
uid,
|
|
321
372
|
transport,
|
|
322
373
|
opts: opts.length? `:${opts.join(':')}` : '',
|
|
323
|
-
|
|
324
|
-
agent
|
|
374
|
+
time,
|
|
375
|
+
agent,
|
|
376
|
+
client,
|
|
325
377
|
name,
|
|
326
378
|
fullname,
|
|
327
|
-
|
|
328
|
-
|
|
379
|
+
nickname,
|
|
380
|
+
title,
|
|
381
|
+
write,
|
|
382
|
+
emojis,
|
|
383
|
+
warning,
|
|
384
|
+
religion,
|
|
385
|
+
companies,
|
|
386
|
+
message,
|
|
387
|
+
ssn,
|
|
329
388
|
computer,
|
|
330
|
-
hardware,
|
|
389
|
+
hardware,
|
|
331
390
|
provision,
|
|
332
391
|
network,
|
|
333
|
-
|
|
334
|
-
|
|
392
|
+
caseid,
|
|
393
|
+
concerns,
|
|
335
394
|
token,
|
|
336
395
|
copyright,
|
|
396
|
+
created,
|
|
337
397
|
};
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
data.
|
|
398
|
+
|
|
399
|
+
this.state('secure', `md5:${transport}`); // set state to secure hashing
|
|
400
|
+
data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
341
401
|
|
|
402
|
+
this.state('secure', `sha256:${transport}`); // set state to secure hashing
|
|
403
|
+
data.sha256 = this.lib.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
404
|
+
|
|
405
|
+
this.state('secure', `sha512:${transport}`); // set state to secure hashing
|
|
406
|
+
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
407
|
+
|
|
408
|
+
this.state('set', `writestr:${transport}`);
|
|
409
|
+
const writestr = data.write.split(' ').join(':').toUpperCase();
|
|
410
|
+
|
|
342
411
|
const text = [
|
|
343
|
-
|
|
412
|
+
'::::',
|
|
413
|
+
`::BEGIN:${writestr}:WALL:${transport}:${data.emojis}`,
|
|
414
|
+
`#VectorGuardWall${data.opts} ${data.message}`,
|
|
344
415
|
`::begin:VectorGuardWall:${data.transport}`,
|
|
345
416
|
`transport: ${data.transport}`,
|
|
346
|
-
`caseid: ${data.caseid}`,
|
|
347
417
|
`agent: ${agent.profile.id}`,
|
|
348
418
|
`client: ${client.profile.id}`,
|
|
349
419
|
`name: ${data.name}`,
|
|
420
|
+
`fullname: ${data.fullname}`,
|
|
421
|
+
`nickname: ${data.nickname}`,
|
|
422
|
+
`title: ${data.title}`,
|
|
350
423
|
`token: ${data.token}`,
|
|
351
|
-
`
|
|
352
|
-
`
|
|
353
|
-
`hardware: ${data.hardware}`,
|
|
354
|
-
`provision: ${data.provision}`,
|
|
355
|
-
`network: ${data.network}`,
|
|
356
|
-
`copyright: ${data.copyright}`,
|
|
424
|
+
`case: ${data.caseid}`,
|
|
425
|
+
`time: ${data.time}`,
|
|
357
426
|
`created: ${data.created}`,
|
|
427
|
+
`copyright: ${data.copyright}`,
|
|
358
428
|
`md5: ${data.md5}`,
|
|
359
429
|
`sha256: ${data.sha256}`,
|
|
360
430
|
`sha512: ${data.sha512}`,
|
|
361
|
-
`::end:
|
|
431
|
+
`::end:VectorGuardWall:${data.transport}`,
|
|
432
|
+
`::END:${writestr}:WALL:${transport}:${data.emojis}`,
|
|
362
433
|
].join('\n').trim();
|
|
363
434
|
|
|
364
435
|
// send the text data to #feecting to parse and return valid text, html, and data.
|