-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsender.cpp
More file actions
53 lines (32 loc) · 911 Bytes
/
sender.cpp
File metadata and controls
53 lines (32 loc) · 911 Bytes
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
#include"util.hpp"
#include <unistd.h>
void establish_covert_channel(char *communication_buffer){
int i,iter;
//Write to specific sets in the LLC cache to figure out the cache sets that we are
//gonna be using for the communication
for(iter=0; iter<REPETITION_NUM*100; iter++){
for(i=0; i<SET_NUM; i+= SET_JUMP){
communication_buffer[i] = 'a';
}
sleep(0.1);
}
}
int main(int argc, char **argv)
{
// Put your covert channel setup code here
int iter,i,j;
char *communication_buffer;
communication_buffer = (char*)malloc(sizeof(char)*L3_SIZE);
sleep(2);
establish_covert_channel(communication_buffer);
printf("Please type a message.\n");
bool sending = true;
while (sending) {
char text_buf[128];
fgets(text_buf, sizeof(text_buf), stdin);
printf("%c\n",text_buf[0]);
// Put your covert channel code here
}
printf("Sender finished.\n");
return 0;
}