Fixed show all passwords.
This commit is contained in:
parent
fafc45b720
commit
ad2ff3304a
BIN
bin/KeyMaster
BIN
bin/KeyMaster
Binary file not shown.
16
src/main.c
16
src/main.c
@ -167,25 +167,25 @@ int main(void)
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
printf("\nList of existing passwords:\n<------->\n");
|
printf("\nList of existing passwords:\n<------->\n");
|
||||||
|
|
||||||
// Send a request with type 0 (REQUEST)
|
|
||||||
Request req;
|
Request req;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 254; i++)
|
||||||
|
{
|
||||||
|
// Send a request with type 0 (REQUEST)
|
||||||
|
|
||||||
req.type = 0;
|
req.type = 0;
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.ID = 0;
|
req.ID = 0;
|
||||||
req.level = 1;
|
req.level = (int)i;
|
||||||
send(sockfd, &req, sizeof(Request), 0);
|
send(sockfd, &req, sizeof(Request), 0);
|
||||||
|
|
||||||
// Receive response from the server
|
// Receive response from the server
|
||||||
recv(sockfd, &req, sizeof(req), 0);
|
recv(sockfd, &req, sizeof(req), 0);
|
||||||
if (req.level == -1)
|
if (req.level != -1)
|
||||||
{
|
|
||||||
printf("No existing passwords with, use \"addpass\" command to add a password to the list.\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
printf("Level: %d\tKey: %s\n", req.level, req.key);
|
printf("Level: %d\tKey: %s\n", req.level, req.key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("<------->\n\n");
|
printf("<------->\n\n");
|
||||||
choice = prompNormalRequest(">> ");
|
choice = prompNormalRequest(">> ");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user