airwaves-system 1.0.0
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/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "airwaves-system",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./src/system.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"automation",
|
|
11
|
+
"data-generator"
|
|
12
|
+
],
|
|
13
|
+
"author": "wrldentdevs",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"chalk": "^5.6.2",
|
|
18
|
+
"systeminformation": "^5.33.1"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const os = require('node:os');
|
|
2
|
+
const si = require('systeminformation');
|
|
3
|
+
|
|
4
|
+
// 1. Gather Basic and Advanced Metrics
|
|
5
|
+
async function getSystemSpecs() {
|
|
6
|
+
try {
|
|
7
|
+
// Native OS metrics (instantaneous)
|
|
8
|
+
const nativeSpecs = {
|
|
9
|
+
platform: os.platform(),
|
|
10
|
+
architecture: os.arch(),
|
|
11
|
+
totalMemoryGB: (os.totalmem() / 1024 / 1024 / 1024).toFixed(2),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// Advanced metrics from systeminformation (async)
|
|
15
|
+
const cpuData = await si.cpu();
|
|
16
|
+
const gpuData = await si.graphics();
|
|
17
|
+
const diskData = await si.diskLayout();
|
|
18
|
+
|
|
19
|
+
// Calculate total disk capacity in GB
|
|
20
|
+
const totalDiskGB = diskData.reduce((acc, disk) => acc + (disk.size / 1024 / 1024 / 1024), 0).toFixed(2);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
...nativeSpecs,
|
|
24
|
+
cpuBrand: cpuData.brand,
|
|
25
|
+
cpuCores: cpuData.cores,
|
|
26
|
+
gpuModel: gpuData.controllers[0]?.model || 'N/A',
|
|
27
|
+
gpuVramMB: gpuData.controllers[0]?.vram || 'N/A',
|
|
28
|
+
storageTotalGB: totalDiskGB
|
|
29
|
+
};
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Error fetching advanced system specs:', error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = {getSystemSpecs}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const ALGORITHM = "AES-GCM";
|
|
2
|
+
const KEY_LENGTH = 256;
|
|
3
|
+
|
|
4
|
+
async function generateKey() {
|
|
5
|
+
return await crypto.subtle.generateKey(
|
|
6
|
+
{ name: ALGORITHM, length: KEY_LENGTH },
|
|
7
|
+
true,
|
|
8
|
+
["encrypt", "decrypt"]
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function encryptText(plainText, key) {
|
|
13
|
+
const encoder = new TextEncoder();
|
|
14
|
+
const dataBytes = encoder.encode(plainText);
|
|
15
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
16
|
+
|
|
17
|
+
const encryptedBuffer = await crypto.subtle.encrypt(
|
|
18
|
+
{ name: ALGORITHM, iv: iv },
|
|
19
|
+
key,
|
|
20
|
+
dataBytes
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const combinedBuffer = new Uint8Array(iv.byteLength + encryptedBuffer.byteLength);
|
|
24
|
+
combinedBuffer.set(iv, 0);
|
|
25
|
+
combinedBuffer.set(new Uint8Array(encryptedBuffer), iv.byteLength);
|
|
26
|
+
|
|
27
|
+
return Array.from(combinedBuffer)
|
|
28
|
+
.map(b => b.toString(16).padStart(2, "0"))
|
|
29
|
+
.join("");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function decryptText(hexString, key) {
|
|
33
|
+
const combinedBytes = new Uint8Array(
|
|
34
|
+
hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16))
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const iv = combinedBytes.slice(0, 12);
|
|
38
|
+
const encryptedData = combinedBytes.slice(12);
|
|
39
|
+
|
|
40
|
+
const decryptedBuffer = await crypto.subtle.decrypt(
|
|
41
|
+
{ name: ALGORITHM, iv: iv },
|
|
42
|
+
key,
|
|
43
|
+
encryptedData
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const decoder = new TextDecoder();
|
|
47
|
+
return decoder.decode(decryptedBuffer);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
generateKey, decryptText, encryptText
|
|
52
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { getSystemSpecs } = require("../os-data/system-details");
|
|
2
|
+
const { decryptText } = require("../os-data/system-encrptor");
|
|
3
|
+
const { verify_system } = require("./verifier");
|
|
4
|
+
class AirSystem {
|
|
5
|
+
verify = verify_system;
|
|
6
|
+
decrypt = decryptText;
|
|
7
|
+
specs = getSystemSpecs
|
|
8
|
+
}
|
|
9
|
+
module.exports = {
|
|
10
|
+
AirSystem
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const {default: chalk} = require('chalk');
|
|
2
|
+
const { existsSync, mkdirSync, writeFileSync } = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { encryptText } = require('../../os-data/system-encrptor');
|
|
5
|
+
const { generateKey } = require('crypto');
|
|
6
|
+
|
|
7
|
+
let verified, unverified, blocked;
|
|
8
|
+
|
|
9
|
+
const required_plat = "win32";
|
|
10
|
+
const required_arc = "x64" || 'x32' || 'x86';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async function verify_system(system) {
|
|
14
|
+
const req = {
|
|
15
|
+
platform: system.platform,
|
|
16
|
+
arch: system.arch
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if(system.platform != required_arc && system.arch != required_arc){
|
|
20
|
+
throw chalk.redBright(`[AirSystem-Verifier]: Requires ${required_plat}:${required_arc}, Your system is incompatable with the current release!`)
|
|
21
|
+
}else if (system.platform === required_plat && system.arch != required_arc){
|
|
22
|
+
throw chalk.redBright(`[AirSystem-Verifier]: Requires ${required_plat}:${required_arc}, Your system is incompatable with the current release!`)
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
res: {
|
|
26
|
+
isValid: true,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function verify_GenDoc(res) {
|
|
32
|
+
const toJson = JSON.stringify(res,null,2);
|
|
33
|
+
const fileFolder = path.join(process.cwd(), 'bin');
|
|
34
|
+
const file = path.join(fileFolder, "system-specs.air");
|
|
35
|
+
|
|
36
|
+
if(!existsSync(fileFolder)){
|
|
37
|
+
mkdirSync(fileFolder, {recursive: true})
|
|
38
|
+
}
|
|
39
|
+
var raw = await encryptText(raw, await generateKey('aes'))
|
|
40
|
+
if(!existsSync(file)){
|
|
41
|
+
writeFileSync(file, raw, 'utf8')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
token: raw
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = {
|
|
50
|
+
verify_system,
|
|
51
|
+
verify_GenDoc
|
|
52
|
+
}
|