Skip to content

Commit

Permalink
add encryption detection
Browse files Browse the repository at this point in the history
  • Loading branch information
quackduck committed Jan 8, 2024
1 parent 5c6261e commit 5837861
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wif.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef struct {
typedef struct {
char* bssid;
char* ssid;
short encrypted;
} bssid_ssid;

char* lookup_ssid(const char* bssid, bssid_ssid bs[], int bs_len);
Expand Down Expand Up @@ -186,6 +187,9 @@ got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet)
memccpy(bs[i].ssid, curr+38, 0x01, 32); // empirically, a 01 seems to always follow the bssid
bs[i].ssid[strlen(bs[i].ssid) - 1] = 0; // set that 0x01 to 0

// if the 4th bit of the 34-index byte is 1, it's encrypted
bs[i].encrypted = (curr[34] & 0b00010000) >> 4;

bs_len++;
printf("SSID: %s\n", bs[i].ssid);
break;
Expand Down Expand Up @@ -272,11 +276,11 @@ got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet)
}

// Print BSSID to SSID table
printf("\n%17s %s\n", "BSSID", "SSID");
printf("\n%17s %s %s\n", "BSSID", "Encrypted?", "SSID");
for (int i = 0; i < 100; i++)
{
if (bs[i].bssid == NULL) break;
printf("%s %s\n", bs[i].bssid, bs[i].ssid);
printf("%s %10s %s\n", bs[i].bssid, bs[i].encrypted ? "✅" : "⛔", bs[i].ssid);
}


Expand Down

0 comments on commit 5837861

Please sign in to comment.