function _logConnextraEvent(eventPtr, parametersPtr) {
var event = UTF8ToString(eventPtr);
var parameters = JSON.parse(UTF8ToString(parametersPtr));
parameters.page = event;
console.log("[JS] Logging Connextra event " + event + " with parameters:");
console.log(parameters);
if (typeof Connextra !== "undefined")
Connextra.trackEvent(parameters)
}
I found this in a javascript called build.framework.js?token=1.49.3
I need this function to no longer parse json, and to block the trackEvent part of the script using tampermonkey
Assistant
To modify the function as per your requirements using Tampermonkey, you can create a userscript that overrides the existing _logConnextraEvent function. Here's how you can achieve this:
Create a New Tampermonkey Script:
Open your Tampermonkey extension in your browser and create a new script. Then, you can use the following template to override the function:
javascript
// ==UserScript==
// @name Modify LogConnextraEvent
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Override _logConnextraEvent function
// @author Your Name
// @match *://*/*build.framework.js*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Override the existing _logConnextraEvent function
window._logConnextraEvent = function(eventPtr, parametersPtr) {
var event = UTF8ToString(eventPtr);
// Directly assign parameters without JSON parsing
var parameters = parametersPtr;
parameters.page = event;
console.log("[JS] Logging Connextra event " + event + " with parameters:");
console.log(parameters);
// Commenting out / removing the Connextra.trackEvent part
// if (typeof Connextra !== "undefined")
// Connextra.trackEvent(parameters)
};
})();
Explanation of Changes:
Skipping JSON Parse: The line var parameters = JSON.parse(UTF8ToString(parametersPtr)); has been modified to directly assign parametersPtr to parameters, assuming parametersPtr is already a usable JavaScript object without parsing. If parametersPtr is a string, adjust accordingly by removing parsing or transforming it as needed.
Blocking trackEvent: The trackEvent part of the function is commented out. The function no longer attempts to track the event, as per your requirement.
Fine-Tuning:
Depending on how parametersPtr is passed or structured, you may need to adapt how it's assigned to parameters (e.g., directly using it if it’s an object or transforming it if necessary).
If the script you are targeting is loaded under specific circumstances (i.e., dynamically loaded, within an iframe, etc.), you may need to adjust the @match field or use an appropriate event listener to ensure your userscript runs at the correct timing.
Save and Test:
Save the script in the Tampermonkey dashboard, and then test it by visiting a page where build.framework.js is active. Monitor the console to ensure it logs events without attempting to parse JSON or call Connextra.trackEvent.
This approach allows you to alter JavaScript behaviour on a webpage dynamically and without modifying the actual source files of the website.
Assistant
It looks like your message might have been cut off. If you have further questions or need additional assistance with the Tampermonkey script or anything else, please let me know!
User
window._logConnextraEvent is not available to the global window and is purposefully obfuscated, how do I find the function no matter where it is hiding
Assistant
If the function _logConnextraEvent is obfuscated or encapsulated in a way that it's not available on the global window object, you can use a few different techniques to modify it for your purposes. Here’s a step-by-step guide on how you might achieve this:
1. Use DevTools to Identify the Code
First, you'll want to use your browser's Developer Tools to locate the function in the source code:
Open Developer Tools (usually F12 or right-click -> Inspect).
Go to the "Sources" tab.
Use the search feature (Ctrl + Shift + F or Cmd + Option + F on Mac) to search for function _logConnextraEvent or parts of the function you know. This can help you locate where the function is defined.
2. Break the Obfuscation
If the function is part of an obfuscated script:
Look for patterns or repeated code structures within the script that might give away the function’s position.
Use breakpoints or console.log statements within DevTools to trace how the function is invoked and with what arguments.
Inspect the call stack to see if the function gets invoked from a known function that is accessible.
3. Override the Function with a Userscript
Once you have a better idea of where the function resides, you can try to override it with a userscript by injecting code into the page after the original script runs:
javascript
User
UTF8Tostring is not defined in our script
Assistant
If the function UTF8ToString is not defined in your script, it is likely part of an external library such as Emscripten or another framework that was expected to provide it. If it's not available and you're responsible for interpreting how string conversion should be handled, you'll need an alternative approach. Here are a few possibilities to consider:
Possible Alternatives
Check for Emscripten or External Dependencies:
If UTF8ToString comes from Emscripten or a similar toolchain, ensure that the relevant library or codebase is properly included in your project. This function is typically used to convert C-like strings (arrays of bytes) into JavaScript strings.
Assume Strings are Already JavaScript Strings:
If your function parameters are JavaScript strings rather than pointers or encoded data, you might not need conversion at all.
Manual Conversion:
If UTF8ToString is supposed to convert a Uint8Array or similar into a string, you may manually implement that functionality:
javascript
function UTF8ToString(u8Array) {
// Create a view over the array for strings
let str = '';
for (let i = 0; i < u8Array.length; ++i) {
str += String.fromCharCode(u8Array[i]);
}
return decodeURIComponent(escape(str)); // Handles UTF-8 decoding
}
Or using TextDecoder, if you’re using modern browsers:
javascript
function UTF8ToString(u8Array) {
const decoder = new TextDecoder('utf-8');
return decoder.decode(u8Array);
}
Direct Use If Already Strings:
If you determine that the parameters are already standard strings, you can remove UTF8ToString entirely from your function definition:
javascript
User
this is not finding the funciton for some reason
window["__f__m3m3576u.0z"] = function(){with (this.s) {(async (u, { p, r, s }) => {try {console.time("SCRIPT RUN TIME[Block ThreatMetrix & Force adBlockDetected to False]");
r(u, s, [undefined,undefined,undefined,p.GM_info,p.GM]);console.timeEnd("SCRIPT RUN TIME[Block ThreatMetrix & Force adBlockDetected to False]");
} catch (e) {if (e.message && e.stack) {console.error("ERROR: Execution of script 'Block ThreatMetrix & Force adBlockDetected to False' failed! " + e.message);console.log(e.stack);} else {console.error(e);}}})(async function(define,module,exports,GM_info,GM) {
// ==UserScript==
// @name Block ThreatMetrix & Force adBlockDetected to False
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Force adBlockDetected to always be false and block ThreatMetrix
// @match :///*
// @grant none
// @run-at document-start
// ==/UserScript==
debugger;(function() {
'use strict';
code
Assistant
In your scenario, it seems like you're dealing with a heavily obfuscated script, and the function you want to override is not easily accessible because it might not be directly attached to window. In such cases, here are some strategies you can consider for finding and modifying the function:
1. Use Object.defineProperty for Obfuscated Names
Since the function you're trying to override is named dynamically, you might need to do a broader search or redefine how you look for it. If the function uses eval or some other risky calls, you need to attempt intercepting it with more precise conservatism:
Override Global Functions or Prototypes:
Override base class methods like Function.prototype.toString to detect functions with specific signatures or implementations. You can even try logging all script definitions to capture when the script is being defined.
2. Redefine Using Proxies
A Proxy can intercept operations on objects and is quite powerful for testing scenarios where functions aren't directly available:
javascript
// ==UserScript==
// @name Modify Obfuscated Function using Proxy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Use Proxy to discover and override specific functions
// @match *://*/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Check the original function(s) or objects where _logConnextraEvent might reside
const globalHandlers = {};
// Proxy the window to log all function names being accessed
window = new Proxy(window, {
get(target, property, receiver) {
const orig = Reflect.get(target, property, receiver);
// Check for known function signatures
if (typeof orig === 'function' && String(orig).includes('Connextra')) {
globalHandlers[property] = true;
console.log('Function detected:', property);
}
return orig;
},
set(target, property, value) {
const orig = Reflect.set(target, property, value);
if (globalHandlers[property]) {
console.log('Overriding function:', property);
return Reflect.set(target, property, function (eventPtr, parametersPtr) {
console.log('Function override in action...');
// Your overridden implementation
});
}
return orig;
}
});
})();
User
userscript.html?name=Block-ThreatMetrix-%2526-Force-adBlockDetected-to-False.user.js&id=427f5925-50df-49c0-8d82-0443ac0317ef:103 Uncaught (in promise) TypeError: Cannot set property window of # which has only a getter
at userscript.html?name=Block-ThreatMetrix-%2526-Force-adBlockDetected-to-False.user.js&id=427f5925-50df-49c0-8d82-0443ac0317ef:103:12
at Object. (userscript.html?name=Block-ThreatMetrix-%2526-Force-adBlockDetected-to-False.user.js&id=427f5925-50df-49c0-8d82-0443ac0317ef:126:3)
at wt (:9:89)
at userscript.html?name=Block-ThreatMetrix-%2526-Force-adBlockDetected-to-False.user.js&id=427f5925-50df-49c0-8d82-0443ac0317ef:2:1
at window.__f__m3m62qwg.y4a (userscript.html?name=Block-ThreatMetrix-%2526-Force-adBlockDetected-to-False.user.js&id=427f5925-50df-49c0-8d82-0443ac0317ef:3:210)
at wt (:9:89)
at o.setMessageListener.o (:80:114)
at :81:275
at set (:89:441)
at userscript.html?name=Block-ThreatMetrix-%2526-Force-adBlockDetected-to-False.user.js&id=427f5925-50df-49c0-8d82-0443ac0317ef:1:29
Assistant
The error you're encountering is due to attempting to set the window object itself, which is not allowed since window is read-only with only a getter in the browser's global context. Let's focus on how you can intercept and modify functionality without trying to set the window directly.
Approach to Intercept and Modify Functions
To intercept and modify deeply nested or obfuscated functions in JavaScript, especially when dealing with a dynamically named function, the following steps can help:
Avoid Setting the window Directly:
Instead of trying to assign a new Proxy to window, aim to intercept specific functionality or methods by directly working with objects or their properties that involve the desired logic.
Identify Method Usage:
Since you're looking for a function tied to specific events or behaviors, identify where these might be invoked or manipulated. Use DevTools to inspect network requests or event listeners that could lead to calling or utilizing this function.
Use Object.defineProperty:
If there are specific properties on window or other objects that can trigger the desired behavior, use Object.defineProperty to watch or override them without reassigning the entire window:
javascript
// Example for redefining a complex or obfuscated function call
Object.defineProperty(window, 'someFunctionOrObject', {
get: function() {
// Custom logic when accessing this property
return someOverrideFunction;
},
set: function(value) {
// Optional handler if this property gets assigned
console.log('Attempt to set obfuscated function:', value);
},
configurable: true
});
Monitor Function Assignment through Proxy:
Without assigning it to window, you can intercept array-like or object-based method calls:
javascript
User
What is the best method to block connextra event?
Assistant
Blocking a specific functionality like Connextra events, especially when dealing with JavaScript, depends on how the events are triggered and operated within the webpage's code. Here are some strategic approaches that you can take:
1. Identify the Event Trigger
Before you can block the event, understanding how it is triggered is crucial. This is typically done by:
Inspecting Network Requests: Use the network tab in your browser's Developer Tools to see if specific requests are being sent out when Connextra events are fired. Look for patterns like specific URLs or request types.
Analyzing Scripts: Search through scripts to locate function names or operations that explicitly handle Connextra events. Look for function calls like Connextra.trackEvent or similar.
2. Use JavaScript to Block or Override
Once you've identified how and where events are fired, use JavaScript to intervene:
Override the Method:
Directly override the function responsible for emitting the event. If Connextra usages are encapsulated in a specific function (e.g., Connextra.trackEvent), you can overwrite or block it:
If the script sends data via AJAX or fetch, you can intercept these requests:
javascript
User
// ==UserScript==
// @name Block ThreatMetrix & Force adBlockDetected to False
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Force adBlockDetected to always be false and block ThreatMetrix
// @match :///*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
code
Assistant
To find all calls to external URLs and identify the functions or scripts making those requests, you can employ several strategies, especially in a complex application where the source code may be obfuscated or minified.
Here's a comprehensive approach:
1. Use the Network Tab
Open Developer Tools:
Go to your browser's Developer Tools (usually F12 or right-click -> Inspect).
Navigate to the Network Tab:
This tab shows all network requests made by the page including scripts, XHR, fetch, and more.
Identify Relevant Requests:
Filter results to include only XHR or fetch requests.
Look for patterns or specific domains like "Connextra" or other target domains.
2. JavaScript Instrumentation
Instrument various JavaScript API calls to intercept and log network requests:
Intercepting Network Requests using JavaScript
Modify XMLHttpRequest and Fetch APIs to log all outgoing requests:
To trace back what functions or parts of scripts are making requests:
Using Stack Traces
Add Debugger Statements or Breakpoints:
Place debugger; statements strategically within your own code or use breakpoints in Developer Tools. This allows you to pause script execution and trace stack calls.
User
you are giving me way to many options and summaries, I need just one thing that is effective
Assistant
To effectively identify all calls to external URLs and determine which functions are making those calls, I'll provide you with a simplified solution: intercept both XMLHttpRequest and fetch requests, and log the stack traces for each outgoing request. This approach directly provides the context you're looking for.
Create a new Tampermonkey script and paste this code into it.
Make sure @grant is set to none and @run-at is set to document-start to ensure it captures all requests from the start.
Check the Console:
Open your browser’s Developer Tools and go to the Console tab.
As you navigate or interact with the page, you’ll see logs of outgoing requests along with their stack traces.
How It Works:
Modification of XMLHttpRequest.open: Logs each request, showing the URL and the JavaScript stack trace indicating where the request originated.
Modification of fetch: Logs each fetch request along with the call stack for similar insights.
By observing these stack traces, you can trace back each request to the source function or script that is making the call. This method is direct, gives you precise insights, and is suitable for debugging and understanding request behaviors that might not be explicitly documented.
Dataset releases
Not yet included in a published release.
// ==UserScript==
// @name Modify Obfuscated Connextra Event
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Override obfuscated _logConnextraEvent function if possible
// @author Your Name
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Poll for the function's existence and override it once available
function overrideFunction() {
for (var key in window) {
if (typeof window[key] === 'function' && String(window[key]).includes('Connextra')) {
const originalFunction = window[key];
window[key] = function(eventPtr, parametersPtr) {
var event = UTF8ToString(eventPtr);
const parameters = parametersPtr; // Assuming parameters are directly usable
parameters.page = event;
console.log("[JS] Logging Connextra event " + event + " with parameters:");
console.log(parameters);
// Block the tracking call
// if (typeof Connextra !== "undefined") Connextra.trackEvent(parameters);
};
console.log("Function _logConnextraEvent overridden");
break;
}
}
}
// Try to override after the window loads the corresponding scripts
setTimeout(overrideFunction, 5000); // Delay to allow scripts to load
})();
Explanation:
Polling for the Function Name:
We loop through all properties of window or an appropriate parent object to find the function dynamically.
Recognize the function using portions of code you're sure appear only in _logConnextraEvent (e.g., unique strings or function content).
Override Right After Script Load:
Use a setTimeout to delay execution until after scripts potentially defining the function have loaded.
Replacement and Block:
Once detected, replace the function with your version, ensuring the Connextra.trackEvent() call is blocked.
Caution
Overriding scripts from third parties may cause unintended side effects on the page functionality. Testing and gradual adjustment of such scripts in a controlled environment (like using DevTools in a Chrome profile intended for testing) is recommended.
If further obfuscation complexity arises, more advanced reverse-engineering and dynamic analysis might be necessary, and using debugging hooks can facilitate this process.
function logConnextraEvent(eventStr, parametersStr) {
const event = eventStr; // Since no conversion is needed
const parameters = parametersStr; // Direct usage if strings are passed
// Proceed with your logic
parameters.page = event;
console.log("[JS] Logging Connextra event " + event + " with parameters:");
console.log(parameters);
// Optional: Comment out any tracking calls
// if (typeof Connextra !== "undefined") Connextra.trackEvent(parameters);
}
Inspect Your Data:
Consider logging or inspecting the eventPtr and parametersPtr to determine their actual types and how they should be processed.
Improving Your Understanding
Establish where your function is to be integrated. If it's not possible to directly overwrite these objects, adjustments should be made based on how your application receives and processes data. Understanding whether these parameters are raw bytes, strings, or objects will inform your conversion or handling strategy.
If you have further context or constraints you need to share, let me know, and I can adjust my recommendations accordingly!
// 1. Force adBlockDetected to false
if (typeof window.adBlockDetected === 'undefined') {
window.adBlockDetected = false;
}
Object.defineProperty(window, 'adBlockDetected', {
get: function() {
return false; // Always return false
},
set: function() {
// Ignore any attempt to change it
},
configurable: true
});
// 2. Prevent ThreatMetrix Script Injection and Profiling
const originalCreateElement = document.createElement;
document.createElement = function(tagName, ...args) {
if (tagName.toLowerCase() === "script") {
const script = originalCreateElement.call(this, tagName, ...args);
const originalSetSrc = Object.getOwnPropertyDescriptor(script, "src")?.set;
// If the script element has a src property, override it to block ThreatMetrix
if (originalSetSrc) {
Object.defineProperty(script, "src", {
set: function(value) {
if (value.includes("h.online-metrix.net/fp/tags.js")) {
console.log("Blocked ThreatMetrix script load");
return; // Block loading the ThreatMetrix script
}
originalSetSrc.call(this, value); // Otherwise, allow normal src setting
},
configurable: true
});
}
return script;
}
return originalCreateElement.call(this, tagName, ...args);
};
// Block the tm_uuid assignment to prevent tracking
Object.defineProperty(window, "tm_uuid", {
get() {
return undefined; // Always return undefined or an empty value
},
set(value) {
// Prevent the script from setting tm_uuid
console.log("Blocked setting tm_uuid:", value);
}
});
// Block any reference to `tmx_profiling_started` (if it exists)
if (typeof window.tmx_profiling_started !== "undefined") {
Object.defineProperty(window, "tmx_profiling_started", {
get() {
return false; // Block the profiling start
},
set() {} // Prevent setting the value
});
}
// 3. Intercept and block script loading through dynamic insertion
const originalAppendChild = document.head.appendChild;
document.head.appendChild = function(child) {
if (child.tagName && child.tagName.toLowerCase() === 'script' && child.src && child.src.includes("h.online-metrix.net/fp/tags.js")) {
console.log("Blocked ThreatMetrix script load via appendChild");
return; // Block the script from being appended to the head
}
return originalAppendChild.call(this, child);
};
// 4. Intercept script loading from external requests via XMLHttpRequest
const originalXhrOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(method, url) {
if (url.includes("h.online-metrix.net/fp/tags.js")) {
console.log("Blocked ThreatMetrix script load via XHR");
return; // Block the request from going out
}
return originalXhrOpen.apply(this, arguments);
};
function UTF8ToString(u8Array) {
const decoder = new TextDecoder('utf-8');
return decoder.decode(u8Array);
}
// Poll for the function's existence and override it once available
function overrideFunction() {
for (var key in window) {
if (typeof window[key] === 'function' && String(window[key]).includes('Connextra')) {
const originalFunction = window[key];
window[key] = function(eventPtr, parametersPtr) {
var event = UTF8ToString(eventPtr);
const parameters = parametersPtr; // Assuming parameters are directly usable
parameters.page = event;
console.log("[JS] Logging Connextra event " + event + " with parameters:");
console.log(parameters);
// Block the tracking call
// if (typeof Connextra !== "undefined") Connextra.trackEvent(parameters);
};
console.log("Function _logConnextraEvent overridden");
break;
}
}
}
// Try to override after the window loads the corresponding scripts
setTimeout(overrideFunction, 1); // Delay to allow scripts to load
Use Breakpoints:
Set breakpoints in the dev tools on createElement, appendChild, or other DOM manipulation methods and observe the stack trace to potentially discover where _logConnextraEvent is attached or invoked.
Instrument the JavaScript Runtime:
Tools like Proxy and Object.getOwnPropertyDescriptor can assist in runtime inspection for certain properties or solutions.
4. Collaborate with the Debugging Environment
Adjust debugging configurations to log specific calls or alert you when specific hooks are called. Use conditional breakpoints in Sources within DevTools with conditions like this.someMethodName && this.someMethodName.toString().includes("Connextra").
Final Caution:
These methods can be computationally heavy, and attempting to override a function dynamically defined or heavily obscured usually comes with trial and error. Additionally, modify the delay or use specific synchronous loading events if scripts take some time to get fully initialized.
Always approach these solutions by respecting the proprietary nature of scripts and privacy policies, focusing strictly on protective and educational exercises.
const originalArrayPush = Array.prototype.push;
Array.prototype.push = function() {
const args = Array.from(arguments);
// Check if the arguments include a function
if (args.some(arg => typeof arg === 'function' && String(arg).includes('<clue>'))) {
console.log('Intercepted function:', args);
}
return originalArrayPush.apply(this, args);
};
Use DevTools Breakpoints:
Set breakpoints strategically:
XHR breakpoints on URLs that load resources involving the function.
DOM mutation breakpoints for changes in the environment where the script executes.
Script Loading Order:
Ensure that the userscript loads after all necessary scripts by setting @run-at appropriately if delays persist:
javascript
// ==UserScript==
// @name Modify Obfuscated Function
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Will override target function when available
// @match *://*/*
// @grant none
// @run-at document-idle
// ==/UserScript==
Conclusion
Adjusting code directly without proper isolation can lead to potential unwanted outcomes and behavior alterations. If more specific components of the application allow for hooks or known override opportunities, those should be priorities rather than targeting deeply entrenched or dynamically generated code. Always corroborate any changes with the behavior observed in development tools as it can direct you to alternate and often more straightforward paths to achieving the modification you want.
Tools like NoScript or advanced privacy-focused browser extensions can often block JavaScript operations on third-party scripts effectively, though this would depend on permissions and specific configurations.
4. Modify HTML or DOM Elements
If Connextra events are associated with specific elements or triggers:
Observe the elements triggering events through Event Listeners.
Modify or remove such elements programmatically from the DOM if necessary.
5. Network-level Blocking
If you have server access, use firewall rules or proxy configurations to outright block requests to Connextra domains. This prevents data from being sent regardless of client-side scripts.
Caution with Blocking
Blocking elements within a webpage might lead to unintended side effects or break features. Always test in a safe environment and refine which actions or functions to block precisely. Adjust solutions based on observed behaviors in the scripts and traffic patterns to ensure a comprehensive block of unwanted operations.
// 1. Force adBlockDetected to false
if (typeof window.adBlockDetected === 'undefined') {
window.adBlockDetected = false;
}
Object.defineProperty(window, 'adBlockDetected', {
get: function() {
return false; // Always return false
},
set: function() {
// Ignore any attempt to change it
},
configurable: true
});
// 2. Prevent ThreatMetrix Script Injection and Profiling
const originalCreateElement = document.createElement;
document.createElement = function(tagName, ...args) {
if (tagName.toLowerCase() === "script") {
const script = originalCreateElement.call(this, tagName, ...args);
const originalSetSrc = Object.getOwnPropertyDescriptor(script, "src")?.set;
// If the script element has a src property, override it to block ThreatMetrix
if (originalSetSrc) {
Object.defineProperty(script, "src", {
set: function(value) {
if (value.includes("h.online-metrix.net/fp/tags.js")) {
console.log("Blocked ThreatMetrix script load");
return; // Block loading the ThreatMetrix script
}
originalSetSrc.call(this, value); // Otherwise, allow normal src setting
},
configurable: true
});
}
return script;
}
return originalCreateElement.call(this, tagName, ...args);
};
// Block the tm_uuid assignment to prevent tracking
Object.defineProperty(window, "tm_uuid", {
get() {
return undefined; // Always return undefined or an empty value
},
set(value) {
// Prevent the script from setting tm_uuid
console.log("Blocked setting tm_uuid:", value);
}
});
// Block any reference to `tmx_profiling_started` (if it exists)
if (typeof window.tmx_profiling_started !== "undefined") {
Object.defineProperty(window, "tmx_profiling_started", {
get() {
return false; // Block the profiling start
},
set() {} // Prevent setting the value
});
}
// 3. Intercept and block script loading through dynamic insertion
const originalAppendChild = document.head.appendChild;
document.head.appendChild = function(child) {
if (child.tagName && child.tagName.toLowerCase() === 'script' && child.src && child.src.includes("h.online-metrix.net/fp/tags.js")) {
console.log("Blocked ThreatMetrix script load via appendChild");
return; // Block the script from being appended to the head
}
return originalAppendChild.call(this, child);
};
// 4. Intercept script loading from external requests via XMLHttpRequest
const originalXhrOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(method, url) {
console.log(url);
if (url.includes("h.online-metrix.net/fp/tags.js")) {
console.log("Blocked ThreatMetrix script load via XHR");
return; // Block the request from going out
}
return originalXhrOpen.apply(this, arguments);
};
})();
I am currently using this code to find if there a XMLHttpRequest with ConnextraEvent but I see nothing, how do I find all calls to external urls and what function is calling it?
Capture Calling Context:
Use console traces at the point of request to capture the call stack:
Following up on the application initialization logic.
Reviewing library documentation if third-party scripts are bundled.
By systematically tracing each request and examining triggering scripts or reported stack traces in your console, you should be minimally able to map most network requests back to their calling code. If code is too complex, continue isolating components or dependencies to test specific logic segments individually.