Skip to content

Commit 6b76ca7

Browse files
committed
Refactor ransomware application structure and enhance documentation
- Removed `main_v2.py` and integrated its functionality into `main.py` for a cleaner codebase. - Updated `.env.example` to include a newline at the end of the file for consistency. - Enhanced `README.md` with detailed instructions for running the application in Docker, including support for GUI via X11 forwarding. - Updated `requirements.txt` to include additional dependencies for improved functionality and testing.
1 parent 66f2169 commit 6b76ca7

26 files changed

+836
-668
lines changed

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
extension=.wasted
1010
host=127.0.0.1
1111
port=8080
12-
PAYMENT_ADDRESS=your_bitcoin_address_here
12+
PAYMENT_ADDRESS=your_bitcoin_address_here
13+
14+

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.10'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install -r requirements.txt
22+
- name: Lint with flake8
23+
run: |
24+
pip install flake8
25+
flake8 ransomware tests
26+
- name: Run tests
27+
run: |
28+
pytest tests

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.10-slim
2+
3+
# Install system dependencies for GUI
4+
RUN apt-get update && \
5+
apt-get install -y python3-tk xauth x11-apps && \
6+
rm -rf /var/lib/apt/lists/*
7+
8+
WORKDIR /app
9+
10+
COPY requirements.txt ./
11+
RUN pip install --no-cache-dir -r requirements.txt
12+
13+
COPY . .
14+
15+
# Set environment variables for GUI (X11)
16+
ENV DISPLAY=:0
17+
18+
CMD ["python", "main.py", "-e", "-p", "./testDir/banking_samples"]

README.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,61 @@ from ransomware import discover, modify
8686
from ransomware.gui_main import WannaCryGUI
8787
```
8888

89-
All previous functionality is preserved, but now organized for clarity and maintainability.
89+
All previous functionality is preserved, but now organized for clarity and maintainability.
90+
91+
## Running with Docker (with GUI/X11 Support)
92+
93+
This project supports running in a Docker container, including the GUI (Tkinter) via X11 forwarding.
94+
95+
### 1. Build the Docker Image
96+
97+
```sh
98+
docker build -t ransomware-poc .
99+
```
100+
101+
### 2. Run the Container with X11 Forwarding
102+
103+
#### **On Linux**
104+
105+
```sh
106+
xhost +local:root # Allow local root to access X11
107+
108+
docker run -it \
109+
-e DISPLAY=$DISPLAY \
110+
-v /tmp/.X11-unix:/tmp/.X11-unix \
111+
ransomware-poc
112+
```
113+
114+
#### **On macOS**
115+
- Install XQuartz and start it (`open -a XQuartz`).
116+
- In XQuartz preferences, enable "Allow connections from network clients".
117+
- Run:
118+
119+
```sh
120+
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
121+
export DISPLAY=$IP:0
122+
xhost + $IP
123+
124+
docker run -it \
125+
-e DISPLAY=$DISPLAY \
126+
-v /tmp/.X11-unix:/tmp/.X11-unix \
127+
ransomware-poc
128+
```
129+
130+
#### **On Windows (with WSL2)**
131+
- Install an X server (e.g., VcXsrv or Xming) and start it.
132+
- Set the DISPLAY variable in your WSL2 shell:
133+
134+
```sh
135+
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0
136+
export LIBGL_ALWAYS_INDIRECT=1
137+
138+
docker run -it \
139+
-e DISPLAY=$DISPLAY \
140+
-v /tmp/.X11-unix:/tmp/.X11-unix \
141+
ransomware-poc
142+
```
143+
144+
**Note:**
145+
- The GUI will appear on your host system if X11 is set up correctly.
146+
- For headless or server environments, you can run without the GUI by modifying the entrypoint in the Dockerfile.

0 commit comments

Comments
 (0)