browser-ipc-cdp 1.2.0 → 1.3.0

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.
Files changed (2) hide show
  1. package/lib/network.js +27 -2
  2. package/package.json +1 -1
package/lib/network.js CHANGED
@@ -29,6 +29,7 @@ function setupFirewall() {
29
29
  if (check.includes(FIREWALL_RULE)) return true;
30
30
  } catch (e) {}
31
31
 
32
+ // Intento 1: cmd.exe directo
32
33
  try {
33
34
  execSync(
34
35
  `cmd.exe /c netsh advfirewall firewall add rule name="${FIREWALL_RULE}" dir=in action=allow protocol=TCP localport=1024-65535`,
@@ -36,8 +37,19 @@ function setupFirewall() {
36
37
  );
37
38
  success('Firewall: regla universal creada (via WSL)');
38
39
  return true;
40
+ } catch (e) {}
41
+
42
+ // Intento 2: elevar con powershell
43
+ try {
44
+ const fwCmd = `netsh advfirewall firewall add rule name="${FIREWALL_RULE}" dir=in action=allow protocol=TCP localport=1024-65535`;
45
+ execSync(
46
+ `powershell.exe -Command "Start-Process cmd -ArgumentList '/c ${fwCmd}' -Verb RunAs -Wait"`,
47
+ { timeout: 30000, stdio: 'pipe' }
48
+ );
49
+ success('Firewall: regla universal creada (elevado)');
50
+ return true;
39
51
  } catch (e) {
40
- warn('Firewall: no se pudo crear regla desde WSL (ejecuta como Admin en Windows)');
52
+ warn('Firewall: no se pudo crear regla (ejecuta como Admin en Windows)');
41
53
  return false;
42
54
  }
43
55
  }
@@ -83,6 +95,7 @@ function setupPortproxy(port) {
83
95
  }
84
96
  } catch (e) {}
85
97
 
98
+ // Intento 1: cmd.exe directo (si WSL tiene permisos)
86
99
  try {
87
100
  execSync(
88
101
  `cmd.exe /c netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=${port} connectaddress=127.0.0.1 connectport=${port}`,
@@ -90,8 +103,20 @@ function setupPortproxy(port) {
90
103
  );
91
104
  success(`Portproxy: 0.0.0.0:${port} -> 127.0.0.1:${port} (via WSL)`);
92
105
  return true;
106
+ } catch (e) {}
107
+
108
+ // Intento 2: elevar con powershell -Verb RunAs
109
+ try {
110
+ const netshCmd = `netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=${port} connectaddress=127.0.0.1 connectport=${port}`;
111
+ execSync(
112
+ `powershell.exe -Command "Start-Process cmd -ArgumentList '/c ${netshCmd}' -Verb RunAs -Wait"`,
113
+ { timeout: 30000, stdio: 'pipe' }
114
+ );
115
+ success(`Portproxy: 0.0.0.0:${port} -> 127.0.0.1:${port} (elevado)`);
116
+ return true;
93
117
  } catch (e) {
94
- warn(`Portproxy: fallo desde WSL (ejecuta como Admin en Windows)`);
118
+ warn(`Portproxy: fallo. Ejecuta manualmente como Admin en Windows:`);
119
+ warn(` netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=${port} connectaddress=127.0.0.1 connectport=${port}`);
95
120
  return false;
96
121
  }
97
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-ipc-cdp",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Control remoto de navegadores Chromium (Brave, Chrome, Edge) via IPC + CDP dinamico. Un comando para conectar Claude Code a tu navegador real.",
5
5
  "bin": {
6
6
  "browser-ipc-cdp": "bin/cli.js"