Skip to content

Commit

Permalink
new: Support for disabling JS during capture
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Oct 10, 2024
1 parent 774a99d commit 3a6e200
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 36 deletions.
1 change: 1 addition & 0 deletions lookyloo/lookyloo.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ def get_priority(source: str, user: str, authenticated: bool) -> int:
rendered_hostname_only=query.rendered_hostname_only,
with_favicon=query.with_favicon,
allow_tracking=query.allow_tracking,
java_script_enabled=query.java_script_enabled,
# force=query.force,
# recapture_interval=query.recapture_interval,
priority=priority
Expand Down
65 changes: 34 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ passivetotal = "^2.5.9"
werkzeug = "^3.0.4"
filetype = "^1.2.0"
pypandora = "^1.9.0"
lacuscore = "^1.11.0"
pylacus = "^1.10.0"
lacuscore = "^1.11.1"
pylacus = "^1.11.1"
pyipasnhistory = "^2.1.2"
publicsuffixlist = "^1.0.2.20241009"
publicsuffixlist = "^1.0.2.20241010"
pyfaup = "^1.2"
chardet = "^5.2.0"
pysecuritytxt = "^1.3.2"
Expand Down
2 changes: 1 addition & 1 deletion website/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ def capture_web() -> str | Response | WerkzeugResponse:

capture_query['listing'] = True if request.form.get('listing') else False
capture_query['allow_tracking'] = True if request.form.get('allow_tracking') else False

capture_query['java_script_enabled'] = True if request.form.get('java_script_enabled') else False
if request.form.get('referer'):
capture_query['referer'] = request.form['referer']

Expand Down
5 changes: 4 additions & 1 deletion website/web/genericapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ def post(self) -> dict[str, str | dict[str, list[str]]] | tuple[dict[str, str],
'document_name': fields.String(description="The name of the document.", example=''),
'listing': fields.Integer(description="Display the capture on the index", min=0, max=1, example=1),
'allow_tracking': fields.Integer(description="Attempt to let the website violate your privacy", min=0, max=1, example=0),
'java_script_enabled': fields.Integer(description="Enable/Disable running JavaScript when rendering the page", min=0, max=1, example=1),
'user_agent': fields.String(description="User agent to use for the capture", example=''),
'browser_name': fields.String(description="Use this browser. Must be chromium, firefox or webkit.", example=''),
'device_name': fields.String(description="Use the pre-configured settings for this device. Get a list from /json/devices.", example=''),
Expand All @@ -553,6 +554,7 @@ class SubmitCapture(Resource): # type: ignore[misc]
@api.param('url', 'The URL to capture', required=True) # type: ignore[misc]
@api.param('listing', 'Display the capture on the index', default=1) # type: ignore[misc]
@api.param('allow_tracking', 'Attempt to let the website violate your privacy', default=1) # type: ignore[misc]
@api.param('java_script_enabled', 'Enable/Disable running JavaScript when rendering the page', default=1) # type: ignore[misc]
@api.param('user_agent', 'User agent to use for the capture') # type: ignore[misc]
@api.param('browser_name', 'Use this browser. Must be chromium, firefox or webkit.') # type: ignore[misc]
@api.param('device_name', 'Use the pre-configured settings for this device') # type: ignore[misc]
Expand All @@ -571,7 +573,8 @@ def get(self) -> str | tuple[dict[str, str], int]:
to_query: dict[str, Any] = {
'url': request.args['url'],
'listing': False if 'listing' in request.args and request.args['listing'] in [0, '0'] else True,
'allow_tracking': False if 'allow_tracking' in request.args and request.args['allow_tracking'] in [0, '0'] else True
'allow_tracking': False if 'allow_tracking' in request.args and request.args['allow_tracking'] in [0, '0'] else True,
'java_script_enabled': False if 'java_script_enabled' in request.args and request.args['java_script_enabled'] in [0, '0'] else True
}
if request.args.get('user_agent'):
to_query['user_agent'] = request.args['user_agent']
Expand Down
10 changes: 10 additions & 0 deletions website/web/templates/capture.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,16 @@
</div>
</div>

<div class="row mb-3">
<label for="java_script_enabled" class="col-sm-2 col-form-check-label">Enable JavaScript:</label>
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="java_script_enabled" name="java_script_enabled" aria-describedby="java_script_enabled_help"
{% if predefined_settings.get('java_script_enabled', true) is true %}checked="checked"{% endif %}>
<div id="java_script_enabled_help" class="form-text">If disabled, the browser will not run any JavaScript when rendering the page.</div>
</div>
</div>
</div>

<!-- Referer -->
<div class="row mb-3">
Expand Down

0 comments on commit 3a6e200

Please sign in to comment.