Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to obtain the values of jump related variables such as window.location.href? #510

Open
chushuai opened this issue Nov 8, 2023 · 0 comments

Comments

@chushuai
Copy link

chushuai commented Nov 8, 2023

I wrote a crawler. In order to crawl to the jumps in js, I used regular expressions to extract the jump information in js. However, this matching method cannot obtain complex js jumps, so I want to improve it through js semantic recognition. Accuracy

Below is my regex:

location\s*?=\s*?["'](.*?)["']
window.location\s*?=\s*?["'](.*?)["']
window.location.href\s*?=\s*?["'](.*?)["']
self\.location.*?=\s*?["'](.*?)["\']
top\.location.*?=\s*?["'](.*?)["\']
location\.replace\(["'](.*)["']\)
location\.assign\(["'](.*)["']\)
window.open\(["'](.*?)["']

For the following piece of JS code, it is obvious that the jump cannot be extracted through regular expressions:

<script>window.onload=function(){ url ='/webui';window.location.href=url;}</script>

@chushuai chushuai changed the title How to obtain the values of jump related variables such as window. location. ref? How to obtain the values of jump related variables such as window.location.href? Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant