From fa3fc51a5a0584989a260ab262a904ba7a2a47d0 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Tue, 25 Jan 2022 18:02:37 +0000 Subject: [PATCH] wash: add support for selected_registrar_config_methods in json this field seems to only be set when the WPS button was pushed. ref: https://github.com/wiire-a/pixiewps/issues/107 --- src/libwps/libwps.c | 14 +++++++++++++- src/libwps/libwps.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libwps/libwps.c b/src/libwps/libwps.c index a66c2335..d6256d7a 100755 --- a/src/libwps/libwps.c +++ b/src/libwps/libwps.c @@ -144,6 +144,13 @@ char *wps_data_to_json(const char*bssid, const char *ssid, int channel, int rssi json_str = append_and_free(old, buf, 1); old = json_str; } + if(*wps->selected_registrar_config_methods) { + tmp = sanitize_string(wps->selected_registrar_config_methods); + nl = snprintf(buf, sizeof buf, "\"selected_registrar_config_methods\" : \"%s\", ", tmp); + free(tmp); + json_str = append_and_free(old, buf, 1); + old = json_str; + } if(*wps->response_type) { tmp = sanitize_string(wps->response_type); nl = snprintf(buf, sizeof buf, "\"wps_response_type\" : \"%s\", ", tmp); @@ -204,7 +211,7 @@ int parse_wps_parameters(const u_char *packet, size_t len, struct libwps_data *w if(wps) { memset(wps, 0, sizeof(struct libwps_data)); - + if(len > (sizeof(struct radio_tap_header) + sizeof(struct dot11_frame_header) + sizeof(struct management_frame))) @@ -245,6 +252,7 @@ int parse_wps_tag(const u_char *tags, size_t len, struct libwps_data *wps) UUID, SERIAL, SELECTED_REGISTRAR, + SELECTED_REGISTRAR_CONFIG_METHODS, RESPONSE_TYPE, PRIMARY_DEVICE_TYPE, CONFIG_METHODS, @@ -307,6 +315,10 @@ int parse_wps_tag(const u_char *tags, size_t len, struct libwps_data *wps) src = hex2str(el, el_len); ptr = wps->selected_registrar; break; + case SELECTED_REGISTRAR_CONFIG_METHODS: + src = hex2str(el, el_len); + ptr = wps->selected_registrar_config_methods; + break; case RESPONSE_TYPE: src = hex2str(el, el_len); ptr = wps->response_type; diff --git a/src/libwps/libwps.h b/src/libwps/libwps.h index c60918bf..c8355d0a 100755 --- a/src/libwps/libwps.h +++ b/src/libwps/libwps.h @@ -43,6 +43,7 @@ struct libwps_data char uuid[LIBWPS_MAX_STR_LEN]; char serial[LIBWPS_MAX_STR_LEN]; char selected_registrar[LIBWPS_MAX_STR_LEN]; + char selected_registrar_config_methods[LIBWPS_MAX_STR_LEN]; char response_type[LIBWPS_MAX_STR_LEN]; char primary_device_type[LIBWPS_MAX_STR_LEN]; char config_methods[LIBWPS_MAX_STR_LEN]; @@ -80,6 +81,7 @@ enum wps_el_number UUID = 0x1047, SERIAL = 0x1042, SELECTED_REGISTRAR = 0x1041, + SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053, RESPONSE_TYPE = 0x103B, PRIMARY_DEVICE_TYPE = 0x1054, CONFIG_METHODS = 0x1008,