From 24f37ceb3a2e312bda0fa78e6f235b890b2a663e Mon Sep 17 00:00:00 2001 From: Wizche Date: Tue, 26 Nov 2019 23:22:45 +0100 Subject: [PATCH] Added new dhcp server version, added asciinema --- Program.cs | 9 +++++++-- README.md | 2 ++ dhcpshot.csproj | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 47d8495..a733de9 100644 --- a/Program.cs +++ b/Program.cs @@ -81,10 +81,15 @@ static void Request(DHCPRequest dhcpRequest, IPAddress targetIp) var replyOptions = new DHCPReplyOptions(); replyOptions.SubnetMask = IPAddress.Parse("255.255.255.0"); - if (type == DHCPMsgType.DHCPDISCOVER) + if (type == DHCPMsgType.DHCPDISCOVER){ + Console.WriteLine($"Received discovery, sending offer!"); dhcpRequest.SendDHCPReply(DHCPMsgType.DHCPOFFER, targetIp, replyOptions); - if (type == DHCPMsgType.DHCPREQUEST) + }else if (type == DHCPMsgType.DHCPREQUEST){ + Console.WriteLine($"Received request, sending ack!"); dhcpRequest.SendDHCPReply(DHCPMsgType.DHCPACK, targetIp, replyOptions); + } else { + Console.WriteLine($"Received unknown DHCP type {type}"); + } } catch (Exception ex) { diff --git a/README.md b/README.md index c745cfe..1d01f79 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # dhcpshot +[![asciicast](https://asciinema.org/a/OyMydvQOw3imDCD9OLiyiPlUB.svg)](https://asciinema.org/a/OyMydvQOw3imDCD9OLiyiPlUB) + Use [DotNetProjects.DhcpServer](https://www.nuget.org/packages/DotNetProjects.DhcpServer/) library to quickly create a predefined DHCP Server answering with a fixed IP to request coming from the interface specified by the user. E.g.: you connect your RPI in DHCP mode directly to your laptop's ethernet interface. ## Publish diff --git a/dhcpshot.csproj b/dhcpshot.csproj index 7d97e7f..5f44272 100644 --- a/dhcpshot.csproj +++ b/dhcpshot.csproj @@ -6,7 +6,7 @@ - +