Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

I want to customize individual javascript functions so that they behave differently then the default javascript engine (without recompiling the whole browser))

more options

I was trying to get the eval function to misbehave in an demo addon I've been working on. Basically I wanted to see how hard it would be to fool various javascript fingerprinting frameworks, some of which rely on how some javascript functions react. I was hoping that firefox was flexible enough to dodge some of these fingerprinting attempts but I have not been able to modify it in an addon alone. Does anyone know if there is a way to do this? Even a project that already alters these kinds of functions, that I could dig through to investigate how this could be done?

Thank you,

I was trying to get the eval function to misbehave in an demo addon I've been working on. Basically I wanted to see how hard it would be to fool various javascript fingerprinting frameworks, some of which rely on how some javascript functions react. I was hoping that firefox was flexible enough to dodge some of these fingerprinting attempts but I have not been able to modify it in an addon alone. Does anyone know if there is a way to do this? Even a project that already alters these kinds of functions, that I could dig through to investigate how this could be done? Thank you,

Tất cả các câu trả lời (7)

more options

Ok, you have been here awhile so will give you this google search I did and see if these extensions help you do what you want.

https://addons.mozilla.org/en-US/firefox/addon/custom-style-script/

https://addons.mozilla.org/en-US/firefox/addon/execute-js/

https://addons.mozilla.org/en-US/firefox/addon/toggle-js/

Please let us know if this solved your issue or if need further assistance.

more options

further if do a search using javascript in Firefox Add-ons Manager there is about 275 to go through and check to see if there is something you want so doing a google search might nail down to what you want Firefox Extension javascript Compiler will give you some results for making your own if so wish to.

more options

Ok, thats a bit to chew threw, but I want to thank you for it. I'll start looking through it now.

Thx

more options

So I tried both using addons.mozilla.org/en-US/firefox/addon/custom-style-script and I created a simple addon that just executes:

var eval=new Object();
eval.toString=function(){return "AAAAAAAAAA"};  
alert("eval.toString().length == ["+eval.toString().length+"]");

And loading a page like:

<div id="m"></div>
<script>
var m = document.getElementById("m");
m.innerHTML = eval.toString().length;
</script>

and the alert will display:

"eval.toString().length == [10]"

but on the webpage itself it displays 37. Somehow the function is getting overwritten, but only temporary for the addon? Do you know if these things are maybe read-only or something?

Được chỉnh sửa bởi cor-el vào

more options

(the posted reply got cut off, missing:

div id="m"> /div>

)

more options

Nobody? I was hoping someone knew how modify these kinda of functions.

more options

You can use a Greasemonkey userscript to inject some changes into web pages as/before they load. You definitely can use this method to redefine properties, but I don't know about modifying functions.

Example with properties:

The key for user script purposes is to use this line to set up your changes before the page's own DOM is built:

// @run-at document-start

See: https://wiki.greasespot.net/Metadata_Block#.40run-at

Regarding eval specifically, there are some discouraging comments here: https://stackoverflow.com/questions/2566973/how-override-eval-function-in-javascript