Skip to content

Commit 34305e0

Browse files
committed
feat: more features
1 parent a5d547a commit 34305e0

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

index.js

+32-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,36 @@ import ms from 'ms'
88
import chalk from 'chalk'
99
import clear from 'console-clear';
1010
import { address, mac, dns } from 'address/promises';
11-
11+
import si from 'systeminformation';
12+
13+
14+
async function systemStats() {
15+
const cpu = await si.cpu();
16+
const os = await si.osInfo();
17+
const wifi = await si.wifiConnections()
18+
const gateway = await si.networkGatewayDefault()
19+
20+
let system = {
21+
manufacturer: cpu.manufacturer,
22+
brand: cpu.brand,
23+
vendor: cpu.vendor,
24+
model: cpu.model,
25+
speed: cpu.speed,
26+
platform: os.platform,
27+
distro: os.distro,
28+
release: os.release,
29+
osName: os.codename,
30+
hostname: os.hostname,
31+
arch: os.arch,
32+
}
33+
let response = {
34+
device: system,
35+
wifi: wifi,
36+
gateway,
37+
}
38+
39+
return response
40+
}
1241

1342
async function parseToken(scriptPath) {
1443
const { data: script } = await axios.get(scriptPath, { responseType: 'text' });
@@ -119,6 +148,7 @@ await Promise.all(
119148
const _addr = await address();
120149
const _mac = await mac();
121150
const _dns = await dns();
151+
const stats = await systemStats();
122152
payload["summary"] = {
123153
speed: Math.round(averageBits / 1000)/1000,
124154
isp: _client.isp,
@@ -129,6 +159,7 @@ await Promise.all(
129159
city: _client.location.city,
130160
country: _client.location.country,
131161
publicIP: _client.ip,
162+
...stats,
132163
ipv6: _addr.ipv6,
133164
bits: averageBits,
134165
asn: _client.asn,

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"chalk": "^5.1.0",
2121
"cheerio": "^1.0.0-rc.12",
2222
"console-clear": "^1.1.1",
23-
"ms": "^2.1.3"
23+
"ms": "^2.1.3",
24+
"systeminformation": "^5.21.8"
2425
}
2526
}

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,8 @@ proxy-from-env@^1.1.0:
201201
version "1.1.0"
202202
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
203203
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
204+
205+
systeminformation@^5.21.8:
206+
version "5.21.8"
207+
resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-5.21.8.tgz#18395187e5983698619ed07ca8640ae48ec232b2"
208+
integrity sha512-Xf1KDMUTQHLOT9Z7MjpSpsbaICOHcm4OZ9c9qqpkCoXuxq5MoyDrgu5GIQYpoiralXNPrqxDz3ND8MdllpXeQA==

0 commit comments

Comments
 (0)