Fixed show all passwords.

This commit is contained in:
Afonso Clerigo Mendes de Sousa 2025-02-27 20:41:12 +00:00
parent fafc45b720
commit ad2ff3304a
3 changed files with 15 additions and 15 deletions

BIN
KeyMaster

Binary file not shown.

Binary file not shown.

View File

@ -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(">> ");