-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframe.cpp
More file actions
71 lines (59 loc) · 1.18 KB
/
frame.cpp
File metadata and controls
71 lines (59 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "frame.h"
static int hex(char c) {
int ret;
switch(c) {
case 'a':
case 'A':
ret = 0xa;
break;
case 'b':
case 'B':
ret = 0xb;
break;
case 'c':
case 'C':
ret = 0xc;
break;
case 'd':
case 'D':
ret = 0xd;
break;
case 'e':
case 'E':
ret = 0xe;
break;
case 'f':
case 'F':
ret = 0xf;
break;
default:
ret = c - '0';
break;
}
return ret;
}
Frame::Frame()
{
radio.it_len = radio.it_pad = radio.it_present = radio.it_version = 0;
deauth.duration = deauth.frag_seq_num = deauth.reason_code = 0;
deauth.type = 0x00c0;
deauth.reason_code = 0x0007;
}
void Frame::pack_ap(char *addr)
{
for (int i=0; i<6; i++) {
uint8_t value = 0;
value += hex(addr[3*i]) << 4;
value |= hex(addr[3*i+1]);
this->deauth.bssid[i] = this->deauth.send_addr[i] = value;
}
}
void Frame::pack_station(char *addr)
{
for (int i=0; i<6; i++) {
uint8_t value = 0;
value += hex(addr[3*i]) << 4;
value |= hex(addr[3*i+1]);
this->deauth.recv_addr[i] = value;
}
}