Skip to main content

DORA The DHCP Client

Version 0.1.3

A Python command line DHCP client that was designed for troubleshooting. Provides an interface for sending tailored DHCP packets to a DHCP server and inspect the response.

Installation

Python

Run directly with Python3.8, install using pip:

  • pip install dora-dhcp-client

Alternate Installation

Alternately install and run as a Docker image.

sudo curl -L --fail https://raw.githubusercontent.com/vfrazao-ns1/dora_dhcp_client/master/run.sh -o /usr/local/bin/dora
sudo chmod +x /usr/local/bin/dora

Requirements

  • Python 3.8.0 or higher
  • Docker (Optional)

NOTE: This has been tested on Ubuntu 18.04 and Windows WSL. May or may not work on other platforms.

Basic Usage

Check if port 68 (and port 67 if relay field is set) is currently bound to by another program (for example with: sudo netstat -tulpn). If there is anything bound to these ports they must first be killed, and prevented from restarting.

Run dora.py with a -h/--help flag to see all the available options:

$ sudo dora.py -h
usage: dora.py [-h] [-i INTERFACE] [-a MAC_ADDR] [-d] [-u] [-s SERVER] [-r RELAY] [-v] [-o OPTIONS] [-p PORT] [--target_port TARGET_PORT] [-@ TARGET]

optional arguments:
  -h, --help            show this help message and exit
  -i INTERFACE, --interface INTERFACE
                        Interface to bind to and make DHCP requests
  -a MAC_ADDR, --mac_addr MAC_ADDR
                        MAC address to use (default random)
  -d, --debug           Print debug statements
  -u, --unicast         Send DHCP packets over unicast to specified server
  -s SERVER, --server SERVER
                        Server to send DHCP packets. Required for unicast and for relay use.
  -r RELAY, --relay RELAY
                        Address to set the giaddr field to
  -v, --verbose         Verbosity level (v: show ack packet, vv: show all packets, vvv: show debug)
  -o OPTIONS, --options OPTIONS
                        JSON body of options to include in requests
  -p PORT, --port PORT  Port to send packets from on client machine
  --target_port TARGET_PORT
                        Port to send to on target machine
  -@ TARGET             Given an IP address of a DHCP server, sends unicast requests

NOTE: dora.py must be able to bind to port 68 (and 67 under certain circumstances) in order to function properly. This may require the use of sudo. This may also require stopping any services (e.g., systemd-networkd) that are already bound to those ports.

DORA Client Example

Running dora.py without supplying any options just binds to an arbitrary interface and sends out broadcast UDP packets.

-i allows selection of the interface to bind to (e.g., "eth0")

-a allows the MAC address to be set in both the client identifier option and the chaddr field

-d Prints very low level debug statements and includes any Python tracebacks

-u sets the unicast flag in the DHCP packet

-s specifies an unicast address to send the packets to, the -u flag should be selected but doesnt need to be

-r sets the giaddr field of the packet

-v sets the verbosity level of the output. No v flags means that the client will just report success or failure to obtain a lease. A single v flag (-v) will pretty print a human readable form of the DHCPACK packet. This will show the set of options that the DHCP server has sent us back. Two v flags (-vv) will pretty print the all four packets in the lease handshake (DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, DHCPACK). Three v flags will print everything stated before and it will enable the debug output (same as setting the -d flag).

-p sets the client port (default: 68)

--target_port sets the server port (default: 67)

-@ is a convenience flag that sets the unicast flag, sets the giaddr field to the IP of the current machine, and sends unicast packets to the server specified

NOTE the DHCP RFC 2131 sets the client port to 68 and the server port to 67 options that set different client or server ports are not expected to work with an RFC compliant server

Metadata

Release files for dora-dhcp-client 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dora-dhcp-client 0.1.3
File Size Uploaded
dora_dhcp_client-0.1.3.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dora-dhcp-client 0.1.3
File Interpreter ABI Platform
dora_dhcp_client-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 20.4 kB

Release files / dora_dhcp_client-0.1.3.tar.gz

Download URL dora_dhcp_client-0.1.3.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4b422c3111fb32500e428d2d863f180c5042c192a80757078d1d8b12f0c53228
BLAKE2b-256 checksum
How to use checksums
9caee89e88407ce67676560e75ac0db433d1444666448f9945f7fc6924bad10c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.5

Release files / dora_dhcp_client-0.1.3-py3-none-any.whl

Download URL dora_dhcp_client-0.1.3-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7358637e387d9f48a7a3e99e407d7a97e5be9587bd6215ba683b2822eb5d146d
BLAKE2b-256 checksum
How to use checksums
e01e1fc561b9d88df7c6cc287190c6eb44dec8d9c9961c0ffbb1a4b8387af1e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page