How to set fake document.href value?

info2000

Client
Регистрация
12.02.2012
Сообщения
42
Благодарностей
1
Баллы
8
I want to run a js code without open browser.
How can I set the page url, value location.href, via c# code or similar to avoid open the real site and the long time to load the site.

Thanks
 

l2tester

Client
Регистрация
29.11.2022
Сообщения
18
Благодарностей
10
Баллы
3
I want to run a js code without open browser.
How can I set the page url, value location.href, via c# code or similar to avoid open the real site and the long time to load the site.

Thanks
If you are using http post/get requests then you just pass referer header alongside your requests:

Код с оформлением (BB-коды):
GET /test/script.php HTTP/1.1
Host: google.com
Referer: https://yourwebsite.com/
Or you can change properties of your "Load web page" component to include referer:
 

info2000

Client
Регистрация
12.02.2012
Сообщения
42
Благодарностей
1
Баллы
8
aha, but them you load all the page resources google.com has, (images, js, etc) and I want to avoid that, because I "only" need to execute a remote js that triggers multiple http requests, and these requests should have the fake referal

Doing the request via the http Get module isn't an option
 

l2tester

Client
Регистрация
29.11.2022
Сообщения
18
Благодарностей
10
Баллы
3
I "only" need to execute a remote js that triggers multiple http requests, and these requests should have the fake referal
Your best bet is to try to deobfuscate and understand how does js generates required headers/cookie values that are required to perform those reqeuests, then generate them using js function, it's one of the most optimal way.

Doing the request via the http Get module isn't an option
In case if you can't understand how does javascript generates required values that you need in order to send http get request your next best option is to set browser settings so it only downloads js and emulates DOM, this should reduce resource usage while allowing you to get your required values.
 

info2000

Client
Регистрация
12.02.2012
Сообщения
42
Благодарностей
1
Баллы
8
Thanks, how is the emulation dom?

Additionally, I planned to:
-download the js with http get.
-intercept the xhr requests and trigger http get
it's possible to intercept these traffic requests?
 

l2tester

Client
Регистрация
29.11.2022
Сообщения
18
Благодарностей
10
Баллы
3
Thanks, how is the emulation dom?



In content type you should specify to only load javascript(and maybe frames)
In browser settings you need to make sure you only have DOM emulation, cache clearing and js execution:


This should reduce resource usage a bit.


Additionally, I planned to:
-download the js with http get.
-intercept the xhr requests and trigger http get
it's possible to intercept these traffic requests?
Well, if website does it and it works then it is possible to emulate it.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)