| 148 | } |
| 149 | |
| 150 | int main(){ |
| 151 | char message[16] = ""; //This array will store the messages that are sent by the server |
| 152 | setup(); |
| 153 | int difficulty; |
| 154 | printf("How difficult should this be?\n"); |
| 155 | scanf("%d",&difficulty); |
| 156 | printf("%s\n", difficulty?difficulty>1?difficulty==1337?"Only You know what you are capable of":"Execve, Execveat, open, and openat are all blocked":"Execve Will be Blocked":"NO Seccomp Filter applied"); |
| 157 | |
| 158 | //Now we start handling the connections. |
| 159 | while(conn = accept(fd, (struct sockaddr *)NULL, NULL)) { |
| 160 | int pid; |
| 161 | if((pid = fork()) == 0) { |
| 162 | switch(difficulty){ |
| 163 | default: |
| 164 | break; |
| 165 | case 1: |
| 166 | easy_filter(); |
| 167 | |
| 168 | break; |
| 169 | case 2: |
| 170 | difficult_filter(); |
| 171 | break; |
| 172 | case 1337: |
| 173 | read(conn,message,250); |
| 174 | good_luck_filter(); |
| 175 | |
| 176 | |
| 177 | |
| 178 | } |
| 179 | printf("Connected\n"); |
| 180 | if(difficulty != 1337) |
| 181 | while (read(conn, message, 56)>0) { |
| 182 | if(!strncmp("done", message,4)) |
| 183 | return 0; |
| 184 | printf("Message Received: %s\n", message); |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | } |
nothing calls this directly
no test coverage detected