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)
|
||||
{
|
||||
printf("\nList of existing passwords:\n<------->\n");
|
||||
|
||||
// Send a request with type 0 (REQUEST)
|
||||
Request req;
|
||||
|
||||
for (size_t i = 0; i < 254; i++)
|
||||
{
|
||||
// Send a request with type 0 (REQUEST)
|
||||
|
||||
req.type = 0;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.ID = 0;
|
||||
req.level = 1;
|
||||
req.level = (int)i;
|
||||
send(sockfd, &req, sizeof(Request), 0);
|
||||
|
||||
// Receive response from the server
|
||||
recv(sockfd, &req, sizeof(req), 0);
|
||||
if (req.level == -1)
|
||||
{
|
||||
printf("No existing passwords with, use \"addpass\" command to add a password to the list.\n");
|
||||
}
|
||||
else
|
||||
if (req.level != -1)
|
||||
{
|
||||
printf("Level: %d\tKey: %s\n", req.level, req.key);
|
||||
}
|
||||
}
|
||||
|
||||
printf("<------->\n\n");
|
||||
choice = prompNormalRequest(">> ");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user