Suppose I am working with a complete JS script stored in a string variable. Instead of running the entire script, my goal is to evaluate its code to identify the URLs it would attempt to retrieve via Ajax if executed.
While I could use regex to search for URLs within the code as text, this method may not uncover hidden URLs that have been obfuscated using functions like replace()
.
The solution needs to be implemented using Javascript.
Can anyone offer a hint on how this task could potentially be achieved?
Edit: To provide context, my current project involves creating a Greasemonkey script to filter out Facebook spamming scams from userscripts.org's script listing. I have already implemented a basic text search for common Facebook Ajax URLs used in scams, but scammers are finding ways to circumvent it. I need a reliable way to capture all Ajax URLs for inspection, regardless of how they have been manipulated and modified using string functions. More information can be found at .