Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Small fixes #3

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
experiments/pages/**
experiments/resources/**
experiments/res/**

# Created by https://www.toptal.com/developers/gitignore/api/macos,pycharm,flask,python
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,pycharm,flask,python
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
web:
image: "registry.gitlab.kuleuven.be/distrinet/research/bughog/experiment-server:latest"
image: "bughog/web"
pull_policy: never
container_name: bh_web
build: .
Expand All @@ -10,4 +10,4 @@ services:
- "443:443"
volumes:
- ./experiments/pages:/experiments/pages
- ./experiments/resources:/app/static/resources
- ./experiments/res:/app/static/res
10 changes: 5 additions & 5 deletions experiments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ experiments
| | |-- ...
| |-- [project 2]
| |-- ...
|-- resources
|-- res
```

- Experiments are grouped within projects inside the `pages` folder, representing sets of related experiments.

- The `resources` folder is intended to host resources that are used by multiple experiments and/or projects (e.g., scripts, images, videos)
Every resource is hosted on supported domains.
- The `res` folder is intended to host resources that are used by multiple experiments and/or projects (e.g., scripts, images, videos)
Every resource is hosted on all supported domains.


## Experiments
Expand Down Expand Up @@ -122,10 +122,10 @@ Detecting unvisited sanity check URLs can help identify failed experiments and p

## Resources

The `resources` folder is intended to host resources shared between projects (e.g., images, videos, scripts).
The `res` folder is intended to host resources shared between projects (e.g., images, videos, scripts).
All resources are hosted on each supported domain.

The example resource `experiments/resources/example.html` is hosted at the endpoints `https://[domain]/resources/example.html`, where `[domain]` can be any supported domain.
The example resource `experiments/res/example.html` is hosted at the endpoints `https://[domain]/res/example.html`, where `[domain]` can be any supported domain.


## Additional help
Expand Down
7 changes: 4 additions & 3 deletions flask/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def report_leak():
try:
requests.post(
f"http://{remote_ip}:5001/report/",
json=response_data
json=response_data,
timeout=5
)
except requests.exceptions.ConnectionError:
print(f'WARNING: Could not propagate request to collector at {remote_ip}:5000')
Expand Down Expand Up @@ -116,9 +117,9 @@ def report_leak_if_contains(expected_header_name: str, expected_header_value: st
return "Redirect", 307, {"Location": "https://adition.com/report/", "Allow-CSP-From": "*"}


@exp_bp.route("/resources/<path:path>")
@exp_bp.route("/res/<path:path>")
def resources(path):
file_path = os.path.join("/app/static/resources/", path)
file_path = os.path.join("/app/static/res/", path)
if not os.path.isfile(file_path):
return "Resource not found", 404
if path.endswith(".swf"):
Expand Down