📄 prframe.c
字号:
* Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_assocresp( UINT8 *pbuf, int index, UINT16 len ){ wlan_fr_assocresp_t frame; wlan_p80211_frame_fields_t fixed_fields[TOTAL_MGMT_FIXED_FIELDS]; wlan_p80211_frame_fields_t info_elements[TOTAL_MGMT_INFO_ELEMENTS]; /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ memset( (void *)fixed_fields, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_FIXED_FIELDS)); memset( (void *)info_elements, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_INFO_ELEMENTS)); memset( (void *)&frame, 0, sizeof(wlan_fr_assocresp_t) ); frame.buf = pbuf; /* decode functions assume the 4 trailing bytes for the FCS aren't included in the length */ frame.len = len - 4; wlan_mgmt_decode_assocresp( &frame ); fixed_fields[MGMT_FF_CAP_INFO].exists = TRUE; fixed_fields[MGMT_FF_CAP_INFO].info = (void *)frame.cap_info; fixed_fields[MGMT_FF_STATUS].exists = TRUE; fixed_fields[MGMT_FF_STATUS].info = (void *)frame.status; fixed_fields[MGMT_FF_AID].exists = TRUE; fixed_fields[MGMT_FF_AID].info = (void *)frame.aid; info_elements[MGMT_IE_SUPP_RATES].exists = TRUE; info_elements[MGMT_IE_SUPP_RATES].info = (void *)frame.supp_rates; print_fixed_fields( fixed_fields, len ); print_info_elements( info_elements, len );}/*----------------------------------------------------------------* print_mgmt_authen** This function decodes and prints management frames of subtype* authentication.** Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_authen( UINT8 *pbuf, int index, UINT16 len ){ wlan_fr_authen_t frame; wlan_p80211_frame_fields_t fixed_fields[TOTAL_MGMT_FIXED_FIELDS]; wlan_p80211_frame_fields_t info_elements[TOTAL_MGMT_INFO_ELEMENTS]; /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ memset( (void *)fixed_fields, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_FIXED_FIELDS)); memset( (void *)info_elements, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_INFO_ELEMENTS)); memset( (void *)&frame, 0, sizeof(wlan_fr_authen_t) ); frame.buf = pbuf; /* decode functions assume the 4 trailing bytes for the FCS aren't included in the length */ frame.len = len - 4; wlan_mgmt_decode_authen( &frame ); fixed_fields[MGMT_FF_AUTH_ALG].exists = TRUE; fixed_fields[MGMT_FF_AUTH_ALG].info = (void *)frame.auth_alg; fixed_fields[MGMT_FF_AUTH_SEQ].exists = TRUE; fixed_fields[MGMT_FF_AUTH_SEQ].info = (void *)frame.auth_seq; fixed_fields[MGMT_FF_STATUS].exists = TRUE; fixed_fields[MGMT_FF_STATUS].info = (void *)frame.status; info_elements[MGMT_IE_CHALLENGE].exists = TRUE; info_elements[MGMT_IE_CHALLENGE].info = (void *)frame.challenge; print_fixed_fields( fixed_fields, len ); print_info_elements( info_elements, len );}/*----------------------------------------------------------------* print_mgmt_beacon** This function decodes and prints management frames of subtype* beacon.** Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_beacon( UINT8 *pbuf, int index, UINT16 len ){ wlan_fr_beacon_t frame; wlan_p80211_frame_fields_t fixed_fields[TOTAL_MGMT_FIXED_FIELDS]; wlan_p80211_frame_fields_t info_elements[TOTAL_MGMT_INFO_ELEMENTS]; if ( !opt_nobeacon ) { /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ memset( (void *)fixed_fields, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_FIXED_FIELDS)); memset( (void *)info_elements, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_INFO_ELEMENTS)); memset( (void *)&frame, 0, sizeof(wlan_fr_beacon_t) ); frame.buf = pbuf; /* decode functions assume the 4 trailing bytes for the FCS aren't included in the length */ frame.len = len - 4; wlan_mgmt_decode_beacon( &frame ); fixed_fields[MGMT_FF_TS].exists = TRUE; fixed_fields[MGMT_FF_TS].info = (void *)frame.ts; fixed_fields[MGMT_FF_BCN_INT].exists = TRUE; fixed_fields[MGMT_FF_BCN_INT].info = (void *)frame.bcn_int; fixed_fields[MGMT_FF_CAP_INFO].exists = TRUE; fixed_fields[MGMT_FF_CAP_INFO].info = (void *)frame.cap_info; info_elements[MGMT_IE_SSID].exists = TRUE; info_elements[MGMT_IE_SSID].info = (void *)frame.ssid; info_elements[MGMT_IE_SUPP_RATES].exists = TRUE; info_elements[MGMT_IE_SUPP_RATES].info = (void *)frame.supp_rates; info_elements[MGMT_IE_FH_PARMS].exists = TRUE; info_elements[MGMT_IE_FH_PARMS].info = (void *)frame.fh_parms; info_elements[MGMT_IE_DS_PARMS].exists = TRUE; info_elements[MGMT_IE_DS_PARMS].info = (void *)frame.ds_parms; info_elements[MGMT_IE_CF_PARMS].exists = TRUE; info_elements[MGMT_IE_CF_PARMS].info = (void *)frame.cf_parms; info_elements[MGMT_IE_IBSS_PARMS].exists = TRUE; info_elements[MGMT_IE_IBSS_PARMS].info = (void *)frame.ibss_parms; info_elements[MGMT_IE_TIM].exists = TRUE; info_elements[MGMT_IE_TIM].info = (void *)frame.tim; print_fixed_fields( fixed_fields, len ); print_info_elements( info_elements, len ); }}/*----------------------------------------------------------------* print_mgmt_deauthen** This function decodes and prints management frames of subtype* deauthentication.** Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_deauthen( UINT8 *pbuf, int index, UINT16 len ){ wlan_fr_deauthen_t frame; wlan_p80211_frame_fields_t fixed_fields[TOTAL_MGMT_FIXED_FIELDS]; /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ memset( (void *)fixed_fields, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_FIXED_FIELDS)); memset( (void *)&frame, 0, sizeof(wlan_fr_deauthen_t) ); frame.buf = pbuf; /* decode functions assume the 4 trailing bytes for the FCS aren't included in the length */ frame.len = len - 4; wlan_mgmt_decode_deauthen( &frame ); fixed_fields[MGMT_FF_REASON].exists = TRUE; fixed_fields[MGMT_FF_REASON].info = (void *)frame.reason; print_fixed_fields( fixed_fields, len );}/*----------------------------------------------------------------* print_mgmt_disassoc** This function decodes and prints management frames of subtype* disassociation.** Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_disassoc( UINT8 *pbuf, int index, UINT16 len ){ wlan_fr_disassoc_t frame; wlan_p80211_frame_fields_t fixed_fields[TOTAL_MGMT_FIXED_FIELDS]; /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ memset( (void *)fixed_fields, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_FIXED_FIELDS)); memset( (void *)&frame, 0, sizeof(wlan_fr_disassoc_t) ); frame.buf = pbuf; /* decode functions assume the 4 trailing bytes for the FCS aren't included in the length */ frame.len = len - 4; wlan_mgmt_decode_disassoc( &frame ); fixed_fields[MGMT_FF_REASON].exists = TRUE; fixed_fields[MGMT_FF_REASON].info = (void *)frame.reason; print_fixed_fields( fixed_fields, len );}/*----------------------------------------------------------------* print_mgmt_ibssatim** This function decodes and prints management frames of subtype* ibss atim.** Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_ibssatim( UINT8 *pbuf, int index, UINT16 len ){ /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ return;}/*----------------------------------------------------------------* print_mgmt_probereq** This function decodes and prints management frames of subtype* probe request.** Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_probereq( UINT8 *pbuf, int index, UINT16 len ){ wlan_fr_probereq_t frame; wlan_p80211_frame_fields_t info_elements[TOTAL_MGMT_INFO_ELEMENTS]; /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ memset( (void *)info_elements, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_INFO_ELEMENTS)); memset( (void *)&frame, 0, sizeof(wlan_fr_probereq_t) ); frame.buf = pbuf; /* decode functions assume the 4 trailing bytes for the FCS aren't included in the length */ frame.len = len - 4; wlan_mgmt_decode_probereq( &frame ); info_elements[MGMT_IE_SSID].exists = TRUE; info_elements[MGMT_IE_SSID].info = (void *)frame.ssid; info_elements[MGMT_IE_SUPP_RATES].exists = TRUE; info_elements[MGMT_IE_SUPP_RATES].info = (void *)frame.supp_rates; print_info_elements( info_elements, len );}/*----------------------------------------------------------------* print_mgmt_proberesp** This function decodes and prints management frames of subtype* probe response.** Arguments:* pbuf - pointer to the frame buffer* index - index into the global array of frame types for a* particular frame type and subtype* len - the number of bytes in the frame** returns: nothing*----------------------------------------------------------------*/void print_mgmt_proberesp( UINT8 *pbuf, int index, UINT16 len ){ wlan_fr_proberesp_t frame; wlan_p80211_frame_fields_t fixed_fields[TOTAL_MGMT_FIXED_FIELDS]; wlan_p80211_frame_fields_t info_elements[TOTAL_MGMT_INFO_ELEMENTS]; /* print 802.11 frame header */ print_80211_mgmt_header( (p80211_hdr_t *)pbuf, index, len ); /* print management frame body for this management frame subtype */ memset( (void *)fixed_fields, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_FIXED_FIELDS)); memset( (void *)info_elements, 0, (sizeof(wlan_p80211_frame_fields_t) * TOTAL_MGMT_INFO_ELEMENTS)); memset( (void *)&frame, 0, sizeof(wlan_fr_proberesp_t) ); frame.buf = pbuf; /* decode functions assume the 4 trailing bytes for the FCS aren't included in the length */ frame.len = len - 4; wlan_mgmt_decode_proberesp( &frame ); fixed_fields[MGMT_FF_TS].exists = TRUE; fixed_fields[MGMT_FF_TS].info = (void *)frame.ts; fixed_fields[MGMT_FF_BCN_INT].exists = TRUE; fixed_fields[MGMT_FF_BCN_INT].info = (void *)frame.bcn_int; fixed_fields[MGMT_FF_CAP_INFO].exists = TRUE; fixed_fields[MGMT_FF_CAP_INFO].info = (void *)frame.cap_info; info_elements[MGMT_IE_SSID].exists = TRUE; info_elements[MGMT_IE_SSID].info = (void *)frame.ssid; info_elements[MGMT_IE_SUPP_RATES].exists = TRUE; info_elements[MGMT_IE_SUPP_RATES].info = (void *)frame.supp_rates; info_elements[MGMT_IE_FH_PARMS].exists = TRUE; info_elements[MGMT_IE_FH_PARMS].info = (void *)frame.fh_parms; info_elements[MGMT_IE_DS_PARMS].exists = TRUE; info_elements[MGMT_IE_DS_PARMS].info = (void *)frame.ds_parms; info_elements[MGMT_IE_CF_PARMS].exists = TRUE; info_elements[MGMT_IE_CF_PARMS].info = (void *)frame.cf_parms;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -