[ANSWERED] How does NoScript block?

General discussion about the NoScript extension for Firefox
Post Reply
plikarish
Posts: 1
Joined: Thu Mar 22, 2012 8:28 pm

[ANSWERED] How does NoScript block?

Post by plikarish »

Hi all,

I'm a academic researcher interested in real-time analysis of js in FF. We're trying to block/pause script execution until after the analysis on the script is complete. While we know quite a bit about script analysis, we know less about how FF loads/executes scripts.

For instance, we hooked the debugger but, for various reasons, we'd like to analyze the script in the state it will be inserted into the html (e.g. with linebreaks/comments/etc). So, we can grab the script content from the DOM but only *after* the script has been executed.

Any advice on getting raw script (before js engine preprocesses it), blocking until analysis is complete and then allowing execution (webpage loading) to continue?

Thanks much,

Peter
p.s. New to the forum, let me know if I should post elsewhere...
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11
Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: How does NoScript block?

Post by Tom T. »

Attach a packet-sniffer?

http://www.wireshark.org/ ? ... many others out there. Capture it before it even enters the machine.

I *think* that's what you want, rather than how NS actually blocks things, but please forgive me if I misunderstood.

And no worries about where to post. This was fine. :)

(For non-NoScript or Flashgot-related tech questions, we do have an "off-topic" forum, "Extras", and sub-forum, "Web Tech", which would be fine. But you may have further NoScript-related questions, so no reason to move it.)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28
User avatar
GµårÐïåñ
Lieutenant Colonel
Posts: 3369
Joined: Fri Mar 20, 2009 5:19 am
Location: PST - USA
Contact:

Re: How does NoScript block?

Post by GµårÐïåñ »

I hate to contradict a dear friend, but a packet sniffer like WireShark is used for watching network traffic and data types and packets coming in and leaving, not really useful in analyzing the inner workings of the JS engine. For that you need something more like a DOM debugger attached that collects the activity, sort of like the debugger you would run in an IDE to watch the code work. I am pretty sure Giorgio uses it, most of the people doing code debugging, testing and benchmarking at Mozilla use them, but the problem is that most if not all, are NOT user friendly, highly technical and rarely graphical.

That all being said, if you use the method within Mozilla that NoScript uses, specially the ABE engine, then you can analyze the scripts before they are loaded, that's how Giorgio knows the page has scripts and what they are and blocks them or allows them accordingly. You can use the same method to capture, intercept and analyze.
~.:[ Lï£ê ï§ å Lêmðñ åñÐ Ì Wåñ† M¥ Mðñê¥ ßå¢k ]:.~
________________ .: [ Major Mike's ] :. ________________
Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: How does NoScript block?

Post by Giorgio Maone »

Last edited by GµårÐïåñ on Fri Mar 23, 2012 9:17 pm, edited 1 time in total.
Reason: URL wrapped a cropped path
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Tom T.
Field Marshal
Posts: 3620
Joined: Fri Mar 20, 2009 6:58 am

Re: How does NoScript block?

Post by Tom T. »

GµårÐïåñ wrote:I hate to contradict a dear friend, but a packet sniffer like WireShark is used for watching network traffic and data types and packets coming in and leaving,...
I was thinking of, say, the packets flowing between router (or modem) and machine, and ID-ing the JS related ones. But if that wasn't what the OP wanted, or isn't correct, of course no offense taken. (I don't use such tools myself.)

The second of Giorgio's links says:
The main purpose of the nsITraceableChannel interface is to register a stream listener (nsIStreamListener) into an HTTP channel and monitor all data in it.
In order to register the listener within every incoming HTTP channel we also need to observe http-on-examine-response event. This event is fired whenever a response is received from the server, but before any data are available.
This is what I had in mind: catch it on the HTTP port as the firewall does, either before or after the firewall does. Apparently I misinterpreted, and it needs to hit the browser first...

Thanks to both of you for correcting me.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28
Post Reply