Isolated javascript environment in python for testing malicious code

Status
Not open for further replies.

ChrisSD

Ars Tribunus Angusticlavius
6,213
Is there a way to create a completly isolated javascript environment in python? All I want to do is test if some potentially malicious code calls window.location, iframe.src or something similar, no matter how it tries to obscure this fact. However, I don't want to leave myself open to exploits and I do want to be able to stop the code if runs too long.
 
If you are calling window.location I'm guessing you want to test in a browser as opposed to V8 or some other non-browser JS environment. In that case, I suggest you check out http://phantomjs.org/, it's a headless Webkit implementation. If you are truly paranoid run it in a VirtualBox VM or something, but you should be fine without that. I dunno how you hook into it from Python but I suspect it would not be that hard to figure out (in Ruby-land you would probably want Poltergeist).
 
Status
Not open for further replies.