* Initial format * action * git subrepo pull --force backend/asm_differ subrepo: subdir: "backend/asm_differ" merged: "ee239a2b" upstream: origin: "https://github.com/simonlindholm/asm-differ" branch: "main" commit: "ee239a2b" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull --force backend/mips_to_c subrepo: subdir: "backend/mips_to_c" merged: "6704d61f" upstream: origin: "https://github.com/matt-kempster/mips_to_c" branch: "master" commit: "6704d61f" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * vscode * fix * .
decomp.me
A collaborative decompilation and reverse engineering website, built with Next.js and Django.
Directory structure
frontend/
public/ ; Static files
src/ ; React/Typescript sourcecode
backend/
compilers/ ; Compiler binaries and configuration
coreapp/ ; API Django app
migrations/ ; Database migrations (generated by Django)
decompme/ ; Main Django app
.env ; Default configuration
.env.local ; Local configuration overrides (not checked-in)
Setup
See DOCKER.md for instructions on how to run the project in a Docker container.
Dependencies:
- Python >=3.9
- Node.js
- Yarn
- Create a file to hold environment variables:
touch .env.local
Frontend
cd frontend
- Install dependencies
yarn
- Start the development webserver
yarn dev
- Access the site via http://localhost:8080
Backend
cd backend
- Set up a virtual environment (optional)
python3 -m virtualenv venv
source venv/bin/activate
- Install python dependencies
poetry install
./compilers/download.sh
- Install compilers
./compilers/download.sh
- Set up the database
poetry run python manage.py migrate
- Start the API server
poetry run python manage.py runserver
The following setup sections are optional.
Wine setup (for local development, running Windows compilers)
- Create a wineprefix dir
WINEPREFIX=$HOME/.wine WINEARCH=win32 wineboot --init
- Add the WINEPREFIX setting to your .local.env file in the root of the repo
echo "WINEPREFIX=$HOME/.wine" >> .local.env
GitHub authentication
-
Register a new OAuth application
- "Homepage URL" should be the URL you access the frontend on (e.g.
http://localhost:8080) - "Authorization callback URL" should be the same as the homepage URL, but with
/loginappended
- "Homepage URL" should be the URL you access the frontend on (e.g.
-
Edit
.env.local:- Set
GITHUB_CLIENT_IDto the application client ID - Set
GITHUB_CLIENT_SECRETto the application client secret (do not share this)
- Set
Running inside an nginx proxy
Running decomp.me using nginx as a proxy better emulates the production environment and can avoid cookie-related issues.
-
Install nginx
-
Create an nginx site configuration (typically
/etc/nginx/sites-available/decomp.local)
server {
listen 80;
listen [::]:80;
client_max_body_size 5M;
server_name decomp.local www.decomp.local;
location / {
try_files $uri @proxy_frontend;
}
location /api {
try_files $uri @proxy_api;
}
location /admin {
try_files $uri @proxy_api;
}
location /static {
try_files $uri @proxy_api;
}
location @proxy_api {
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:8000;
}
location @proxy_frontend {
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:8080;
}
}
- Enable the site
ln -s /etc/nginx/sites-available/decomp.local /etc/nginx/sites-enabled/decomp.local
- Add the following lines to
/etc/hosts:
127.0.0.1 decomp.local
127.0.0.1 www.decomp.local
-
Edit
.env.local:- Set
API_BASE=/api - Set
ALLOWED_HOSTS=decomp.local
- Set
-
If you set up GitHub authentication, change the application URLs to
http://decomp.localandhttp://decomp.local/login -
Restart nginx, the frontend, and the backend
-
Access the site via http://decomp.local
Sandbox jail
There is support for running subprocesses within nsjail.
This is controlled by the SANDBOX settings, and is disabled by default in the development .env but is enabled inside the backend Docker container.
To enable it locally outside of the Docker container:
-
Build or install
nsjaillocally. Example instructions for Ubuntu:apt-get install autoconf bison flex gcc g++ git libprotobuf-dev libnl-route-3-dev libtool make pkg-config protobuf-compilergit clone --recursive --branch=3.0 https://github.com/google/nsjailcd nsjail && make
-
Enable
unprivileged_userns_clone- Temporary:
sudo sysctl -w kernel.unprivileged_userns_clone=1 - Permanent:
echo 'kernel.unprivileged_userns_clone=1' | sudo tee -a /etc/sysctl.d/00-local-userns.conf && sudo service procps restart
- Temporary:
-
Edit
.env.local:- Set
USE_SANDBOX_JAIL=on - Set
SANDBOX_NSJAIL_BIN_PATHto the absolute path of thensjailbinary built above
- Set
Contributing
Contributions are very much welcome! You may want to join our Discord server.
Storybook
Use yarn storybook to run a Storybook instance on http://localhost:6006. This is useful for testing UI components in isolation.
Linting
- Check frontend
cd frontend
yarn lint
- Autofix frontend
cd frontend
yarn lint --fix
- Check backend
cd backend
mypy
Updating the database
If you modify any database models (models.py), you'll need to run the following to update the database:
poetry run python manage.py makemigrations
poetry run python manage.py migrate
License
decomp.me uses the MIT license. All dependencies may contain their own licenses, which decomp.me respects.