user3044500 user3044500 - 9 months ago 39
Javascript Question

Is it possible to retrieve a Javascript file from a server?

In Python, I can retrieve Javascript from an HTML document using the following code.

import urllib2, jsbeautifier
from bs4 import BeautifulSoup

f = urllib2.urlopen("")

soup = BeautifulSoup(f, "lxml")
script_raw = str(soup.script)

script_pretty = jsbeautifier.beautify(script_raw)

But how about if the script comes from a Javascript file on the server, like:

<script src="some/directory/example.js" type="text/javascript">

Is it possible to retrieve "example.js"? If so, how?

Context: I'm examining the Javascript of phishing web pages.

<script src="some/directory/example.js" type="text/javascript">

the code above will get some/directory/example.js from server you just make folders and file structure follow the pattern above