Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding percentage indicator for loading big xpoint files #259

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions keyhunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6464,6 +6464,9 @@ bool forceReadFileXPoint(char *fileName) {
fprintf(stderr,"[E] Error opening the file %s, line %i\n",fileName,__LINE__ - 2);
return false;
}

fprintf(stderr, "[+] Count lines in file\n");

/*Count lines in the file*/
numberItems = 0;
while(!feof(fileDescriptor)) {
Expand All @@ -6489,11 +6492,21 @@ bool forceReadFileXPoint(char *fileName) {
if(!initBloomFilter(&bloom,N))
return false;

uint64_t onepercent = numberItems / 100;

i= 0;
while(i < N) {
memset(aux,0,1000);
hextemp = fgets(aux,1000,fileDescriptor);
memset((void *)&addressTable[i],0,sizeof(struct address_value));

//Show loading percentage in 1% steps
if (i % onepercent == 0) {

fprintf(stderr, "\r[+] %lu %%\r", (i / onepercent));

}

if(hextemp == aux) {
trim(aux," \t\n\r");
stringtokenizer(aux,&tokenizer_xpoint);
Expand Down