Added the first server request.
This commit is contained in:
parent
a17f7baf0a
commit
74e47ea1bf
BIN
bin/KeyMaster
BIN
bin/KeyMaster
Binary file not shown.
15
src/main.c
15
src/main.c
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user