updated README.md
This commit is contained in:
137
README.md
137
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/<dein-repo>/simple-dhcp-server.git
|
||||||
|
cd simple-dhcp-server
|
||||||
pip install -r requirements.txt
|
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
|
||||||
|
|
||||||
```
|
### 1) GUI starten
|
||||||
python src/main.py
|
|
||||||
|
> **Root-Rechte sind erforderlich**, da Port 67 (<1024) privilegiert ist.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo -E python3 main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
2. The GUI will display a dropdown menu with available network interfaces. Select the desired interface.
|
### 2) Interface auswählen
|
||||||
|
|
||||||
3. Enter the desired IP address and subnet mask in the provided fields.
|
* Wähle das Interface (z. B. `eth0`) aus der Dropdown-Liste.
|
||||||
|
* IP & Subnetz werden automatisch eingetragen (kann angepasst werden).
|
||||||
|
* ⚠️ **Warnmeldung** bestätigen.
|
||||||
|
|
||||||
4. Use the "Start" button to start the DHCP server. The application will begin managing DHCP leases and display active clients in the list.
|
### 3) Server starten
|
||||||
|
|
||||||
5. To stop the DHCP server, click the "Stop" button.
|
* **Start** klicken → Log zeigt „Listening on UDP/67“.
|
||||||
|
* DHCP-Clients können jetzt Adressen beziehen.
|
||||||
|
|
||||||
## Contributing
|
---
|
||||||
|
|
||||||
Feel free to contribute to this project by submitting issues or pull requests. Your feedback and contributions are welcome!
|
## 🧪 Testen
|
||||||
|
|
||||||
## License
|
### Mit `dhclient`
|
||||||
|
|
||||||
This project is licensed under the MIT License. See the LICENSE file for more details.
|
```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!
|
||||||
|
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user