Created
November 17, 2025 12:18
-
-
Save latsku/f88f4a81b5095c5b0faa46359414af22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from scapy.all import DHCP_am | |
| from scapy.base_classes import Net | |
| import subprocess | |
| interface = "eth0" | |
| own_ip = "192.168.10.1" | |
| dhcp_server = DHCP_am(iface=interface, domain='example.com', | |
| pool=Net('192.168.10.0/24'), | |
| network='192.168.10.0/24', | |
| gw=own_ip, | |
| renewal_time=600, lease_time=3600) | |
| subprocess.run(["ip addr add local " + own_ip +"/24 broadcast 192.168.10.255 dev " + interface], shell=True) | |
| print(f"IP set to {own_ip}") | |
| print("Starting DHCP server...") | |
| dhcp_server() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment