This section talks about the technical details of the extension.
The extension uses some simple ways to detect JavaScript in responses. Most of it is guided by the items in the config file (see "Configuring JavaScript Detection" in configuration.md).
- MIME type returned by Burp.
Content-Type
response header.- URL extension. E.g., everything that ends in
.js
.
The extension generates the hash of all JavaScript in a response and uses it to
detect duplicates. If a certain JavaScript file (or content) is processed before
and exists in the database, it's not processed again its record is updated when
it's entered into the database. This is done with the trigger
resources/db/update_hash-trigger.sql
.
Each request, response and compute task is added to a threadpool. But configuring the number of threads, we can optimize the extension for the machine and load. Data are queued and submitted to the threadpool and are not lost.
Each request and response is stored in a SQLite database. Closing the extension
before some are processed does not lose the data. When the extension is loaded
again and the Process
button is toggled, all rows will be read from the
database and processed again.
Every beautified JavaScript and its ESLint results are also stored on the file system.
- Check if we got a request.
- If it's a request, remove the headers and return.
- If it's a response, check for JavaScript.
- Extract the JavaScript.
- Check the database to see if the hash of the body is already in the table.
- If the hash exists.
- Copy
beautified_javascript
,status
,results
,is_processed
andnumber_of_results
. - If
is_processed == 0
, then the rest of the columns do not have valid data and will be populated when this hash is processed. - Store the beautified JS file and results in their correct places.
- Go to 8.
- Copy
- If the hash does not exist.
- Beautify the extracted JS.
- Populate the rest of the columns.
beautified_javascript
: Beautified extracted JS.status
= pending.results
= empty. Don't care.is_processed
= 0.number_of_results
= 0. Don't care.
- Store the beautified JS file and results in their correct places.
- Go to 8.
- Add the request to the table.