Compare commits
5 Commits
ClientConn
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 83e9f761e8 | |||
| f8a47b5683 | |||
| 6cff81c1d3 | |||
| 9a9f53967c | |||
| 64d4c825d4 |
BIN
bin/KeyMaster
BIN
bin/KeyMaster
Binary file not shown.
44
src/main.c
44
src/main.c
@ -70,7 +70,7 @@ int main(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("KeyMaster\nVersion: 0.3\n\n");
|
printf("KeyMaster\nVersion: 0.3.1\n\n");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -202,12 +202,18 @@ int main(void)
|
|||||||
recv(sockfd, &req1, sizeof(req1), 0);
|
recv(sockfd, &req1, sizeof(req1), 0);
|
||||||
if (req1.level != -1 && strlen(req1.key) > 0)
|
if (req1.level != -1 && strlen(req1.key) > 0)
|
||||||
{
|
{
|
||||||
char hidden_key[256];
|
char hidden_key[256] = {0};
|
||||||
strncpy(hidden_key, req1.key, 6);
|
strncpy(hidden_key, req1.key, 6);
|
||||||
for (size_t i = 6; i < strlen(req1.key); i++)
|
if (strlen(req1.key) > 6)
|
||||||
{
|
{
|
||||||
hidden_key[i] = '.';
|
hidden_key[5] = '<';
|
||||||
|
for (size_t i = 6; i < strlen(req1.key); i++)
|
||||||
|
{
|
||||||
|
hidden_key[i] = '.';
|
||||||
|
}
|
||||||
|
hidden_key[strlen(req1.key) - 1] = '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Level: %d\tKey: %s\n", req1.level, hidden_key);
|
printf("Level: %d\tKey: %s\n", req1.level, hidden_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,6 +291,36 @@ int main(void)
|
|||||||
|
|
||||||
send(sockfd, &req, sizeof(req), 0);
|
send(sockfd, &req, sizeof(req), 0);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(choice, "getpass") == 0)
|
||||||
|
{
|
||||||
|
printf("Please enter the level of security for the password to get (1-255): ");
|
||||||
|
int level;
|
||||||
|
scanf("%d", &level);
|
||||||
|
clear_input_buffer();
|
||||||
|
|
||||||
|
if (level < 0 && level > 255)
|
||||||
|
{
|
||||||
|
printf("Invalid level of security\nStopping...\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// send request with TYPE = 0
|
||||||
|
req.type = 0;
|
||||||
|
memset(&req.key, 0, sizeof(req.key));
|
||||||
|
req.ID = 1;
|
||||||
|
req.level = level;
|
||||||
|
|
||||||
|
send(sockfd, &req, sizeof(req), 0);
|
||||||
|
|
||||||
|
recv(sockfd, &req, sizeof(req), 0);
|
||||||
|
if (req.level != -1 && strlen(req.key) > 0)
|
||||||
|
{
|
||||||
|
printf("Password: %s\n", req.key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\nPassword not found\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Invalid command (%s)\n\"Q\" or \"quit\" or \"exit\" to close the program\n", choice);
|
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