项目作者: IT-Department-Projects

项目描述 :
[ONGOING] Simple Raw Socket program to implement Dynamic Host Control Protocol (DHCP) in C.
高级语言: C
项目地址: git://github.com/IT-Department-Projects/Networks-Project.git
创建时间: 2016-12-17T11:28:11Z
项目社区:https://github.com/IT-Department-Projects/Networks-Project

开源协议:MIT License

下载


Networks-Project

  • Raw Socket program to implement Dynamic Host Control Protocol (DHCP)

How to run the socket

  • You need to give sudo permission for the scoket program to compile and run.
  1. sudo su
  2. gcc raw_socket.c
  3. ./a.out

Instruction to run the file

  • First get the interface by running ifconfig command in terminal
  • It will give ex: enp9s8
    1. sudo gcc dhcp.c -lpcap
    2. sudo ./a.out enp9s8

Output:

  1. enp9s8 MAC : 40:47:17:14:19:CA
  2. Sending DHCP_DISCOVERY
  3. dhcp.c:269:ether_output::Send 300 bytes
  4. Waiting for DHCP_OFFER
  5. dhcp.c:243:ether_input::Received a frame with length of [334]
  6. 0000 :: 20 47 47 44 0e ca 00 17 7c 55 3b 8a 08 00 45 10
  7. 0010 :: 01 40 00 00 00 00 10 11 26 46 c0 a8 01 01 c0 b8
  8. 0020 :: 01 06 00 43 00 44 01 2c 0e 66 02 01 06 00 00 00
  9. 0030 :: 00 00 00 00 00 00 00 00 00 00 c0 a8 01 06 00 00
  10. 0040 :: 00 00 00 00 00 00 10 47 47 42 0e ca 00 00 f5 26
  11. 0050 :: 1b 5b 68 5f 00 00 00 00 00 00 00 00 00 00 00 00
  12. 0060 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  13. 0070 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  14. 0080 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  15. 0090 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  16. 00a0 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  17. 00b0 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  18. 00c0 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  19. 00d0 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  20. 00e0 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  21. 00f0 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  22. 0100 :: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  23. 0110 :: 00 00 00 00 00 00 63 82 53 63 35 01 02 36 04 c0
  24. 0120 :: a8 01 01 33 04 00 01 51 80 01 04 ff ff ff 00 03
  25. 0130 :: 04 c0 a8 01 01 06 08 da f8 f5 09 da f8 ff 93 0f
  26. 0140 :: 0b 64 6f 6d 61 69 6e 2e 6e 61 6d 65 ff 00 Got IP 192.168.4.5