(platform: string)
| 213 | } |
| 214 | |
| 215 | async hackBrowserScript(platform: string): Promise<ChildProcess> { |
| 216 | const pythonPath = `"${this.SurferPythonPath}"`; |
| 217 | |
| 218 | let scriptPath: string; |
| 219 | if (platform === 'edge') { |
| 220 | scriptPath = getAssetPath('edge_windows.py'); |
| 221 | } else { |
| 222 | scriptPath = getAssetPath('chrome_windows.py'); |
| 223 | } |
| 224 | |
| 225 | const requirementsPath = getAssetPath('requirements.txt'); |
| 226 | const requirements = fs.readFileSync(requirementsPath, 'utf-8').split('\n'); |
| 227 | |
| 228 | console.log('Checking installed packages...'); |
| 229 | for (const req of requirements) { |
| 230 | if (req.trim() !== '') { |
| 231 | try { |
| 232 | const { stdout } = await execAsync(`pip show ${req.trim()}`); |
| 233 | console.log(`${req.trim()} is already installed.`); |
| 234 | } catch (error) { |
| 235 | console.log(`${req.trim()} is not installed. Installing...`); |
| 236 | try { |
| 237 | const { stdout, stderr } = await execAsync( |
| 238 | `pip install ${req.trim()}`, |
| 239 | ); |
| 240 | console.log(`Installed ${req.trim()} successfully.`); |
| 241 | } catch (installError) { |
| 242 | console.error(`Failed to install ${req.trim()}:`, installError); |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | console.log('All requirements checked/installed.'); |
| 249 | |
| 250 | if (process.platform === 'win32') { |
| 251 | return spawn('python.exe', [scriptPath], { shell: true }); |
| 252 | } else { |
| 253 | return spawn(pythonPath, [scriptPath], { shell: true }); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | async iMessageScript( |
| 258 | platform: string, |
nothing calls this directly
no test coverage detected