程序代写代做代考 Ok, so we outsourced this assignment to a sweat shop worker. Unfortunately, they went AWOL, leaving only a cryptic program. We believe that the assignment is hidden somewhere there, but some work is required to find this out. The program itself is in [server.c](https://myuni.adelaide.edu.au/courses/36233/files/3532384/download?verifier=6hm44fHQkUuj3yaL4agnBuV5jMVg5s3blLKy66c6&wrap=1)[![img](https://myuni.adelaide.edu.au/images/preview.png)](https://myuni.adelaide.edu.au/courses/36233/files/3532384/download?verifier=6hm44fHQkUuj3yaL4agnBuV5jMVg5s3blLKy66c6&wrap=1). The relevant part is:

Ok, so we outsourced this assignment to a sweat shop worker. Unfortunately, they went AWOL, leaving only a cryptic program. We believe that the assignment is hidden somewhere there, but some work is required to find this out. The program itself is in [server.c](https://myuni.adelaide.edu.au/courses/36233/files/3532384/download?verifier=6hm44fHQkUuj3yaL4agnBuV5jMVg5s3blLKy66c6&wrap=1)[![img](https://myuni.adelaide.edu.au/images/preview.png)](https://myuni.adelaide.edu.au/courses/36233/files/3532384/download?verifier=6hm44fHQkUuj3yaL4agnBuV5jMVg5s3blLKy66c6&wrap=1). The relevant part is:

“`c
static char *password= [REMOVED];

#define MLEN [REMOVED]
uint8_t key[MLEN] = {
[REMOVED]
};
uint8_t message[MLEN] = {
[REMOVED]
};

int isPositiveNumber(char *s) {
while (*s != ‘\0’) {
if (!isdigit(*s))
return 0;
s++;
}
return 1;
}
void serve(int ns) {
char inbuf[100];
char outbuf[100];

for (;;) {
readline(inbuf, sizeof(inbuf), ns);
if (*inbuf == ‘\0’) {
close(ns);
return;
}
if (isPositiveNumber(inbuf)) {
int i = atoi(inbuf);
if (i < MLEN) { sprintf(outbuf, "Byte at %d 0x%02x\n", i, message[i]); write(ns, outbuf, strlen(outbuf)); } else { sprintf(outbuf, "Index %d out of bounds\n", i); write(ns, outbuf, strlen(outbuf)); } } else { if (!strcmp(inbuf, password)) { for (int i = 0; i < MLEN; i++) { uint8_t b = message[i]^key[i]; write(ns, &b, 1); } } else { write(ns, "Wrong password!\n", strlen("Wrong password!\n")); } } } } ``` The program itself listen to communication on port 5555 of gdi.cs.adelaide.edu.au. (Use telnet or nc to connect - this is only available inside the University network or via the VPN, or you can SSH to USS and connect from it.) **Update** We are happy to report that unreliable resources has been located and humanely terminated following assignment recovery. The assignment description can be viewed [here.](https://myuni.adelaide.edu.au/courses/36233/files/3543403/download?verifier=1b6ECX3qX9ungwdfGDUfXqmHmBIlHVoWWkCI5dsC&wrap=1)[![img](https://myuni.adelaide.edu.au/images/preview.png)](https://myuni.adelaide.edu.au/courses/36233/files/3543403/download?verifier=1b6ECX3qX9ungwdfGDUfXqmHmBIlHVoWWkCI5dsC&wrap=1)