diff options
author | Marc <foxtrot@malloc.me> | 2022-01-15 21:51:44 +0000 |
---|---|---|
committer | Marc <foxtrot@malloc.me> | 2022-01-15 21:51:44 +0000 |
commit | d8911a911d493199e2caa66486b40ef7c5c9eef7 (patch) | |
tree | faeefc10cbc4a6fef67f03419afd1c3904f5f7a3 /utils | |
parent | 275825dde0c4120135d1a563fd861d8bf141729a (diff) | |
download | libwifi-d8911a911d493199e2caa66486b40ef7c5c9eef7.tar.gz libwifi-d8911a911d493199e2caa66486b40ef7c5c9eef7.tar.bz2 libwifi-d8911a911d493199e2caa66486b40ef7c5c9eef7.zip |
gen: Add ability to set different BSSID than Transmitter for Beacons
Diffstat (limited to 'utils')
-rw-r--r-- | utils/src/test_generation.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/src/test_generation.c b/utils/src/test_generation.c index 314ce34..f269fe4 100644 --- a/utils/src/test_generation.c +++ b/utils/src/test_generation.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <errno.h> | 1 | #include <errno.h> |
2 | #include <libwifi.h> | 2 | #include <libwifi.h> |
3 | #include <libwifi/core/frame/tag.h> | ||
3 | #include <pcap.h> | 4 | #include <pcap.h> |
4 | #include <pcap/dlt.h> | 5 | #include <pcap/dlt.h> |
5 | #include <pcap/pcap.h> | 6 | #include <pcap/pcap.h> |
@@ -55,7 +56,8 @@ static unsigned char to[] = TO_MAC; | |||
55 | static unsigned char from[] = FROM_MAC; | 56 | static unsigned char from[] = FROM_MAC; |
56 | static unsigned char bcast[] = BCAST_MAC; | 57 | static unsigned char bcast[] = BCAST_MAC; |
57 | static unsigned char reassoc_mac[] = REASSOC_MAC; | 58 | static unsigned char reassoc_mac[] = REASSOC_MAC; |
58 | static unsigned char tag_data[] = "\x00\x00\00\x01This is a 221 tag from libwifi.\n"; | 59 | static unsigned char tag_data1[] = "\x00\x13\x37\x01Hello, World!\n"; |
60 | static unsigned char tag_data2[] = "\x00\x20\x91\x00Goodbye, World!\n"; | ||
59 | 61 | ||
60 | static int mode = 0; | 62 | static int mode = 0; |
61 | static int inject_mode = 0; | 63 | static int inject_mode = 0; |
@@ -147,8 +149,9 @@ void inject_beacons(int random_mac) { | |||
147 | } else { | 149 | } else { |
148 | memcpy(txmac, FROM_MAC, 6); | 150 | memcpy(txmac, FROM_MAC, 6); |
149 | } | 151 | } |
150 | libwifi_create_beacon(&beacon, bcast, txmac, BEACON_SSID, CHANNEL); | 152 | libwifi_create_beacon(&beacon, bcast, txmac, txmac, "wifi-beacon", CHANNEL); |
151 | libwifi_quick_add_tag(&beacon.tags, TAG_VENDOR_SPECIFIC, tag_data, sizeof(tag_data)); | 153 | libwifi_quick_add_tag(&beacon.tags, TAG_VENDOR_SPECIFIC, tag_data1, sizeof(tag_data1)); |
154 | libwifi_quick_add_tag(&beacon.tags, TAG_VENDOR_SPECIFIC, tag_data2, sizeof(tag_data2)); | ||
152 | 155 | ||
153 | unsigned char *buf = NULL; | 156 | unsigned char *buf = NULL; |
154 | size_t buf_sz = libwifi_get_beacon_length(&beacon); | 157 | size_t buf_sz = libwifi_get_beacon_length(&beacon); |
@@ -184,7 +187,7 @@ void inject_probe_responses() { | |||
184 | memset(&probe_resp, 0, sizeof(struct libwifi_probe_resp)); | 187 | memset(&probe_resp, 0, sizeof(struct libwifi_probe_resp)); |
185 | 188 | ||
186 | libwifi_create_probe_resp(&probe_resp, to, from, PROBE_RESP_SSID, CHANNEL); | 189 | libwifi_create_probe_resp(&probe_resp, to, from, PROBE_RESP_SSID, CHANNEL); |
187 | libwifi_quick_add_tag(&probe_resp.tags, TAG_VENDOR_SPECIFIC, tag_data, sizeof(tag_data)); | 190 | libwifi_quick_add_tag(&probe_resp.tags, TAG_VENDOR_SPECIFIC, tag_data1, sizeof(tag_data1)); |
188 | 191 | ||
189 | unsigned char *buf = NULL; | 192 | unsigned char *buf = NULL; |
190 | size_t buf_sz = libwifi_get_probe_resp_length(&probe_resp); | 193 | size_t buf_sz = libwifi_get_probe_resp_length(&probe_resp); |