Added the first server request.

This commit is contained in:
Afonso Clerigo Mendes de Sousa 2025-02-27 11:59:45 +00:00
parent a17f7baf0a
commit 74e47ea1bf
3 changed files with 11 additions and 4 deletions

BIN
KeyMaster

Binary file not shown.

Binary file not shown.

View File

@ -20,6 +20,7 @@ typedef struct Request
unsigned char type;
char *key;
int ID;
int level;
} Request;
void clear_input_buffer(void)
@ -59,7 +60,7 @@ int main(void)
buffer = size(buffer, 256);
emcryptText(buffer, password);
writel(PASS_FILE, buffer, 256 * sizeof(int));
writel(PASS_FILE, buffer, 256);
free(buffer);
}
@ -176,9 +177,11 @@ int main(void)
send(sockfd, &req, sizeof(Request), 0);
// Receive response from the server
char response[1024] = {0};
recv(sockfd, response, sizeof(response), 0);
printf("%s\n", response);
recv(sockfd, &req, sizeof(req), 0);
if (req.level == -1)
{
printf("No existing passwords, use \"addpass\" command to add a password to the list.\n");
}
printf("<------->\n\n");
choice = prompNormalRequest(">> ");
@ -186,6 +189,10 @@ int main(void)
{
break;
}
else if (strcmp("choise", "addpass"))
{
printf("adding new password to the server.");
}
else
{
printf("Invalid command (%s)\n\"Q\" or \"quit\" or \"exit\" to close the program\n", choice);