No description
  • Go 98.7%
  • Batchfile 1.3%
Find a file
2026-06-02 16:26:53 +02:00
.gitattributes User guide pdf 2026-04-24 14:46:24 +02:00
.gitignore Lock/unlock commands 2026-06-02 16:22:37 +02:00
adapter-restore.bat Switch to full CLI and add adapter settings backup 2026-04-24 14:28:17 +02:00
adapter_windows.go Switch to full CLI and add adapter settings backup 2026-04-24 14:28:17 +02:00
amp-lock.bat Lock/unlock commands 2026-06-02 16:22:37 +02:00
amp-unlock.bat Lock/unlock commands 2026-06-02 16:22:37 +02:00
cli_windows.go Switch to full CLI and add adapter settings backup 2026-04-24 14:28:17 +02:00
dhcp_conn_windows.go Add a GUI (not working yet) 2026-03-27 15:16:46 +01:00
elevate_windows.go Switch to full CLI and add adapter settings backup 2026-04-24 14:28:17 +02:00
go.mod WIP websocket connection 2026-03-19 14:33:14 +01:00
go.sum WIP websocket connection 2026-03-19 14:33:14 +01:00
GUIDE_UTILISATEUR_FR.md Update docs 2026-06-02 16:26:53 +02:00
GUIDE_UTILISATEUR_FR.pdf Update docs 2026-06-02 16:26:53 +02:00
main.go Lock/unlock commands 2026-06-02 16:22:37 +02:00
README.md Switch to full CLI and add adapter settings backup 2026-04-24 14:28:17 +02:00
USER_GUIDE.md Update docs 2026-06-02 16:26:53 +02:00
USER_GUIDE.pdf Update docs 2026-06-02 16:26:53 +02:00
websocket.go Lock/unlock commands 2026-06-02 16:22:37 +02:00

apex-network-rescue — DHCP Server

A minimal DHCP server written in Go using github.com/insomniacslk/dhcp.

Automatically configures the host Ethernet adapter with a static IP at startup and reverts it to its original settings (DHCP or previous static IP) when the server is stopped.

Requirements

  • Go 1.21+
  • Windows: must be run as Administrator (required to bind UDP port 67 and to run netsh to configure the adapter)

Build

go build -o apex-network-rescue.exe .

Usage

apex-network-rescue.exe [flags]

Flags:
  -restore     Restore the saved adapter configuration from a previous interrupted run, then exit
  -iface       string   Ethernet adapter name (default: auto-detect first wired adapter)
  -server-ip   string   IP to assign to the adapter; also used as gateway (default: 192.168.100.1)
  -range-start string   First IP in the assignable pool (default: 192.168.100.100)
  -range-end   string   Last IP in the assignable pool  (default: 192.168.100.200)
  -lease       duration Lease duration, e.g. 12h, 30m   (default: 24h)

Quick start

  1. Connect your Windows machine to the target machine via an Ethernet cable.
  2. Open an Administrator command prompt and run:
apex-network-rescue.exe

The CLI will ask you to acknowledge the adapter warning and confirm the Ethernet cable is connected. It will then:

  • Auto-detect the first wired Ethernet adapter
  • Save its current IP configuration
  • Assign it the static IP 192.168.100.1 / 255.255.255.0
  • Check whether the amplifier already has a reachable IP on the subnet and use it directly when found
  • Start the DHCP server
  • Wait for the client to answer ping and for TCP port 5678 to become reachable before attempting the WebSocket command
  • Restore the original adapter configuration before exiting

The target machine will receive an address in 192.168.100.100 192.168.100.200 with:

  • Gateway: 192.168.100.1
  • DNS: 1.1.1.1, 8.8.8.8
  • Lease: 24 hours
  1. Press Ctrl+C to cancel. The adapter is automatically reverted to its original configuration (DHCP or previous static IP) when a saved state is available.

If you run the program from a non-Administrator shell, it exits with a console error instead of opening a Windows elevation prompt.

If the program is interrupted and leaves the adapter in an intermediate state, relaunch it as Administrator with:

apex-network-rescue.exe -restore

The console only shows user-facing prompts, progress, and plain errors. Detailed runtime logs are appended to apex-network-rescue.log next to the executable. If the app hangs, that file should show the last completed startup step.

Specifying the adapter manually

If auto-detection picks the wrong adapter, pass its name explicitly:

apex-network-rescue.exe -iface "Ethernet 2"

The adapter name is shown in Network Connections (ncpa.cpl).

Defaults at a glance

Setting Default value
Server IP 192.168.100.1
Subnet mask 255.255.255.0 (/24)
Pool start 192.168.100.100
Pool end 192.168.100.200
Gateway same as Server IP
DNS 1.1.1.1, 8.8.8.8
Lease time 24h

How it works

Step What happens
1 Finds the Ethernet adapter (auto or -iface)
2 Saves the adapter's current IP config via netsh
3 Applies the static server IP via netsh
4 Binds the DHCP socket to the server IP (forces Windows to route broadcasts out the correct adapter)
5 Handles DISCOVER → OFFER → REQUEST → ACK and RELEASE
6 On Ctrl+C / SIGTERM: reverts the adapter and exits

Leases are held in memory only and are lost on restart.