MCPcopy Create free account
hub / github.com/SKVNDR/FastDork / handleExtractJsEndpoints

Function handleExtractJsEndpoints

Script/FastDork.js:1509–1576  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1507 }
1508 }
1509 async function handleExtractJsEndpoints() {
1510 if (!UI.payloadInput || !UI.nbrTab2) return;
1511 const currentContent = UI.payloadInput.value;
1512 UI.payloadInput.value =
1513 currentContent +
1514 (currentContent.trim() ? "\n" : "") +
1515 "// Checking page JS...";
1516 updatePayloadLineCount();
1517 try {
1518 const [activeTab] = await chrome.tabs.query({
1519 active: true,
1520 currentWindow: true,
1521 });
1522 if (!activeTab || !activeTab.id || !activeTab.url?.startsWith("http")) {
1523 throw new Error("No active HTTP(S) tab found.");
1524 }
1525 try {
1526 await chrome.scripting.executeScript({
1527 target: { tabId: activeTab.id },
1528 files: ["Script/content.js"],
1529 });
1530 } catch (e) {
1531 if (
1532 !e.message.includes("Duplicate script") &&
1533 !e.message.includes("Could not establish connection") &&
1534 !e.message.includes("Cannot access a chrome:") &&
1535 !e.message.includes("Cannot access contents of the page")
1536 ) {
1537 console.warn("Content script injection warning:", e.message);
1538 } else if (e.message.includes("Cannot access contents of the page")) {
1539 throw new Error(
1540 "Cannot access page content (e.g., Chrome Web Store, protected pages)."
1541 );
1542 }
1543 }
1544 const response = await chrome.tabs.sendMessage(activeTab.id, {
1545 action: "searchPatterns",
1546 });
1547 UI.payloadInput.value = UI.payloadInput.value
1548 .replace(/\/\/ Checking page JS...\s*$/, "")
1549 .trim();
1550 if (response?.success && Array.isArray(response.patternsFound)) {
1551 const foundData = response.patternsFound.join("\n").trim();
1552 if (foundData) {
1553 const existingContent = UI.payloadInput.value.trim();
1554 const separator = existingContent ? "\n" : "";
1555 UI.payloadInput.value = existingContent + separator + foundData;
1556 removeDuplicatePayloads();
1557 removeEmptyPayloadLines();
1558 showSuccessAnimation("JS Paths Added!");
1559 } else {
1560 showSuccessAnimation("No JS paths found");
1561 updatePayloadLineCount();
1562 }
1563 } else {
1564 throw new Error(
1565 `JS Scan Failed: ${response?.error || "Unknown error or no data"}`
1566 );

Callers

nothing calls this directly

Calls 5

updatePayloadLineCountFunction · 0.85
removeDuplicatePayloadsFunction · 0.85
removeEmptyPayloadLinesFunction · 0.85
showSuccessAnimationFunction · 0.85
showModalFunction · 0.85

Tested by

no test coverage detected