diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ce17827 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# Use official Python 3.10 slim image +FROM python:3.10-slim + +# Set working directory +WORKDIR /PSFree + +# Copy all files/folders from current directory into /PSFree +COPY . /PSFree + +# Install required packages +RUN pip install --no-cache-dir rich + +# Expose your app port (adjust if your app uses a different port) +EXPOSE 52721 + +# Run the python server +CMD ["python", "serve.py"] diff --git a/README.md b/README.md index ecc70dd..59e808d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,24 @@ PSFree is a collection of exploits for the PS4 console. The main focus of the re - **WebKit Exploit (PSFree):** Entry point via the console's web browser. - **Kernel Exploit (Lapse):** Escalates privileges to kernel level. - **Payload Loader:** After successful kernel exploitation listens for a payload on port 9020. +- **Docker Support:** This repository is now fully dockerized, allowing PSFree to be hosted easily without manual dependency setup. + +## Quickstart (Docker Compose) + +clone the repo +git clone https://zit.zo0.zip/zo0/PSFree-Enhanced-Dockerized + +Build the docker image with +docker build -t psfe:latest . + +```yaml +services: + webapp: + image: psfe:latest + container_name: psfe + ports: + - "52721:52721" + restart: unless-stopped ## Vulnerability Scope diff --git a/serve.py b/serve.py new file mode 100644 index 0000000..0b51afc --- /dev/null +++ b/serve.py @@ -0,0 +1,88 @@ +import sys +import socket +import os +from http.server import SimpleHTTPRequestHandler +from socketserver import TCPServer +from rich.console import Console +from rich.panel import Panel +from rich.text import Text +import json +from datetime import datetime +import hashlib +import urllib.request +import re + +console = Console() + +def get_machine_ip(): + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + try: + # doesn't have to be reachable + s.connect(('8.8.8.8', 80)) + ip = s.getsockname()[0] + except Exception: + ip = '127.0.0.1' + finally: + s.close() + return ip + +def is_docker(): + # Check for .dockerenv file + if os.path.exists('/.dockerenv'): + return True + # Check cgroup info for docker + try: + with open('/proc/1/cgroup', 'rt') as f: + return 'docker' in f.read() or 'kubepods' in f.read() + except Exception: + return False + +def get_host_ip(): + try: + # Try resolving Docker internal host (works on Docker Desktop and configured Linux setups) + host_ip = socket.gethostbyname('host.docker.internal') + return host_ip + except socket.error: + # Fallback if not resolved, may use default gateway IP (requires extra code) or local IP + return 'Could not determine host IP' + +def get_ipv4(): + if is_docker(): + ip = get_host_ip() + if ip: + print(f"Running inside Docker. Host IPv4: {ip}") + else: + print("Running inside Docker, but could not resolve host.docker.internal.") + else: + ip = get_machine_ip() + print(f"Not in Docker. Machine IPv4: {ip}") + return ip + +PORT = 52721 +IP = get_ipv4() + +if len(sys.argv) > 1: + try: + PORT = int(sys.argv[1]) + except ValueError: + console.print("[bold red]Usage:[/] python serve.py [port]", style="red") + sys.exit(1) + +console.print(Panel(Text("Simple Python HTTP Server", style="bold white on blue"), + subtitle="Press [bold yellow]Ctrl+C[/] to stop the server", expand=False)) + +console.print( + f"[green]Server is running![/]\n" + f"Listening on [bold magenta]http://{IP}:{PORT}[/]\n", + style="bold", +) + +try: + with TCPServer(("0.0.0.0", PORT), SimpleHTTPRequestHandler) as httpd: + httpd.serve_forever() +except KeyboardInterrupt: + console.print("\n[bold red]Server stopped by user.[/]") +except OSError as e: + console.print(f"[bold red]Error:[/] {e}") + + diff --git a/start_server.sh b/start_server.sh new file mode 100644 index 0000000..7f93cc4 --- /dev/null +++ b/start_server.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Check if python3 is installed +if ! command -v python3 &> /dev/null +then + echo "python3 could not be found. Please install Python 3." + exit 1 +fi + +# Create virtual environment if it doesn't exist +if [ ! -d ".venv" ]; then + echo "Creating virtual environment..." + python3 -m venv .venv +fi + +# Activate virtual environment +source .venv/bin/activate + +# Check pip version and upgrade if needed +PIP_VERSION=$(pip show pip 2>/dev/null | grep Version | awk '{print $2}') +if [ -z "$PIP_VERSION" ]; then + echo "pip not found, installing pip..." + python3 -m ensurepip --upgrade +else + echo "Upgrading pip..." + pip install --upgrade pip +fi + +# Check if rich is installed, install if not +if pip show rich > /dev/null 2>&1; then + echo "rich is already installed." +else + echo "Installing rich..." + pip install rich +fi + +# Run the server +python serve.py