Codebase list reaver / bf681e46-6faa-4865-8de0-fe302ffe4baf/upstream
Import upstream version 1.6.6+git20210519.1.d6c931c Kali Janitor 2 years ago
10 changed file(s) with 86 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
105105 -w, --win7 Mimic a Windows 7 registrar [False]
106106 -K, --pixie-dust Run pixiedust attack
107107 -Z Run pixiedust attack
108 -O, --output-file=<filename> Write packets of interest into pcap file
109 -M, --mac-changer Change the last digit of the MAC Address for each pin attempt [False]
108110
109111 Example:
110112 reaver -i wlan0mon -b 00:90:4C:C1:AC:21 -vv
131133 Optional Arguments:
132134 -c, --channel=<num> Channel to listen on [auto]
133135 -n, --probes=<num> Maximum number of probes to send to each AP in scan mode [15]
136 -O, --output-file=<filename> Write packets of interest into pcap file
134137 -F, --ignore-fcs Ignore frame checksum errors
135138 -2, --2ghz Use 2.4GHz 802.11 channels
136139 -5, --5ghz Use 5GHz 802.11 channels
138141 -u, --survey Use survey mode [default]
139142 -a, --all Show all APs, even those without WPS
140143 -j, --json print extended WPS info as json
144 -U, --utf8 Show UTF8 ESSID (does not sanitize ESSID, dangerous)
141145 -p, --progress Show percentage of crack progress
142146 -h, --help Show help
143147
166170 `rofl0r`
167171
168172 Modifications made by:
169 `t6_x`, `DataHead`, `Soxrok2212`, `Wiire`, `AAnarchYY`, `kib0rg`, `KokoSoft`, `rofl0r`, `horrorho`, `binarymaster`, `Ǹotaz`
173 `t6_x`, `DataHead`, `Soxrok2212`, `Wiire`, `AAnarchYY`, `kib0rg`, `KokoSoft`, `rofl0r`, `horrorho`, `binarymaster`, `Ǹotaz`, `Adde88`
170174
171175 Some ideas made by:
172176 `nuroo`, `kcdtv`
345345 state++;
346346 break;
347347 case 4:
348 ret = process_authenticate_associate_resp(0);
348 ret = process_authenticate_associate_resp(1);
349349 if(ret) state++;
350350 else return 0;
351351 break;
4949 int long_opt_index = 0;
5050 char bssid[MAC_ADDR_LEN] = { 0 };
5151 char mac[MAC_ADDR_LEN] = { 0 };
52 char *short_options = "b:e:m:i:t:d:c:T:x:r:g:l:p:s:C:O:KZA5ELfnqvDShwN6JFu";
52 char *short_options = "b:e:m:i:t:d:c:T:x:r:g:l:p:s:C:O:KZA5ELfnqvDShwN6JFuM";
5353 struct option long_options[] = {
5454 { "pixie-dust", no_argument, NULL, 'K' },
5555 { "interface", required_argument, NULL, 'i' },
8383 { "timeout-is-nack", no_argument, NULL, 'J' },
8484 { "ignore-fcs", no_argument, NULL, 'F' },
8585 { "output-file", required_argument, NULL, 'O'},
86 { "mac-changer", no_argument, NULL, 'M' },
8687 { 0, 0, 0, 0 }
8788 };
8889
200201 break;
201202 case 'F':
202203 set_validate_fcs(0);
204 break;
205 case 'M':
206 set_mac_changer(1);
203207 break;
204208 default:
205209 ret_val = EXIT_FAILURE;
229233 set_validate_fcs(1);
230234 pixie.do_pixie = 0;
231235 set_pin_string_mode(0);
236 set_mac_changer(0);
232237 }
233238
234239 /* Parses the recurring delay optarg */
3333 #include "cracker.h"
3434 #include "pixie.h"
3535 #include "utils/vendor.h"
36 #include "utils/endianness.h"
3637
3738 void update_wpc_from_pin(void) {
3839 /* update WPC file with found pin */
6566 uint64_t timestamp;
6667 memcpy(&timestamp, beacon->timestamp, 8);
6768 globule->uptime = end_le64toh(timestamp);
69 }
70
71 static void set_next_mac() {
72 unsigned char newmac[6];
73 uint32_t l4b;
74 memcpy(newmac, get_mac(), 6);
75 memcpy(&l4b, newmac+2, 4);
76 l4b = end_be32toh(l4b);
77 do ++l4b;
78 while ((l4b & 0xff) == 0 || (l4b & 0xff) == 0xff);
79 l4b = end_htobe32(l4b);
80 memcpy(newmac+2, &l4b, 4);
81 set_mac(newmac);
82 cprintf(WARNING, "[+] Using MAC %s\n", mac2str(get_mac(), ':'));
6883 }
6984
7085 /* Brute force all possible WPS pins for a given access point */
160175 /* Main cracking loop */
161176 for(loop_count=0, sleep_count=0; get_key_status() != KEY_DONE; loop_count++, sleep_count++)
162177 {
178 /* MAC Changer */
179 if (get_mac_changer()) {
180 set_next_mac();
181 }
182
163183 /*
164184 * Some APs may do brute force detection, or might not be able to handle an onslaught of WPS
165185 * registrar requests. Using a delay here can help prevent the AP from locking us out.
149149 SETUP_LOCKED = 15,
150150 MESSAGE_TIMEOUT = 16,
151151 REGISTRATION_TIMEOUT = 17,
152 AUTH_FAILURE = 18
152 AUTH_FAILURE = 18,
153 UNKNOWN_CFG_ERROR = 0x1003
153154 };
154155
155156 enum wps_type
148148 tx_type = SEND_WSC_NACK;
149149 break;
150150 case NACK:
151 cprintf(VERBOSE, "[+] Received WSC NACK\n");
151 cprintf(VERBOSE, "[+] Received WSC NACK (reason: 0x%04X)\n", get_nack_reason());
152152 got_nack = 1;
153153 break;
154154 case TERMINATE:
230230 set_timeout_is_nack(0);
231231
232232 ret_val = KEY_REJECTED;
233
234 /* Check the reason code for the received NACK message */
235 if (get_nack_reason() == MESSAGE_TIMEOUT) {
236 ret_val = UNKNOWN_ERROR;
237 cprintf(WARNING, "[!] WARNING: Potential FAKE NACK!\n");
238 }
239 /* Got NACK instead of an M5 message, when cracking second half */
240 else if (!get_pin_string_mode() && last_msg == M3 && get_key_status() == KEY2_WIP) {
241 ret_val = UNKNOWN_ERROR;
242 cprintf(WARNING, "[!] WARNING: Potential first half pin has changed!\n");
243 }
233244 }
234245 else
235246 {
248259 (last_msg == M3 || last_msg == M5))
249260 {
250261 ret_val = KEY_REJECTED;
262 /* Got timeout instead of an M5 message, when cracking second half */
263 if (!get_pin_string_mode() && last_msg == M3 && get_key_status() == KEY2_WIP) {
264 ret_val = UNKNOWN_ERROR;
265 cprintf(WARNING, "[!] WARNING: Potential first half pin has changed!\n");
266 }
251267 }
252268 else
253269 {
471487 case MESSAGE_TYPE:
472488 type = (uint8_t) element_data[0];
473489 break;
490 case CONFIGURATION_ERROR:
491 /* Check element_data length */
492 if (element.length == 2)
493 set_nack_reason(WPA_GET_BE16(element_data));
494 break;
474495 default:
475496 break;
476497 }
628628 return globule->oo_send_nack;
629629 }
630630
631 void set_mac_changer(int value)
632 {
633 globule->mac_changer = value;
634 }
635 int get_mac_changer()
636 {
637 return globule->mac_changer;
638 }
639
631640 void set_vendor(int is_set, const unsigned char* v) {
632641 globule->vendor_oui[0] = is_set;
633642 if(is_set) memcpy(globule->vendor_oui+1, v, 3);
155155 * wpa_supplicant's wps_data structure, needed for almost all wpa_supplicant
156156 * function calls.
157157 */
158 int mac_changer; /* Use MAC changer */
159
158160 };
159161
160162 extern struct globals *globule;
267269 int get_repeat_m6(void);
268270 void set_output_fd(int fd);
269271 int get_output_fd(void);
272 void set_mac_changer(int value);
273 int get_mac_changer(void);
270274 #endif
142142 pcap_set_timeout(handle, 50);
143143 pcap_set_rfmon(handle, activate_rfmon);
144144 pcap_set_promisc(handle, 1);
145 if(!(status = pcap_activate(handle)))
145 status = pcap_activate(handle);
146 if(status >= 0) {
147 // Complete success, or success with warning.
148 // XXX - report warning?
146149 return handle;
150 }
147151 if(status == PCAP_ERROR_RFMON_NOTSUP) {
148152 pcap_set_rfmon(handle, 0);
149153 status = pcap_activate(handle);
150 if(!status) return handle;
154 if(status >= 0) {
155 // Complete success, or success with warning.
156 // XXX - report warning?
157 return handle;
158 }
151159 }
152 cprintf(CRITICAL, "[X] ERROR: pcap_activate status %d\n", status);
153 static const char *pcap_errmsg[] = {
154 [1] = "generic error code",
155 [2] = "loop terminated by pcap_breakloop",
156 [3] = "the capture needs to be activated",
157 [4] = "the operation can't be performed on already activated captures",
158 [5] = "no such device exists",
159 [6] = "this device doesn't support rfmon (monitor) mode",
160 [7] = "operation supported only in monitor mode",
161 [8] = "no permission to open the device",
162 [9] = "interface isn't up",
163 [10]= "this device doesn't support setting the time stamp type",
164 [11]= "you don't have permission to capture in promiscuous mode",
165 [12]= "the requested time stamp precision is not supported",
166 };
167 if(status < 0 && status > -13)
168 cprintf(CRITICAL, "[X] PCAP: %s\n", pcap_errmsg[-status]);
160 if(status < 0) {
161 if(status == PCAP_ERROR)
162 cprintf(CRITICAL, "[X] ERROR: pcap_activate status %d - %s, %s\n", status, pcap_statustostr(status), pcap_geterr(handle));
163 else
164 cprintf(CRITICAL, "[X] ERROR: pcap_activate status %d - %s\n", status, pcap_statustostr(status));
165 }
169166 pcap_close(handle);
170167 handle = 0;
171168 }
180180 fprintf(stderr, "\t-K, --pixie-dust Run pixiedust attack\n");
181181 fprintf(stderr, "\t-Z Run pixiedust attack\n");
182182 fprintf(stderr, "\t-O, --output-file=<filename> Write packets of interest into pcap file\n");
183 fprintf(stderr, "\t-M, --mac-changer Change the last digit of the MAC Address for each pin try [False]\n");
183184
184185 fprintf(stderr, "\nExample:\n\t%s -i wlan0mon -b 00:90:4C:C1:AC:21 -vv\n\n", prog_name);
185186