brave-real-browser-mcp-server 2.17.7 → 2.17.8
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.
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { handleBrowserInit } from '../handlers/browser-handlers.js';
|
|
2
|
+
import { handleNavigate } from '../handlers/navigation-handlers.js';
|
|
3
|
+
import { handleAdProtectionDetector, handleAdvancedVideoExtraction, handleDeobfuscateJS } from '../handlers/advanced-extraction-handlers.js';
|
|
4
|
+
import { handleVideoDownloadLinkFinder } from '../handlers/advanced-video-media-handlers.js';
|
|
5
|
+
import { handleSmartSelectorGenerator } from '../handlers/ai-powered-handlers.js';
|
|
6
|
+
import { handleNetworkRecorder, handleApiFinder } from '../handlers/smart-data-extractors.js';
|
|
7
|
+
import { handleRegexPatternMatcher } from '../handlers/search-filter-handlers.js';
|
|
8
|
+
import { handleRandomScroll } from '../handlers/interaction-handlers.js';
|
|
9
|
+
async function main() {
|
|
10
|
+
const targetUrl = "https://multimovies.golf/movies/120-bahadur/";
|
|
11
|
+
const report = {
|
|
12
|
+
targets: [],
|
|
13
|
+
infrastructure: {},
|
|
14
|
+
network_protocols: {},
|
|
15
|
+
timestamp: new Date().toISOString()
|
|
16
|
+
};
|
|
17
|
+
console.log("Starting Forensic Analysis...");
|
|
18
|
+
try {
|
|
19
|
+
// --- Phase 1: Setup & Fingerprinting ---
|
|
20
|
+
console.log("[Phase 1] Initializing Environment...");
|
|
21
|
+
await handleBrowserInit({ headless: false });
|
|
22
|
+
await handleNavigate({ url: targetUrl, waitUntil: 'domcontentloaded' });
|
|
23
|
+
// Ad/Protection Check
|
|
24
|
+
try {
|
|
25
|
+
const protection = await handleAdProtectionDetector({});
|
|
26
|
+
report.infrastructure.protection_systems = protection;
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
console.log("Protection check skipped");
|
|
30
|
+
}
|
|
31
|
+
await handleRandomScroll();
|
|
32
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
33
|
+
// --- Phase 2: Deep DOM & Logic ---
|
|
34
|
+
console.log("[Phase 2] Deep DOM Reconstruction...");
|
|
35
|
+
// Find Player/Play Button
|
|
36
|
+
try {
|
|
37
|
+
const playButton = await handleSmartSelectorGenerator({ description: "play button, video player overlay, large start button" });
|
|
38
|
+
report.infrastructure.dom_selectors = { play_button_candidate: playButton };
|
|
39
|
+
if (playButton && playButton.content) {
|
|
40
|
+
console.log(`Potential Play Button Result:`, playButton.content[0].text);
|
|
41
|
+
// Optional: Click if confirmed safe, but for forensic we might just log it
|
|
42
|
+
// or click to trigger network traffic. Let's try a click to force loading.
|
|
43
|
+
// await handleClick({ selector: playButton.selector }); // Logic disabled due to text return type
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
console.log("Smart selector failed");
|
|
48
|
+
}
|
|
49
|
+
// Logic Extraction (looking for player config)
|
|
50
|
+
try {
|
|
51
|
+
const deobfuscated = await handleDeobfuscateJS({});
|
|
52
|
+
// Filter for relevant keys
|
|
53
|
+
if (deobfuscated && deobfuscated.content) {
|
|
54
|
+
const keyTerms = ['player', 'token', 'm3u8', 'mp4', 'config'];
|
|
55
|
+
const relevantScripts = deobfuscated.content
|
|
56
|
+
.filter((c) => c.text && keyTerms.some(term => c.text.includes(term)))
|
|
57
|
+
.map((c) => c.text.substring(0, 200) + "...");
|
|
58
|
+
report.infrastructure.event_handlers = relevantScripts;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
console.log("Deobfuscation skipped");
|
|
63
|
+
}
|
|
64
|
+
// --- Phase 3: Network & API ---
|
|
65
|
+
console.log("[Phase 3] Network Forensics...");
|
|
66
|
+
// Start Recorder (simulated/snapshot)
|
|
67
|
+
const networkDump = await handleNetworkRecorder({ duration: 5000, filterTypes: ['xhr', 'fetch', 'media'] });
|
|
68
|
+
report.network_protocols.captured_requests = networkDump;
|
|
69
|
+
// API Mapping
|
|
70
|
+
const apiMap = await handleApiFinder({ duration: 2000 }); // Scan current network logs
|
|
71
|
+
report.infrastructure.api_endpoints = apiMap;
|
|
72
|
+
// --- Phase 4: Pattern Mining ---
|
|
73
|
+
console.log("[Phase 4] Pattern Mining...");
|
|
74
|
+
// Regex Configs
|
|
75
|
+
const regexChecks = [
|
|
76
|
+
{ pattern: "bearer\\s+[a-zA-Z0-9\\-_\\.]+", name: "Bearer Token" },
|
|
77
|
+
{ pattern: "aes-128", name: "Encryption Method" },
|
|
78
|
+
{ pattern: "https?:\\/\\/[^\\s\"']+\\.m3u8", name: "HLS Stream" }
|
|
79
|
+
];
|
|
80
|
+
report.infrastructure.patterns = [];
|
|
81
|
+
for (const check of regexChecks) {
|
|
82
|
+
const match = await handleRegexPatternMatcher({ pattern: check.pattern });
|
|
83
|
+
if (match && match.content) {
|
|
84
|
+
report.infrastructure.patterns.push({ type: check.name, result: match.content });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// --- Phase 5: Asset Verification ---
|
|
88
|
+
console.log("[Phase 5] Asset Extraction...");
|
|
89
|
+
const videoAssets = await handleAdvancedVideoExtraction({ waitTime: 5000 });
|
|
90
|
+
// Parse video assets to populate 'targets'
|
|
91
|
+
// Assuming videoAssets structure, we'd loop and add to report.targets
|
|
92
|
+
// For now, dump the raw result
|
|
93
|
+
report.targets_raw = videoAssets;
|
|
94
|
+
const downloadLinks = await handleVideoDownloadLinkFinder({});
|
|
95
|
+
report.download_links = downloadLinks;
|
|
96
|
+
console.log("--- MASTER REPORT JSON ---");
|
|
97
|
+
console.log(JSON.stringify(report, null, 2));
|
|
98
|
+
console.log("--- END REPORT ---");
|
|
99
|
+
process.exit(0);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error("Forensic Extraction Failed:", error);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
main();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { handleBrowserInit } from '../handlers/browser-handlers.js';
|
|
2
|
+
import { handleNavigate } from '../handlers/navigation-handlers.js';
|
|
3
|
+
import { handleRandomScroll } from '../handlers/interaction-handlers.js';
|
|
4
|
+
import { handleElementScreenshot } from '../handlers/visual-tools-handlers.js';
|
|
5
|
+
import { handleNetworkRecorder } from '../handlers/smart-data-extractors.js';
|
|
6
|
+
import { handleAdvancedVideoExtraction, handleDeobfuscateJS, handleAdProtectionDetector } from '../handlers/advanced-extraction-handlers.js';
|
|
7
|
+
import { handleVideoDownloadLinkFinder } from '../handlers/advanced-video-media-handlers.js';
|
|
8
|
+
async function main() {
|
|
9
|
+
const targetUrl = process.argv[2];
|
|
10
|
+
if (!targetUrl) {
|
|
11
|
+
console.error("Please provide a target URL as the first argument.");
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
console.log(`Starting Media Extraction Workflow for: ${targetUrl}`);
|
|
15
|
+
// Phase 1: Setup & Protection Bypass
|
|
16
|
+
console.log("\n--- Phase 1: Setup & Protection Bypass ---");
|
|
17
|
+
await handleBrowserInit({
|
|
18
|
+
headless: false, // User requested visuals/interaction might be needed
|
|
19
|
+
connectOption: { defaultViewport: null }
|
|
20
|
+
});
|
|
21
|
+
await handleNavigate({ url: targetUrl, waitUntil: 'domcontentloaded' });
|
|
22
|
+
// Environment Check
|
|
23
|
+
try {
|
|
24
|
+
const protection = await handleAdProtectionDetector({});
|
|
25
|
+
console.log("Protection Check:", protection);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
console.log("Protection check skipped:", e);
|
|
29
|
+
}
|
|
30
|
+
// Stabilize
|
|
31
|
+
await handleRandomScroll();
|
|
32
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
33
|
+
// Phase 2: Primary Extraction
|
|
34
|
+
console.log("\n--- Phase 2: Primary Extraction ---");
|
|
35
|
+
// 5. Deep Scan
|
|
36
|
+
console.log("Running Advanced Video Extraction...");
|
|
37
|
+
let results = await handleAdvancedVideoExtraction({ waitTime: 10000 });
|
|
38
|
+
let foundMedia = false;
|
|
39
|
+
if (results && results.content && results.content[0].text) {
|
|
40
|
+
const text = results.content[0].text;
|
|
41
|
+
if (!text.includes('"videos":[]') && !text.includes('No video sources found')) {
|
|
42
|
+
console.log("Found items via Deep Scan:", text);
|
|
43
|
+
foundMedia = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// 6. Obfuscation Bypass
|
|
47
|
+
if (!foundMedia) {
|
|
48
|
+
console.log("Deep Scan empty. Attempting Deobfuscation...");
|
|
49
|
+
const deobfuscated = await handleDeobfuscateJS({});
|
|
50
|
+
console.log("Deobfuscation Results:", deobfuscated);
|
|
51
|
+
}
|
|
52
|
+
// 7. Network Traffic
|
|
53
|
+
if (!foundMedia) {
|
|
54
|
+
console.log("Scanning Network Traffic...");
|
|
55
|
+
const network = await handleNetworkRecorder({ duration: 5000, filterTypes: ['video', 'media', 'xhr'] });
|
|
56
|
+
console.log("Network Scan Results:", network);
|
|
57
|
+
}
|
|
58
|
+
// Phase 3: Redirect & Link Validation
|
|
59
|
+
console.log("\n--- Phase 3: Redirect & Link Validation ---");
|
|
60
|
+
console.log("Dumping page download links...");
|
|
61
|
+
const links = await handleVideoDownloadLinkFinder({});
|
|
62
|
+
console.log("Page Video Links:", links);
|
|
63
|
+
// Phase 4: Fallback
|
|
64
|
+
console.log("\n--- Phase 4: Fallback / Manual Aid ---");
|
|
65
|
+
if (!foundMedia) {
|
|
66
|
+
console.log("Taking debug screenshot...");
|
|
67
|
+
await handleElementScreenshot({ selector: 'body', outputPath: 'debug_screenshot.png' });
|
|
68
|
+
}
|
|
69
|
+
console.log("\nWorkflow Complete.");
|
|
70
|
+
// process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
main().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brave-real-browser-mcp-server",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.8",
|
|
4
4
|
"description": "Universal AI IDE MCP Server - Auto-detects and supports all AI IDEs (Claude Desktop, Cursor, Windsurf, Cline, Zed, VSCode, Qoder AI, etc.) with Brave browser automation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|