@indra.ai/deva.security 0.0.32 → 0.0.34
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 +20 -100
- package/package.json +1 -1
package/feature/methods.js
CHANGED
|
@@ -71,6 +71,18 @@ export default {
|
|
|
71
71
|
return Promise.resolve(hash);
|
|
72
72
|
},
|
|
73
73
|
|
|
74
|
+
/**************
|
|
75
|
+
method: md5 cipher
|
|
76
|
+
params: packet
|
|
77
|
+
describe: Return system md5 hash for the based deva.
|
|
78
|
+
***************/
|
|
79
|
+
cipher(packet) {
|
|
80
|
+
this.feature('security');
|
|
81
|
+
const data = this.lib.cipher(packet.q.text);
|
|
82
|
+
const cipher = `cipher: ${data.encrypted}`;
|
|
83
|
+
return Promise.resolve(cipher);
|
|
84
|
+
},
|
|
85
|
+
|
|
74
86
|
/**************
|
|
75
87
|
method: today
|
|
76
88
|
params: packet
|
|
@@ -84,109 +96,17 @@ export default {
|
|
|
84
96
|
/**************
|
|
85
97
|
method: time
|
|
86
98
|
params: packet
|
|
87
|
-
describe: Return
|
|
88
|
-
***************/
|
|
89
|
-
async time(packet) {
|
|
90
|
-
this.feature('security');
|
|
91
|
-
const timestamp = Date.now();
|
|
92
|
-
const created = this.lib.formatDate(Date.now(), 'long', true);
|
|
93
|
-
|
|
94
|
-
const data = {
|
|
95
|
-
packet,
|
|
96
|
-
timestamp,
|
|
97
|
-
created,
|
|
98
|
-
}
|
|
99
|
-
data.md5 = this.lib.hash(data, 'md5');
|
|
100
|
-
data.sha256 = this.lib.hash(data, 'sha256');
|
|
101
|
-
data.sha512 = this.lib.hash(data, 'sha512');
|
|
102
|
-
|
|
103
|
-
const feecting = await this.question(`${this.askChr}feecting parse ${text}`);
|
|
104
|
-
return {
|
|
105
|
-
text: feecting.a.text,
|
|
106
|
-
html: feecting.a.html,
|
|
107
|
-
data,
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
/**************
|
|
112
|
-
method: md5 cipher
|
|
113
|
-
params: packet
|
|
114
|
-
describe: Return system md5 hash for the based deva.
|
|
99
|
+
describe: Return system date for today.
|
|
115
100
|
***************/
|
|
116
|
-
|
|
101
|
+
time(packet) {
|
|
117
102
|
this.feature('security');
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
103
|
+
this.action('method', 'time')
|
|
104
|
+
this.state('get', 'time')
|
|
105
|
+
const theTime = Date.now();
|
|
106
|
+
return Promise.resolve(theTime);
|
|
121
107
|
},
|
|
122
108
|
|
|
123
|
-
async sign(packet) {
|
|
124
|
-
this.context('signature');
|
|
125
|
-
this.action('method', 'signature');
|
|
126
|
-
const uid = this.lib.uid(true);
|
|
127
|
-
const transport = packet.id;
|
|
128
|
-
|
|
129
|
-
const {meta} = packet.q;
|
|
130
|
-
const {params} = meta;
|
|
131
|
-
const opts = this.lib.copy(params);
|
|
132
|
-
const cmd = opts.shift();
|
|
133
109
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const timestamp = Date.now();
|
|
138
|
-
const created = this.lib.formatDate(timestamp, 'long', true);
|
|
139
|
-
const message = packet.q.text || '';
|
|
140
|
-
const client = this.client();
|
|
141
|
-
const agent = this.agent();
|
|
142
|
-
|
|
143
|
-
const data = {
|
|
144
|
-
uid,
|
|
145
|
-
transport,
|
|
146
|
-
opts: opts.join(' '),
|
|
147
|
-
client: client.profile,
|
|
148
|
-
agent: agent.profile,
|
|
149
|
-
name: profile.name,
|
|
150
|
-
computer: profile.computer,
|
|
151
|
-
network: profile.network,
|
|
152
|
-
caseid: profile.caseid,
|
|
153
|
-
message,
|
|
154
|
-
religion: profile.religion,
|
|
155
|
-
created,
|
|
156
|
-
timestamp,
|
|
157
|
-
token: profile.token,
|
|
158
|
-
copyright: profile.copyright,
|
|
159
|
-
};
|
|
160
|
-
data.md5 = this.lib.hash(data, 'md5');
|
|
161
|
-
data.sha256 = this.lib.hash(data, 'sha256');
|
|
162
|
-
data.sha512 = this.lib.hash(data, 'sha512');
|
|
163
|
-
|
|
164
|
-
const text = [
|
|
165
|
-
`uid: ${data.uid}`,
|
|
166
|
-
`write ${data.opts}? if yes then write ${data.message}`,
|
|
167
|
-
`::begin:signature:VectorGuardShield:${data.transport}`,
|
|
168
|
-
`transport: ${data.transport}`,
|
|
169
|
-
`caseid: ${data.caseid}`,
|
|
170
|
-
`agent: ${agent.profile.id}`,
|
|
171
|
-
`client: ${client.profile.id}`,
|
|
172
|
-
`name: ${data.name}`,
|
|
173
|
-
`religion: ${data.religion}`,
|
|
174
|
-
`computer: ${data.computer}`,
|
|
175
|
-
`network: ${data.network}`,
|
|
176
|
-
`companies: ${JSON.stringify(data.companies)}`,
|
|
177
|
-
`copyright: ${data.copyright}`,
|
|
178
|
-
`created: ${data.created}`,
|
|
179
|
-
`timestamp: ${data.timestamp}`,
|
|
180
|
-
`md5: ${data.md5}`,
|
|
181
|
-
`sha256: ${data.sha256}`,
|
|
182
|
-
`sha512: ${data.sha512}`,
|
|
183
|
-
`::end:signature:VectorGuardShield:${data.transport}`,
|
|
184
|
-
].join('\n').trim();
|
|
185
|
-
const feecting = await this.question(`${this.askChr}feecting parse ${text}`);
|
|
186
|
-
return {
|
|
187
|
-
text: feecting.a.text,
|
|
188
|
-
html: feecting.a.html,
|
|
189
|
-
data,
|
|
190
|
-
}
|
|
191
|
-
},
|
|
110
|
+
//TODO: build the write feature so it can write commands into the system.
|
|
111
|
+
|
|
192
112
|
}
|