| 885 | } |
| 886 | |
| 887 | uint32_t generateClientFingerprint(const uint8_t *frame, int len) { |
| 888 | uint32_t hash = 5381; |
| 889 | int pos = 24; |
| 890 | |
| 891 | while (pos + 1 < len) { |
| 892 | uint8_t tag = frame[pos]; |
| 893 | uint8_t tagLen = frame[pos + 1]; |
| 894 | |
| 895 | if (pos + 2 + tagLen > len) break; |
| 896 | |
| 897 | hash = ((hash << 5) + hash) + tag; |
| 898 | hash = ((hash << 5) + hash) + tagLen; |
| 899 | |
| 900 | int maxBytes = (tagLen < 4) ? tagLen : 4; |
| 901 | for (int i = 0; i < maxBytes; i++) { hash = ((hash << 5) + hash) + frame[pos + 2 + i]; } |
| 902 | |
| 903 | pos += 2 + tagLen; |
| 904 | } |
| 905 | |
| 906 | return hash; |
| 907 | } |
| 908 | |
| 909 | bool isProbeRequestWithSSID(const wifi_promiscuous_pkt_t *packet) { |
| 910 | if (!packet || packet->rx_ctrl.sig_len < 24) return false; |