From 044973230eae616de8c0411f5d4b60fab7d68b44 Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Thu, 11 Sep 2025 11:33:29 +0200 Subject: [PATCH] updated README.md --- README.md | 139 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 105 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index d3929d1..a6c99ae 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,126 @@ -# Python DHCP Tkinter Application +# 🖧 Simple DHCP Server (Lab Edition) -This project is a simple DHCP server application built using Python and Tkinter. It provides a graphical user interface (GUI) for managing DHCP leases and clients. +Ein minimalistischer, aber funktionsfähiger **IPv4-DHCP-Server** mit GUI – ideal zum Basteln, Testen und für kleine Lab-Setups mit Raspberry Pi oder PC. -## Project Structure +⚠️ **Warnung:** Ein DHCP-Server im falschen Netz kann *massives Chaos* auslösen (IP-Konflikte, Netzwerkausfall). +Benutze dieses Tool nur in isolierten Testumgebungen oder auf einem dedizierten Interface! -``` -python-dhcp-tk-app -├── src -│ ├── main.py # Entry point of the application -│ ├── dhcp_server.py # Contains the DHCPServer class -│ ├── gui.py # Defines the GUI layout -│ ├── utils.py # Utility functions for networking tasks -│ └── types -│ └── __init__.py # Custom types and data structures -├── requirements.txt # Project dependencies -└── README.md # Project documentation -``` +--- -## Requirements +## ✨ Features -To run this project, you need to install the following dependencies: +- **GUI-basiert**: Start/Stop per Button, aktive Clients & Leases live sehen +- **Interface-selektiert**: bindet *exklusiv* auf das gewählte Interface (`SO_BINDTODEVICE`) +- **Preflight-Checks**: + - prüft Root-Rechte vor dem Start + - prüft, ob Port 67 bindbar ist +- **Leichte Konfiguration**: + - liest IP & Subnetz des gewählten Interface automatisch aus + - vergibt Adressen aus einem dynamischen Pool (ab Start-IP) +- **Log-Panel & Statusleiste**: zeigt DHCP-Events in Echtzeit +- **Echte DHCP-Pakete**: DISCOVER → OFFER, REQUEST → ACK, RELEASE → Lease-Freigabe -- tkinter -- (any additional libraries required for DHCP functionality) +--- -You can install the required packages using pip: +## 🛠 Installation -``` +```bash +git clone https://github.com//simple-dhcp-server.git +cd simple-dhcp-server pip install -r requirements.txt +```` + +### Dependencies + +* Python 3.9+ +* `psutil` (Interface-Infos) +* optional: `sv-ttk` für schickes Dark-Theme + +```bash +pip install psutil sv-ttk ``` -## Usage +--- -1. Run the application by executing the `main.py` file: +## 🚀 Starten - ``` - python src/main.py - ``` +### 1) GUI starten -2. The GUI will display a dropdown menu with available network interfaces. Select the desired interface. +> **Root-Rechte sind erforderlich**, da Port 67 (<1024) privilegiert ist. -3. Enter the desired IP address and subnet mask in the provided fields. +```bash +sudo -E python3 main.py +``` -4. Use the "Start" button to start the DHCP server. The application will begin managing DHCP leases and display active clients in the list. +### 2) Interface auswählen -5. To stop the DHCP server, click the "Stop" button. +* Wähle das Interface (z. B. `eth0`) aus der Dropdown-Liste. +* IP & Subnetz werden automatisch eingetragen (kann angepasst werden). +* ⚠️ **Warnmeldung** bestätigen. -## Contributing +### 3) Server starten -Feel free to contribute to this project by submitting issues or pull requests. Your feedback and contributions are welcome! +* **Start** klicken → Log zeigt „Listening on UDP/67“. +* DHCP-Clients können jetzt Adressen beziehen. -## License +--- -This project is licensed under the MIT License. See the LICENSE file for more details. \ No newline at end of file +## 🧪 Testen + +### Mit `dhclient` + +```bash +sudo dhclient -v -i -4 -d -sf /bin/true eth0 +``` + +* `-sf /bin/true` verhindert Änderungen an `/etc/resolv.conf` +* Du solltest in der GUI sehen, wie der Client einen Lease bekommt. + +### Mit `nmap` + +```bash +sudo nmap --script broadcast-dhcp-discover -e eth0 +``` + +Zeigt DHCP-Server im Netz. Dein Server sollte mit OFFER antworten. + +### Mit `tcpdump` sniffen + +```bash +sudo tcpdump -ni eth0 port 67 or port 68 +``` + +Zeigt DISCOVER/OFFER/REQUEST/ACK Pakete live. + +--- + +## 🔒 Sicherheit & Best Practices + +* **Nur in isolierten Netzen verwenden** (Lab, VLAN, Test-Switch). +* Auf Produktivsystemen immer **statische IP** für den Server selbst setzen, sonst könnte er seine eigene IP verlieren. +* Bei Mehr-Interface-Hosts genau überlegen, auf welchem Interface der Server laufen soll. + +--- + +## 🛑 Stoppen + +Einfach **Stop** in der GUI klicken oder Fenster schließen. +Leases werden nur im Speicher gehalten (kein persistentes Lease-File). + +--- + +## 🧭 Roadmap + +* [ ] Lease-Persistenz (JSON oder SQLite) +* [ ] Statische MAC-Reservierungen +* [ ] Konfigurierbarer Pool (Start/End-Adresse) +* [ ] Unterstützung für Option 3 (Router) & Option 6 (DNS) konfigurierbar + +--- + +## ⚠️ Haftungsausschluss + +Dies ist ein **Entwicklungs- und Lern-Tool**. Es ist *nicht* als Ersatz für produktive DHCP-Server gedacht. +Benutzung auf eigene Gefahr – prüfe deine Netzumgebung sorgfältig, bevor du den Server startest! + +```