diff --git a/src/construct_eap_frames.c b/src/construct_eap_frames.c index c8ec632..bafbeee 100644 --- a/src/construct_eap_frames.c +++ b/src/construct_eap_frames.c @@ -85,41 +85,79 @@ static void construct_ethernet_frame_header(uint8_t *packet, const uint8_t *src_ void construct_eapol_start_frame(const uint8_t *frame) { - const uint16_t EAPOL_START_PACKET_LENGTH = 1000; // send to server packet length + const uint16_t EAPOL_START_PACKET_LENGTH = 524; // send to server packet length extern uint8_t eapol_start[]; const uint8_t eapol_version[] = {0x01}; const uint8_t eapol_type[] = {0x01}; // type: eapol start const uint8_t eapol_start_dst_MAC[] = {0x01, 0xd0, 0xf8, 0x00, 0x00, 0x03}; const uint8_t eapol_frame_length[] = {0x00, 0x00}; - const uint8_t ethernet_padding[] = {0xff, 0xff, 0x37, 0x77, 0x7f, 0xca, 0x57, 0xef, - 0xaf, 0x00, 0x00, 0xff, 0xff, 0xca, 0x57, 0xff, - 0x7f, 0xca, 0x77, 0xef, 0xfb, 0x57, 0x9e, 0x00, - 0x00, 0x13, 0x11, 0x38, 0x30, 0x32, 0x31, 0x78, - 0x2e, 0x65, 0x78, 0x65, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 - }; - const uint8_t ethernet_trailer[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x13, 0x11, 0x01, 0xdf, - 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, 0x17, - 0x22, 0x35, 0x44, 0x41, 0x30, 0x34, 0x41, - 0x31, 0x33, 0x31, 0x45, 0x35, 0x36, 0x32, - 0x35, 0x36, 0x37, 0x35, 0x32, 0x39, 0x35, - 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, - 0x43, 0x33, 0x38, 0x38, 0x34, 0x1a, 0x0c, - 0x00, 0x00, 0x13, 0x11, 0x18, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x1a, 0x0e, 0x00, 0x00, - 0x13, 0x11, 0x2d, 0x08, 0xf0, 0x76, 0x1c, - 0x5b, 0xcc, 0x7b, 0x1a, 0x18, 0x00, 0x00, - 0x13, 0x11, 0x2f, 0x12, 0x9a, 0x85, 0x96, - 0x6a, 0x42, 0x63, 0x1c, 0x54, 0xf2, 0x4f, - 0xc6, 0x2f, 0x85, 0x71, 0xe8, 0x15, 0x1a, - 0x09, 0x00, 0x00, 0x13, 0x11, 0x35, 0x03, - 0x03, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, - 0x36, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x5a, 0x69, 0x6c, 0xff, 0xfe, 0x5e, 0xc0, 0x2c, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x38, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0xdf, 0x8e, 0x60, 0xf8, 0x26, 0x0b, 0x8b, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x4e, 0x12, 0x20, 0x01, 0x02, 0x50, 0x68, 0x01, 0x55, 0x01, 0x58, 0xdf, 0x8e, 0x60, 0xf8, 0x26, 0x0b, 0x8b, 0x1a, 0x88, 0x00, 0x00, 0x13, 0x11, 0x4d, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, 0x39, 0x22, 0xc1, 0xaa, 0xcd, 0xa8, 0xbf, 0xed, 0xb4, 0xf8, 0xbd, 0xd3, 0xc8, 0xeb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x48, 0x00, 0x00, 0x13, 0x11, 0x54, 0x42, 0x32, 0x30, 0x31, 0x35, 0x30, 0x32, 0x30, 0x39, 0x34, 0x30, 0x31, 0x35, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x62, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x6b, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x70, 0x03, 0x40, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x6f, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x79, 0x03, 0x02, 0x1a, 0x0f, 0x00, 0x00, 0x13, 0x11, 0x76, 0x09, 0x38, 0x2e, 0x38, 0x2e, 0x38, 0x2e, 0x38 - }; + const uint8_t ethernet_padding[] = {0xff, 0xff, 0x37, 0x77, 0xff, 0xaf, /* ....7w.. */ + 0xf7, 0xff, 0xe5, 0x00, 0xff, 0xff, 0xff, 0xaf, /* ........ */ + 0xf7, 0xff, 0x80, 0x01, 0xff, 0xff, 0x53, 0x3e, /* ......S> */ + 0x4a, 0x00, 0x00, 0x13, 0x11, 0x38, 0x30, 0x32, /* J....802 */ + 0x31, 0x78, 0x2e, 0x65, 0x78, 0x65, 0x00, 0x00, /* 1x.exe.. */ + 0x00, 0x00, 0x00, 0x00 + }; + const uint8_t ethernet_trailer[] = {0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1f, 0x01, /* ........ */ + 0x02, 0x00, 0x00, 0x00, 0x13, 0x11, 0x01, 0xb4, /* ........ */ + 0x1a, 0x0c, 0x00, 0x00, 0x13, 0x11, 0x18, 0x06, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x0e, 0x00, 0x00, /* ........ */ + 0x13, 0x11, 0x2d, 0x08, 0x08, 0x00, 0x27, 0x69, /* ..-...'i */ + 0x25, 0x6a, 0x1a, 0x08, 0x00, 0x00, 0x13, 0x11, /* %j...... */ + 0x2f, 0x02, 0x1a, 0x08, 0x00, 0x00, 0x13, 0x11, /* /....... */ + 0x76, 0x02, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, /* v....... */ + 0x35, 0x03, 0x02, 0x1a, 0x18, 0x00, 0x00, 0x13, /* 5....... */ + 0x11, 0x36, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, /* .6...... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x1a, 0x18, 0x00, 0x00, 0x13, /* ........ */ + 0x11, 0x38, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, /* .8...... */ + 0x00, 0x00, 0x00, 0x0a, 0x00, 0x27, 0xff, 0xfe, /* .....'.. */ + 0x69, 0x25, 0x6a, 0x1a, 0x18, 0x00, 0x00, 0x13, /* i%j..... */ + 0x11, 0x4e, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, /* .N...... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x1a, 0x88, 0x00, 0x00, 0x13, /* ........ */ + 0x11, 0x4d, 0x82, 0x63, 0x65, 0x64, 0x66, 0x65, /* .M.cedfe */ + 0x62, 0x31, 0x64, 0x37, 0x66, 0x37, 0x31, 0x34, /* b1d7f714 */ + 0x35, 0x34, 0x36, 0x65, 0x35, 0x37, 0x63, 0x61, /* 546e57ca */ + 0x32, 0x33, 0x62, 0x35, 0x36, 0x65, 0x31, 0x38, /* 23b56e18 */ + 0x38, 0x38, 0x62, 0x31, 0x63, 0x35, 0x37, 0x36, /* 88b1c576 */ + 0x37, 0x38, 0x30, 0x62, 0x36, 0x38, 0x64, 0x61, /* 780b68da */ + 0x32, 0x37, 0x36, 0x34, 0x62, 0x32, 0x64, 0x61, /* 2764b2da */ + 0x39, 0x62, 0x61, 0x64, 0x66, 0x36, 0x38, 0x66, /* 9badf68f */ + 0x65, 0x37, 0x39, 0x31, 0x33, 0x30, 0x37, 0x34, /* e7913074 */ + 0x30, 0x39, 0x37, 0x35, 0x39, 0x36, 0x35, 0x32, /* 09759652 */ + 0x33, 0x32, 0x63, 0x35, 0x61, 0x35, 0x65, 0x33, /* 32c5a5e3 */ + 0x36, 0x62, 0x30, 0x30, 0x63, 0x30, 0x39, 0x34, /* 6b00c094 */ + 0x30, 0x31, 0x64, 0x30, 0x66, 0x64, 0x38, 0x31, /* 01d0fd81 */ + 0x31, 0x37, 0x39, 0x61, 0x33, 0x31, 0x38, 0x62, /* 179a318b */ + 0x36, 0x36, 0x35, 0x38, 0x37, 0x66, 0x66, 0x39, /* 66587ff9 */ + 0x65, 0x34, 0x39, 0x61, 0x61, 0x39, 0x38, 0x66, /* e49aa98f */ + 0x35, 0x64, 0x30, 0x1a, 0x28, 0x00, 0x00, 0x13, /* 5d0.(... */ + 0x11, 0x39, 0x22, 0xd2, 0xc6, 0xb6, 0xaf, 0x00, /* .9"..... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x1a, 0x48, 0x00, 0x00, 0x13, /* ....H... */ + 0x11, 0x54, 0x42, 0x56, 0x42, 0x34, 0x64, 0x39, /* .TBVB4d9 */ + 0x65, 0x62, 0x64, 0x62, 0x65, 0x2d, 0x30, 0x64, /* ebdbe-0d */ + 0x35, 0x64, 0x62, 0x32, 0x39, 0x36, 0x20, 0x00, /* 5db296 . */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x1a, 0x08, 0x00, 0x00, 0x13, /* ........ */ + 0x11, 0x55, 0x02, 0x1a, 0x09, 0x00, 0x00, 0x13, /* .U...... */ + 0x11, 0x62, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, /* .b...... */ + 0x13, 0x11, 0x70, 0x03, 0x40, 0x1a, 0x1e, 0x00, /* ..p.@... */ + 0x00, 0x13, 0x11, 0x6f, 0x18, 0x52, 0x47, 0x2d, /* ...o.RG- */ + 0x53, 0x55, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x4c, /* SU For L */ + 0x69, 0x6e, 0x75, 0x78, 0x20, 0x56, 0x31, 0x2e, /* inux V1. */ + 0x33, 0x30, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, /* 30...... */ + 0x11, 0x79, 0x03, 0x02 /* .y.. */ /* .y.. */ + }; extern uint8_t *service_name; extern unsigned int midnight_mode_change_tail_data; @@ -222,14 +260,14 @@ void construct_eapol_start_frame(const uint8_t *frame) //void construct_eap_response_identity_frame(const uint8_t *dst_MAC, const uint8_t eap_id) void construct_eap_response_identity_frame(const uint8_t *frame) { - const uint16_t EAP_RESPONSE_IDENTITY_LENGTH = 1000; // send to server packet length + const uint16_t EAP_RESPONSE_IDENTITY_LENGTH = 538; // send to server packet length extern uint8_t eap_response_identity[]; const uint8_t eapol_version[] = {0x01}; const uint8_t eapol_type[] = {0x00}; // type: eapol start - const uint8_t eapol_frame_length[] = {0x00, 0x11}; + const uint8_t eapol_frame_length[] = {0x00, 0x0e}; // const uint8_t eap_header[] = {0x02, 0x01, 0x00, 0x11}; const uint8_t eap_id = frame[EAP_ID_ADDRESS_IN_EAP_IDENTITY_REQUEST_FRAME]; - const uint8_t eap_header[] = {0x02, eap_id, 0x00, 0x11}; + const uint8_t eap_header[] = {0x02, eap_id, 0x00, 0x0e}; const uint8_t eap_type[] = {0x01}; // type: eap packet extern uint8_t *service_name; extern char *username; @@ -237,15 +275,74 @@ void construct_eap_response_identity_frame(const uint8_t *frame) uint8_t *eap_data = NULL; uint8_t *dst_MAC = NULL; // uint8_t eap_id = 0x01; // default 0x01, 详见 RFC 3748 - const uint8_t ethernet_padding[] = {0xff, 0xff, 0x37, 0x77, 0x7f, 0xca, 0x57, 0xef, - 0xaf, 0x00, 0x00, 0xff, 0xff, 0xca, 0x57, 0xff, - 0x7f, 0xb1, 0xb1, 0xb1, 0xb1, 0xfd, 0x7c, 0x00, - 0x00 - }; - - const uint8_t ethernet_trailer[] = {0x13, 0x11, 0x38, 0x30, 0x32, 0x31, 0x78, 0x2e, - 0x65, 0x78, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x32, 0x00, 0x00, 0x13, 0x11, 0x01, 0xdf, 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, 0x17, 0x22, 0x35, 0x44, 0x41, 0x30, 0x34, 0x41, 0x31, 0x33, 0x31, 0x45, 0x35, 0x36, 0x32, 0x35, 0x36, 0x37, 0x35, 0x32, 0x39, 0x35, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x33, 0x38, 0x38, 0x34, 0x1a, 0x0c, 0x00, 0x00, 0x13, 0x11, 0x18, 0x06, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x0e, 0x00, 0x00, 0x13, 0x11, 0x2d, 0x08, 0xf0, 0x76, 0x1c, 0x5b, 0xcc, 0x7b, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x2f, 0x12, 0x9a, 0x85, 0x96, 0x6a, 0x42, 0x63, 0x1c, 0x54, 0xf2, 0x4f, 0xc6, 0x2f, 0x85, 0x71, 0xe8, 0x15, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x35, 0x03, 0x03, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x36, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x69, 0x6c, 0xff, 0xfe, 0x5e, 0xc0, 0x2c, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x38, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0xdf, 0x8e, 0x60, 0xf8, 0x26, 0x0b, 0x8b, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x4e, 0x12, 0x20, 0x01, 0x02, 0x50, 0x68, 0x01, 0x55, 0x01, 0x58, 0xdf, 0x8e, 0x60, 0xf8, 0x26, 0x0b, 0x8b, 0x1a, 0x88, 0x00, 0x00, 0x13, 0x11, 0x4d, 0x82, 0x30, 0x61, 0x31, 0x64, 0x36, 0x35, 0x35, 0x37, 0x30, 0x39, 0x33, 0x64, 0x37, 0x30, 0x38, 0x32, 0x62, 0x38, 0x66, 0x31, 0x62, 0x34, 0x66, 0x30, 0x66, 0x64, 0x38, 0x31, 0x37, 0x61, 0x32, 0x64, 0x36, 0x64, 0x35, 0x65, 0x65, 0x30, 0x61, 0x63, 0x35, 0x30, 0x32, 0x36, 0x38, 0x36, 0x66, 0x66, 0x63, 0x33, 0x30, 0x62, 0x36, 0x37, 0x31, 0x63, 0x64, 0x38, 0x66, 0x65, 0x64, 0x34, 0x39, 0x33, 0x34, 0x38, 0x30, 0x36, 0x33, 0x61, 0x38, 0x38, 0x37, 0x66, 0x31, 0x31, 0x65, 0x32, 0x32, 0x65, 0x63, 0x63, 0x30, 0x34, 0x61, 0x39, 0x63, 0x33, 0x64, 0x39, 0x35, 0x30, 0x38, 0x61, 0x64, 0x36, 0x31, 0x34, 0x61, 0x61, 0x61, 0x61, 0x38, 0x32, 0x35, 0x35, 0x64, 0x33, 0x32, 0x38, 0x31, 0x62, 0x31, 0x37, 0x61, 0x30, 0x33, 0x36, 0x65, 0x62, 0x30, 0x32, 0x63, 0x62, 0x39, 0x65, 0x62, 0x33, 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, 0x39, 0x22, 0xc1, 0xaa, 0xcd, 0xa8, 0xbf, 0xed, 0xb4, 0xf8, 0xbd, 0xd3, 0xc8, 0xeb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x48, 0x00, 0x00, 0x13, 0x11, 0x54, 0x42, 0x32, 0x30, 0x31, 0x35, 0x30, 0x32, 0x30, 0x39, 0x34, 0x30, 0x31, 0x35, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x62, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x6b, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x70, 0x03, 0x40, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x6f, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x79, 0x03, 0x02, 0x1a, 0x0f, 0x00, 0x00, 0x13, 0x11, 0x76, 0x09, 0x38, 0x2e, 0x38, 0x2e, 0x38, 0x2e, 0x38 - }; + const uint8_t ethernet_padding[] = {0xff, 0xff, 0x37, 0x77, 0xff, 0xaf, 0xf7, 0xff, /* ..7w.... */ + 0xe5, 0x00, 0xff, 0xff, 0xff, 0xaf, 0xf7, 0xff, /* ........ */ + 0x80, 0x01, 0xff, 0xff, 0x53, 0x3e, 0x4a, 0x00, /* ....S>J. */ + 0x00, 0x13, 0x11, 0x38 + }; + + const uint8_t ethernet_trailer[] = {0x30, 0x32, 0x31, 0x78, /* ...8021x */ + 0x2e, 0x65, 0x78, 0x65, 0x00, 0x00, 0x00, 0x00, /* .exe.... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x01, 0x1f, 0x01, 0x02, 0xd0, /* ........ */ + 0x00, 0x00, 0x13, 0x11, 0x01, 0xb4, 0x1a, 0x0c, /* ........ */ + 0x00, 0x00, 0x13, 0x11, 0x18, 0x06, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x1a, 0x0e, 0x00, 0x00, 0x13, 0x11, /* ........ */ + 0x2d, 0x08, 0x08, 0x00, 0x27, 0x69, 0x25, 0x6a, /* -...'i%j */ + 0x1a, 0x08, 0x00, 0x00, 0x13, 0x11, 0x2f, 0x02, /* ....../. */ + 0x1a, 0x08, 0x00, 0x00, 0x13, 0x11, 0x76, 0x02, /* ......v. */ + 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x35, 0x03, /* ......5. */ + 0x02, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x36, /* .......6 */ + 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x38, /* .......8 */ + 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x0a, 0x00, 0x27, 0xff, 0xfe, 0x69, 0x25, /* ...'..i% */ + 0x6a, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x4e, /* j......N */ + 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x1a, 0x88, 0x00, 0x00, 0x13, 0x11, 0x4d, /* .......M */ + 0x82, 0x63, 0x65, 0x64, 0x66, 0x65, 0x62, 0x31, /* .cedfeb1 */ + 0x64, 0x37, 0x66, 0x37, 0x31, 0x34, 0x35, 0x34, /* d7f71454 */ + 0x36, 0x65, 0x35, 0x37, 0x63, 0x61, 0x32, 0x33, /* 6e57ca23 */ + 0x62, 0x35, 0x36, 0x65, 0x31, 0x38, 0x38, 0x38, /* b56e1888 */ + 0x62, 0x31, 0x63, 0x35, 0x37, 0x36, 0x37, 0x38, /* b1c57678 */ + 0x30, 0x62, 0x36, 0x38, 0x64, 0x61, 0x32, 0x37, /* 0b68da27 */ + 0x36, 0x34, 0x62, 0x32, 0x64, 0x61, 0x39, 0x62, /* 64b2da9b */ + 0x61, 0x64, 0x66, 0x36, 0x38, 0x66, 0x65, 0x37, /* adf68fe7 */ + 0x39, 0x31, 0x33, 0x30, 0x37, 0x34, 0x30, 0x39, /* 91307409 */ + 0x37, 0x35, 0x39, 0x36, 0x35, 0x32, 0x33, 0x32, /* 75965232 */ + 0x63, 0x35, 0x61, 0x35, 0x65, 0x33, 0x36, 0x62, /* c5a5e36b */ + 0x30, 0x30, 0x63, 0x30, 0x39, 0x34, 0x30, 0x31, /* 00c09401 */ + 0x64, 0x30, 0x66, 0x64, 0x38, 0x31, 0x31, 0x37, /* d0fd8117 */ + 0x39, 0x61, 0x33, 0x31, 0x38, 0x62, 0x36, 0x36, /* 9a318b66 */ + 0x35, 0x38, 0x37, 0x66, 0x66, 0x39, 0x65, 0x34, /* 587ff9e4 */ + 0x39, 0x61, 0x61, 0x39, 0x38, 0x66, 0x35, 0x64, /* 9aa98f5d */ + 0x30, 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, 0x39, /* 0.(....9 */ + 0x22, 0xd2, 0xc6, 0xb6, 0xaf, 0x00, 0x00, 0x00, /* "....... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x1a, 0x48, 0x00, 0x00, 0x13, 0x11, 0x54, /* ..H....T */ + 0x42, 0x56, 0x42, 0x34, 0x64, 0x39, 0x65, 0x62, /* BVB4d9eb */ + 0x64, 0x62, 0x65, 0x2d, 0x30, 0x64, 0x35, 0x64, /* dbe-0d5d */ + 0x62, 0x32, 0x39, 0x36, 0x20, 0x00, 0x00, 0x00, /* b296 ... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x1a, 0x08, 0x00, 0x00, 0x13, 0x11, 0x55, /* .......U */ + 0x02, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x62, /* .......b */ + 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, /* ........ */ + 0x70, 0x03, 0x40, 0x1a, 0x1e, 0x00, 0x00, 0x13, /* p.@..... */ + 0x11, 0x6f, 0x18, 0x52, 0x47, 0x2d, 0x53, 0x55, /* .o.RG-SU */ + 0x20, 0x46, 0x6f, 0x72, 0x20, 0x4c, 0x69, 0x6e, /* For Lin */ + 0x75, 0x78, 0x20, 0x56, 0x31, 0x2e, 0x33, 0x30, /* ux V1.30 */ + 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x79, /* .......y */ + 0x03, 0x02 /* .. */ + }; ethernet_header = (struct ether_header*)(frame); // extract ethernet header values dst_MAC = ethernet_header->ether_shost; @@ -369,9 +466,9 @@ void construct_eap_response_md5_challenge_frame(const uint8_t *frame) extern uint8_t eap_response_md5_challenge[]; const uint8_t eapol_version[] = {0x01}; const uint8_t eapol_type[] = {0x00}; // type: eapol start - const uint8_t eapol_frame_length[] = {0x00, 0x22}; + const uint8_t eapol_frame_length[] = {0x00, 0x1f}; const uint8_t eap_id = frame[EAP_ID_ADDRESS_IN_EAP_MD5_REQUEST_FRAME]; - const uint8_t eap_header[] = {0x02, eap_id, 0x00, 0x22}; + const uint8_t eap_header[] = {0x02, eap_id, 0x00, 0x1f}; const uint8_t eap_type[] = {0x04}; // type: eap packet // const uint8_t eap_md5_value_size[] = {0x10}; // eap.md5.value_size //uint8_t eap_response_md5_value[EAP_MD5_VALUE_LENGTH]; // md5 calculation result @@ -384,10 +481,74 @@ void construct_eap_response_md5_challenge_frame(const uint8_t *frame) extern uint8_t *service_name; extern unsigned int username_length; extern unsigned int midnight_mode_change_tail_data; - - const uint8_t ethernet_padding[] = {0xff, 0xff, 0x37, 0x77, 0x7f, 0xca, 0x57, 0xef}; - const uint8_t ethernet_trailer[] = {0xaf, 0x00, 0x00, 0xff, 0xff, 0xca, 0x57, 0xff, 0x7f, 0xca, 0x77, 0xef, 0xfb, 0x57, 0x9e, 0x00, 0x00, 0x13, 0x11, 0x38, 0x30, 0x32, 0x31, 0x78, 0x2e, 0x65, 0x78, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x13, 0x11, 0x01, 0xe3, 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, 0x17, 0x22, 0x63, 0x32, 0x30, 0x61, 0x33, 0x64, 0x37, 0x36, 0x39, 0x31, 0x61, 0x38, 0x31, 0x63, 0x39, 0x36, 0x34, 0x34, 0x64, 0x63, 0x31, 0x36, 0x63, 0x61, 0x37, 0x65, 0x30, 0x64, 0x36, 0x32, 0x36, 0x61, 0x1a, 0x0c, 0x00, 0x00, 0x13, 0x11, 0x18, 0x06, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x0e, 0x00, 0x00, 0x13, 0x11, 0x2d, 0x08, 0xf0, 0x76, 0x1c, 0x5b, 0xcc, 0x7b, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x2f, 0x12, 0x48, 0x50, 0x21, 0x4d, 0xae, 0x34, 0xf8, 0x0a, 0x3f, 0xa3, 0xdc, 0x60, 0x27, 0x8b, 0x67, 0x95, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x35, 0x03, 0x03, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x36, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x69, 0x6c, 0xff, 0xfe, 0x5e, 0xc0, 0x2c, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x38, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0xdf, 0x8e, 0x60, 0xf8, 0x26, 0x0b, 0x8b, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x4e, 0x12, 0x20, 0x01, 0x02, 0x50, 0x68, 0x01, 0x55, 0x01, 0x58, 0xdf, 0x8e, 0x60, 0xf8, 0x26, 0x0b, 0x8b, 0x1a, 0x88, 0x00, 0x00, 0x13, 0x11, 0x4d, 0x82, 0x65, 0x61, 0x63, 0x30, 0x36, 0x34, 0x65, 0x32, 0x31, 0x62, 0x36, 0x65, 0x37, 0x61, 0x39, 0x33, 0x38, 0x64, 0x34, 0x36, 0x37, 0x39, 0x34, 0x63, 0x65, 0x36, 0x66, 0x38, 0x38, 0x39, 0x62, 0x62, 0x37, 0x37, 0x64, 0x62, 0x62, 0x34, 0x65, 0x33, 0x32, 0x30, 0x36, 0x33, 0x35, 0x30, 0x39, 0x30, 0x38, 0x63, 0x37, 0x66, 0x64, 0x66, 0x30, 0x30, 0x63, 0x33, 0x37, 0x37, 0x65, 0x35, 0x62, 0x63, 0x63, 0x34, 0x32, 0x65, 0x65, 0x35, 0x36, 0x32, 0x61, 0x65, 0x65, 0x36, 0x62, 0x34, 0x39, 0x63, 0x63, 0x30, 0x61, 0x64, 0x33, 0x37, 0x37, 0x33, 0x35, 0x61, 0x63, 0x64, 0x39, 0x62, 0x36, 0x38, 0x35, 0x31, 0x32, 0x63, 0x37, 0x62, 0x32, 0x39, 0x64, 0x34, 0x65, 0x37, 0x61, 0x38, 0x63, 0x37, 0x38, 0x36, 0x65, 0x37, 0x32, 0x65, 0x65, 0x65, 0x37, 0x32, 0x34, 0x64, 0x31, 0x39, 0x32, 0x61, 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, 0x39, 0x22, 0xc1, 0xaa, 0xcd, 0xa8, 0xbf, 0xed, 0xb4, 0xf8, 0xbd, 0xd3, 0xc8, 0xeb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x48, 0x00, 0x00, 0x13, 0x11, 0x54, 0x42, 0x32, 0x30, 0x31, 0x35, 0x30, 0x32, 0x30, 0x39, 0x34, 0x30, 0x31, 0x35, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x62, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x6b, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x70, 0x03, 0x40, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x6f, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x79, 0x03, 0x02, 0x1a, 0x13, 0x00, 0x00, 0x13, 0x11, 0x76, 0x0d, 0x31, 0x37, 0x32, 0x2e, 0x31, 0x37, 0x2e, 0x38, 0x2e, 0x33, 0x33}; + const uint8_t ethernet_padding[] = { 0xff, 0xff, 0x37, 0x77, 0xff, 0xaf, 0xf7, 0xff, 0xe5, 0x00, 0xff}; + const uint8_t ethernet_trailer[] = { 0xff, 0xff, 0xaf, 0xf7, /* ........ */ + 0xff, 0x80, 0x01, 0xff, 0xff, 0x53, 0x3e, 0x4a, /* .....S>J */ + 0x00, 0x00, 0x13, 0x11, 0x38, 0x30, 0x32, 0x31, /* ....8021 */ + 0x78, 0x2e, 0x65, 0x78, 0x65, 0x00, 0x00, 0x00, /* x.exe... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x01, 0x1f, 0x01, 0x02, /* ........ */ + 0xd0, 0x00, 0x00, 0x13, 0x11, 0x01, 0xc4, 0x1a, /* ........ */ + 0x0c, 0x00, 0x00, 0x13, 0x11, 0x18, 0x06, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x1a, 0x0e, 0x00, 0x00, 0x13, /* ........ */ + 0x11, 0x2d, 0x08, 0x08, 0x00, 0x27, 0x69, 0x25, /* .-...'i% */ + 0x6a, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, 0x2f, /* j....../ */ + 0x12, 0x58, 0xae, 0xb1, 0x67, 0x19, 0xe5, 0x5f, /* .X..g.._ */ + 0x4f, 0xec, 0x7a, 0xf9, 0xd3, 0xb1, 0x6d, 0xba, /* O.z...m. */ + 0x23, 0x1a, 0x08, 0x00, 0x00, 0x13, 0x11, 0x76, /* #......v */ + 0x02, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, 0x35, /* .......5 */ + 0x03, 0x02, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, /* ........ */ + 0x36, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6....... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, /* ........ */ + 0x38, 0x12, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, /* 8....... */ + 0x00, 0x00, 0x0a, 0x00, 0x27, 0xff, 0xfe, 0x69, /* ....'..i */ + 0x25, 0x6a, 0x1a, 0x18, 0x00, 0x00, 0x13, 0x11, /* %j...... */ + 0x4e, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* N....... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x1a, 0x88, 0x00, 0x00, 0x13, 0x11, /* ........ */ + 0x4d, 0x82, 0x66, 0x39, 0x64, 0x63, 0x34, 0x34, /* M.f9dc44 */ + 0x35, 0x37, 0x34, 0x34, 0x66, 0x33, 0x66, 0x62, /* 5744f3fb */ + 0x39, 0x64, 0x33, 0x37, 0x34, 0x34, 0x65, 0x61, /* 9d3744ea */ + 0x31, 0x66, 0x31, 0x39, 0x62, 0x64, 0x35, 0x61, /* 1f19bd5a */ + 0x34, 0x34, 0x64, 0x39, 0x63, 0x36, 0x30, 0x34, /* 44d9c604 */ + 0x31, 0x66, 0x33, 0x64, 0x30, 0x38, 0x64, 0x39, /* 1f3d08d9 */ + 0x38, 0x30, 0x62, 0x62, 0x32, 0x31, 0x39, 0x62, /* 80bb219b */ + 0x61, 0x63, 0x30, 0x30, 0x30, 0x32, 0x35, 0x37, /* ac000257 */ + 0x39, 0x30, 0x38, 0x36, 0x32, 0x63, 0x38, 0x30, /* 90862c80 */ + 0x36, 0x64, 0x62, 0x62, 0x39, 0x34, 0x65, 0x66, /* 6dbb94ef */ + 0x62, 0x30, 0x63, 0x61, 0x64, 0x35, 0x63, 0x32, /* b0cad5c2 */ + 0x35, 0x65, 0x30, 0x64, 0x63, 0x62, 0x32, 0x38, /* 5e0dcb28 */ + 0x39, 0x36, 0x66, 0x34, 0x61, 0x33, 0x65, 0x66, /* 96f4a3ef */ + 0x62, 0x39, 0x33, 0x32, 0x35, 0x64, 0x36, 0x63, /* b9325d6c */ + 0x62, 0x35, 0x33, 0x66, 0x39, 0x62, 0x62, 0x35, /* b53f9bb5 */ + 0x34, 0x35, 0x62, 0x62, 0x66, 0x39, 0x39, 0x39, /* 45bbf999 */ + 0x66, 0x38, 0x1a, 0x28, 0x00, 0x00, 0x13, 0x11, /* f8.(.... */ + 0x39, 0x22, 0xd2, 0xc6, 0xb6, 0xaf, 0x00, 0x00, /* 9"...... */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x1a, 0x48, 0x00, 0x00, 0x13, 0x11, /* ...H.... */ + 0x54, 0x42, 0x56, 0x42, 0x34, 0x64, 0x39, 0x65, /* TBVB4d9e */ + 0x62, 0x64, 0x62, 0x65, 0x2d, 0x30, 0x64, 0x35, /* bdbe-0d5 */ + 0x64, 0x62, 0x32, 0x39, 0x36, 0x20, 0x00, 0x00, /* db296 .. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ + 0x00, 0x00, 0x1a, 0x08, 0x00, 0x00, 0x13, 0x11, /* ........ */ + 0x55, 0x02, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, /* U....... */ + 0x62, 0x03, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, /* b....... */ + 0x11, 0x70, 0x03, 0x40, 0x1a, 0x1e, 0x00, 0x00, /* .p.@.... */ + 0x13, 0x11, 0x6f, 0x18, 0x52, 0x47, 0x2d, 0x53, /* ..o.RG-S */ + 0x55, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x4c, 0x69, /* U For Li */ + 0x6e, 0x75, 0x78, 0x20, 0x56, 0x31, 0x2e, 0x33, /* nux V1.3 */ + 0x30, 0x00, 0x1a, 0x09, 0x00, 0x00, 0x13, 0x11, /* 0....... */ + 0x79, 0x03, 0x02 /* y.. */ + }; // The start address of // the eapol version value // in eap response md5 challenge frame @@ -485,10 +646,10 @@ void construct_eap_response_md5_challenge_frame(const uint8_t *frame) memcpy(eap_response_md5_challenge + EAP_MD5_RESPONSE_GATEWAY_ADDR, (uint8_t *)&net_order_gateway, sizeof(uint32_t)); // Filling mentohust code - memcpy(eap_response_md5_challenge + EAP_MD5_RESPONSE_COMPUTE_PASSWORD_ADDR + username_length, + memcpy(eap_response_md5_challenge + EAP_MD5_RESPONSE_COMPUTE_PASSWORD_ADDR, computePwd(eap_request_md5_value), 0x10); // Filling V4 algorithm result - memcpy(eap_response_md5_challenge + EAP_MD5_RESPONSE_COMPUTE_V4_ADDR + username_length, + memcpy(eap_response_md5_challenge + EAP_MD5_RESPONSE_COMPUTE_V4_ADDR, computeV4(eap_request_md5_value, 16), 0x80); // Filling service name memcpy(eap_response_md5_challenge + EAP_MD5_RESPONSE_SERVICE_NAME_ADDR, diff --git a/src/construct_eap_frames.h b/src/construct_eap_frames.h index db7db83..be19c6a 100644 --- a/src/construct_eap_frames.h +++ b/src/construct_eap_frames.h @@ -27,33 +27,33 @@ const static unsigned int ETHERNET_TRAILER_LENGTH = 507; const static unsigned int EAPOL_START_IP_ADDR = 0X17; const static unsigned int EAPOL_START_NETMASK_ADDR = 0X1B; const static unsigned int EAPOL_START_GATEWAY_ADDR = 0X1F; -const static unsigned int EAPOL_START_SERVICE_NAME_ADDR = 0x193; +const static unsigned int EAPOL_START_SERVICE_NAME_ADDR = 0x163; // EAP RESPONSE IDENTITY FRAME const static unsigned int EAP_HEADER_LENGTH = 4; const static unsigned int EAP_TYPE_LENGTH = 1; -const static unsigned int EAP_IDENTITY_PADDING_LENGTH = 25; -const static unsigned int EAP_IDENTITY_TRAILER_LENGTH = 524; -const static unsigned int EAP_IDENTITY_RESPONSE_SERVICE_NAME_ADDR = 0x1a4; -const static unsigned int EAP_IDENTITY_RESPONSE_IP_ADDR = 0x28; -const static unsigned int EAP_IDENTITY_RESPONSE_NETMASK_ADDR = 0X2c; -const static unsigned int EAP_IDENTITY_RESPONSE_GATEWAY_ADDR = 0X30; +const static unsigned int EAP_IDENTITY_PADDING_LENGTH = 28; +const static unsigned int EAP_IDENTITY_TRAILER_LENGTH = 478; +const static unsigned int EAP_IDENTITY_RESPONSE_SERVICE_NAME_ADDR = 0x171; +const static unsigned int EAP_IDENTITY_RESPONSE_IP_ADDR = 0x25; +const static unsigned int EAP_IDENTITY_RESPONSE_NETMASK_ADDR = 0X29; +const static unsigned int EAP_IDENTITY_RESPONSE_GATEWAY_ADDR = 0X2d; const static unsigned int EAP_ID_ADDRESS_IN_EAP_IDENTITY_REQUEST_FRAME = 0X13; // EAP RESPONSE MD5 CHALLENGE FRAME const static unsigned int EAP_MD5_VALUE_SIZE_LENGTH = 1; const static unsigned int EAP_MD5_VALUE_LENGTH = 16; -const static unsigned int EAP_MD5_CHALLENGE_PADDING_LENGTH = 8; -const static unsigned int EAP_MD5_CHALLENGE_TRAILER_LENGTH = 545; +const static unsigned int EAP_MD5_CHALLENGE_PADDING_LENGTH = 11; +const static unsigned int EAP_MD5_CHALLENGE_TRAILER_LENGTH = 511; const static unsigned int SERVICE_NAME_LENGTH = 32; -const static unsigned int EAP_MD5_RESPONSE_IP_ADDR = 0X39; -const static unsigned int EAP_MD5_RESPONSE_NETMASK_ADDR = 0X3D; -const static unsigned int EAP_MD5_RESPONSE_GATEWAY_ADDR = 0X41; -const static unsigned int EAP_MD5_RESPONSE_COMPUTE_PASSWORD_ADDR = 0XB8; -const static unsigned int EAP_MD5_RESPONSE_COMPUTE_V4_ADDR = 0X121; -const static unsigned int EAP_MD5_RESPONSE_SERVICE_NAME_ADDR = 0X1B5; +const static unsigned int EAP_MD5_RESPONSE_IP_ADDR = 0X36; +const static unsigned int EAP_MD5_RESPONSE_NETMASK_ADDR = 0X3a; +const static unsigned int EAP_MD5_RESPONSE_GATEWAY_ADDR = 0X3e; +const static unsigned int EAP_MD5_RESPONSE_COMPUTE_PASSWORD_ADDR = 0X99; +const static unsigned int EAP_MD5_RESPONSE_COMPUTE_V4_ADDR = 0X10a; +const static unsigned int EAP_MD5_RESPONSE_SERVICE_NAME_ADDR = 0X192; const static unsigned int EAP_ID_ADDRESS_IN_EAP_MD5_REQUEST_FRAME = 0X13; const static unsigned int EAP_MD5_VALUE_SIZE_ADDRESS_IN_EAP_MD5_REQUEST_FRAME = 0X17; diff --git a/src/eap_frames_operations.c b/src/eap_frames_operations.c index 10b1a84..7534569 100644 --- a/src/eap_frames_operations.c +++ b/src/eap_frames_operations.c @@ -22,9 +22,9 @@ #include "eap_frames_operations.h" -uint8_t eapol_start[1000]; // eapol start frame -uint8_t eap_response_identity[1000]; -uint8_t eap_response_md5_challenge[1000]; +uint8_t eapol_start[524]; // eapol start frame +uint8_t eap_response_identity[538]; +uint8_t eap_response_md5_challenge[571]; uint8_t eapol_heartbeat[45]; pcap_t *descr = NULL;// PCAP packet capture descriptor for the specified interface. SEND_FRAME_TYPE current_state; @@ -236,7 +236,7 @@ int send_eap_frame(SEND_FRAME_TYPE type, const uint8_t *frame) // ethernet_header = (struct ether_header*)(frame); // extract ethernet header values construct_eapol_start_frame(frame); send_eap_frame_data = eapol_start; - send_eap_frame_data_length = 1000; + send_eap_frame_data_length = 524; fprintf(stdout, "sending eapol start frame\n"); break; @@ -247,7 +247,7 @@ int send_eap_frame(SEND_FRAME_TYPE type, const uint8_t *frame) // eap_id = frame[EAP_ID_ADDRESS]; construct_eap_response_identity_frame(frame); send_eap_frame_data = eap_response_identity; - send_eap_frame_data_length = 1000; + send_eap_frame_data_length = 538; fprintf(stdout, "sending eap_response_identity frame\n"); break; @@ -262,7 +262,7 @@ int send_eap_frame(SEND_FRAME_TYPE type, const uint8_t *frame) // construct_eap_response_md5_challenge_frame(ethernet_header->ether_shost, eap_request_md5_value, eap_md5_value_size, frame); construct_eap_response_md5_challenge_frame(frame); send_eap_frame_data = eap_response_md5_challenge; - send_eap_frame_data_length = 1000; + send_eap_frame_data_length = 571; fprintf(stdout, "sending eap_md5_challenge frame\n"); break; diff --git a/src/init.h b/src/init.h index 78650bd..cc5e714 100644 --- a/src/init.h +++ b/src/init.h @@ -38,15 +38,15 @@ typedef struct nic_struct { struct in_addr dns; } NIC_STRUCT; -const static uint8_t SERVICE_EDUCATION[] = {0xbd, 0xcc, 0xd3, 0xfd, 0xcd, 0xf8, 0xbd, 0xd3, 0xc8, 0xeb}; //教育网接入 -const static uint8_t SERVICE_CHINA_UNICOM[] = {0xc1, 0xaa, 0xcd, 0xa8, 0xbf, 0xed, 0xb4, 0xf8, 0xbd, 0xd3, 0xc8, 0xeb}; // 联通宽带接入 -const static uint8_t SERVICE_CHINA_MOBILE[] = {0xd2, 0xc6, 0xb6, 0xaf, 0xbf, 0xed, 0xb4, 0xf8, 0xbd, 0xd3, 0xc8, 0xeb}; // 移动宽带接入 -const static uint8_t SERVICE_CHINA_TELECOM[] = {0xb5, 0xe7, 0xd0, 0xc5, 0xbf, 0xed, 0xb4, 0xf8, 0xbd, 0xd3, 0xc8, 0xeb}; // 电信宽带接入 - -const static unsigned int SERVICE_EDUCATION_LENGTH = 10; // bytes number -const static unsigned int SERVICE_CHINA_UNICOM_LENGTH = 12; -const static unsigned int SERVICE_CHINA_MOBILE_LENGTH = 12; -const static unsigned int SERVICE_CHINA_TELECOM_LENGTH = 12; +const static uint8_t SERVICE_EDUCATION[] = {0x22,0xd0,0xa3,0xd4,0xb0,0xcd,0xcd}; //教育网接入 +const static uint8_t SERVICE_CHINA_UNICOM[] = {0xc1, 0xaa, 0xcd, 0xa8}; // 联通宽带接入 +const static uint8_t SERVICE_CHINA_MOBILE[] = {0xd2, 0xc6, 0xb6, 0xaf, 0xbf}; // 移动宽带接入 +const static uint8_t SERVICE_CHINA_TELECOM[] = {0xb5, 0xe7, 0xd0, 0xc5, 0xbf}; // 电信宽带接入 + +const static unsigned int SERVICE_EDUCATION_LENGTH = 6; // bytes number +const static unsigned int SERVICE_CHINA_UNICOM_LENGTH = 4; +const static unsigned int SERVICE_CHINA_MOBILE_LENGTH = 4; +const static unsigned int SERVICE_CHINA_TELECOM_LENGTH = 4; const static unsigned int DEFAULT_SERVICE_NAME_SIZE = 32; const static char *DEFAULT_DHCPSCRIPT = "dhclient"; diff --git a/src/main.c b/src/main.c index 20a26af..6f940a0 100644 --- a/src/main.c +++ b/src/main.c @@ -39,22 +39,22 @@ int fd = -1; // lock file descriptor static void ShowUsage() { printf( "\n" - "jmuSupplicant for JMU \n" - "\t -- Client for Ruijie Authentication in JMU campus.\n" + "jmuSupplicant for CSLG \n" + "\t -- Client for Ruijie Authentication in CSLG campus.\n" "\n" " Usage:\n" "\t请使用 root 权限下运行。通常需要在命令行前加入 'sudo'。\n\n" - "\t-u, --username 用户名,通常为学号。\n" - "\t-p, --password 密码。\n" - "\t-s, --service_company 服务名。\n" - "\t 0(教育网),1(联通宽带接入),2(移动宽带接入),3(电信宽带接入) \n\n" + "\t-u, --username 用户名(学号)\n" + "\t-p, --password 密码 \n" + "\t-s, --service_company 服务名\n" + "\t 0(校园网),1(联通),2(移动),3(电信) \n\n" "\n" " 可选参数:\n\n" // "\t-g, --gateway 指定 Gateway(网关) 地址。 \n\n" // "\t-d, --dns 指定 DNS 服务器地址。 \n\n" - "\t--ip 指定 ip 地址,推荐配合 mignight 模式中使用。 \n\n" + "\t--ip 指定 ip 地址 \n\n" "\t--mask 指定 Netmask(子网遮罩) 地址。 \n\n" "\t--interface_card 指定 网卡名称,则程序中不再要求用户手动选择网卡\n\n" "\t-n 开启 midnight 模式,断网后使用。\n\n" @@ -70,7 +70,9 @@ static void ShowUsage() "\tlicense as free software, with NO any relaiontship with Ruijie company.\n\n\n" // "\tAnother codingstory work. Blog: https://codingstory.com.cn\n" - "\t\t\t\t\t\t\t\t2018.06.01\n"); + "modified by Chuancey, thanks to the original author for the source code,\n" + "欢迎加入常熟理工校园网交流群:789745005 \n" + "\t\t\t\t\t\t\t\t2019.09.29\n"); } @@ -175,8 +177,6 @@ static void InitArguments(int *argc, char ***argv) exit(EXIT_FAILURE); } } - - return; } @@ -224,7 +224,9 @@ int main(int argc, char **argv) // 捕获服务器返回的 EAP frames,用以执行后续认证操作。 capture_eap_frames(); - + printf("\n\nmodified by Chuancey, thanks to the original author for the source code,\n" + "欢迎加入常熟理工校园网交流群:789745005 \n" + "\t\t\t\t\t\t\t\t2019.09.29\n"); // 保持在线 while(1) {