mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 10:53:57 +00:00
added info to trial payload
This commit is contained in:
@@ -1,13 +1,17 @@
|
|||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
const platformInfo = require('./platformInfo');
|
||||||
|
|
||||||
async function getPublicIp() {
|
async function getPublicIpInfo() {
|
||||||
try {
|
try {
|
||||||
const resp = await axios.default.get('https://api.ipify.org?format=json');
|
const resp = await axios.default.get('https://ipinfo.io/json');
|
||||||
return resp.data.ip || 'unknown-ip';
|
if (!resp.data?.ip) {
|
||||||
|
return { ip: 'unknown-ip' };
|
||||||
|
}
|
||||||
|
return resp.data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return 'unknown-ip';
|
return { ip: 'unknown-ip' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +32,7 @@ function getMacAddress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getHardwareFingerprint() {
|
async function getHardwareFingerprint() {
|
||||||
const publicIp = await getPublicIp();
|
const publicIpInfo = await getPublicIpInfo();
|
||||||
const macAddress = getMacAddress();
|
const macAddress = getMacAddress();
|
||||||
const platform = os.platform();
|
const platform = os.platform();
|
||||||
const release = os.release();
|
const release = os.release();
|
||||||
@@ -36,7 +40,10 @@ async function getHardwareFingerprint() {
|
|||||||
const totalMemory = os.totalmem();
|
const totalMemory = os.totalmem();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
publicIp,
|
publicIp: publicIpInfo.ip,
|
||||||
|
country: publicIpInfo.country,
|
||||||
|
region: publicIpInfo.region,
|
||||||
|
city: publicIpInfo.city,
|
||||||
macAddress,
|
macAddress,
|
||||||
platform,
|
platform,
|
||||||
release,
|
release,
|
||||||
@@ -61,6 +68,11 @@ async function getPublicHardwareFingerprint() {
|
|||||||
hash,
|
hash,
|
||||||
payload: {
|
payload: {
|
||||||
platform: fingerprint.platform,
|
platform: fingerprint.platform,
|
||||||
|
city: fingerprint.city,
|
||||||
|
country: fingerprint.country,
|
||||||
|
region: fingerprint.region,
|
||||||
|
isDocker: platformInfo.isDocker,
|
||||||
|
isElectron: platformInfo.isElectron,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user