Skip to content

Commit

Permalink
wash: add support for selected_registrar_config_methods in json
Browse files Browse the repository at this point in the history
this field seems to only be set when the WPS button was pushed.
ref: wiire-a/pixiewps#107
  • Loading branch information
rofl0r committed Jan 25, 2022
1 parent 2db7ca5 commit fa3fc51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/libwps/libwps.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/libwps/libwps.h
Expand Up @@ -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];
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit fa3fc51

Please sign in to comment.