Loading Adaptation/include/statsgen.h +2 Changes for Adaptation/include/statsgen.h: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ public: void setHiderare(int); void setTop(int); void setRegex(std::string); void setWithcount(bool); void analyze_password(const std::wstring&, int &, std::wstring &, std::wstring &, std::wstring &,Policy &); int generate_stats(const std::string &); Loading @@ -44,6 +45,7 @@ private: int top = -1; std::wregex current_regex; bool use_regex = false; bool withcount = false; // dico Loading Adaptation/src/main.cpp +5 −1 Changes for Adaptation/src/main.cpp: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ int main(int argc,char* argv[]) { if (argc > 1) { for (int i = 1; i < argc; i++) { if (string(argv[i]) == "--hiderare" || string(argv[i]) == "-r") { if (string(argv[i]) == "--hiderare" || string(argv[i]) == "-hr") { test.setHiderare(1); } Loading @@ -45,6 +45,10 @@ int main(int argc,char* argv[]) { return 0; } else if (string(argv[i]) == "--withcount" || string(argv[i]) == "-w") { test.setWithcount(true); } else { filename = argv[i]; } Loading Adaptation/src/statsgen.cpp +61 −6 Changes for Adaptation/src/statsgen.cpp: 61 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -13,11 +13,13 @@ using namespace std; void Statsgen::showHelp() { wcout << "\nUsage database.txt [options]\n" << endl; wcout << "\nUsage: database.txt [options]\n" << endl; wcout << "Options:" << endl; wcout << "\t--help, -h\t\t:\tShow this help message" << endl; wcout << "\t--hiderare, -r\t\t:\tHide all statistics below 1%" << endl; wcout << "\t--withcount, -w\t\t:\tMendatory if the input database has the following format : [number of occurence] [password]\n" << endl; wcout << "\t--hiderare, -hr\t\t:\tHide all statistics below 1%" << endl; wcout << "\t--top, -t [value]\t:\tShow only [value] first results" << endl; wcout << "\t--regex [value]\t\t:\tShow result for password, using the regular expression [value]" << endl; Loading Loading @@ -47,6 +49,9 @@ void Statsgen::setRegex(string expr) { } void Statsgen::setWithcount(bool val) { withcount = val; } Loading Loading @@ -201,6 +206,20 @@ void Statsgen::analyze_password(const wstring & password, int & length, wstring **********************************************************************/ bool analyse_withcount(wstring & line) { wstring key = wstring(L"^\\s+"); wstring repl = wstring(L""); wstring key2 = wstring(L"(\\d+) (.+)"); wstring cleanLine = regex_replace(line, std::wregex(key), repl); wsmatch m; regex_match(cleanLine,m,std::wregex(key2)); return (m.size() > 2); } void Statsgen::updateMinMax(const Policy & pol) { if (mindigit == -1 || mindigit > pol.digit) { mindigit = pol.digit; Loading Loading @@ -232,7 +251,6 @@ void Statsgen::updateMinMax(const Policy & pol) { } int Statsgen::generate_stats(const string & filename) { wifstream readfile(filename); wstring line; Loading @@ -242,28 +260,65 @@ int Statsgen::generate_stats(const string & filename) { wstring advancedmask_string; wstring simplemask_string; Policy pol; int nbline = 0; wstring key = wstring(L"^\\s+"); wstring repl = wstring(L""); wstring key2 = wstring(L"\\s*(\\d+) (.+)"); wsmatch parsedPassword; while(readfile.good()) { getline(readfile, line); nbline++; if (line.size() == 0) { wcout << "Error empty password, line " << nbline << endl; continue; } total_counter++; if (withcount) { regex_match(line, parsedPassword, std::wregex(key2)); if ( (use_regex && regex_match(line, current_regex)) || !use_regex ) { if(parsedPassword.size()>2) { int i = stoi(parsedPassword[1]); total_counter += i; //if ( !use_regex || (use_regex && regex_match(parsedPassword[2],current_regex)) ) { total_filter += i; analyze_password(parsedPassword[2], pass_length, characterset, simplemask_string, advancedmask_string, pol); stats_length[pass_length] += i; stats_charactersets[characterset] += i; stats_simplemasks[simplemask_string] += i; stats_advancedmasks[advancedmask_string] += i; //} } else { wcout << "Error format withcount, line " << nbline << endl; } } else { if ( !use_regex || (use_regex && regex_match(line,current_regex)) ) { total_filter++; analyze_password(line, pass_length, characterset, simplemask_string, advancedmask_string, pol); updateMinMax(pol); stats_length[pass_length] += 1; stats_charactersets[characterset] += 1; stats_simplemasks[simplemask_string] += 1; stats_advancedmasks[advancedmask_string] += 1; } total_counter++; } updateMinMax(pol); } Loading Resultat/analyseRockyouExtended.txt +67 Changes for Resultat/analyseRockyouExtended.txt: 67 added lines, 0 removed lines. Original line number Diff line number Diff line Error empty password, line 32603049 Selected 32603048 on 32603048 passwords (-31.7351 %) min - max digit: 0 - 255 lower: 0 - 255 upper: 0 - 187 special: 0 - 255 Statistics relative to length: 6: 26,03% (8488397) 8: 19,97% (6513103) 7: 19,28% (6288017) 9: 12,11% (3949837) 10: 9,062% (2954636) 5: 4,070% (1327038) 11: 3,568% (1163314) 12: 2,106% (686849) 13: 1,317% (429680) Statistics relative to charsets: loweralpha: 41,68% (13589189) loweralphanum: 33,17% (10814660) numeric: 15,92% (5192990) loweralphaspecial: 1,641% (535339) upperalphanum: 1,632% (532259) upperalpha: 1,497% (488159) loweralphaspecialnum: 1,442% (470187) mixedalphanum: 1,421% (463511) Statistics relative to simplemasks: lower: 41,68% (13589189) lowerdigit: 27,68% (9026390) digit: 15,92% (5192990) digitlower: 2,533% (826139) lowerdigitlower: 1,619% (527902) upper: 1,497% (488159) upperdigit: 1,348% (439715) Statistics relative to advancedmask: ?l?l?l?l?l?l: 12,23% (3987861) ?l?l?l?l?l?l?l: 8,398% (2738007) ?l?l?l?l?l?l?l?l: 7,574% (2469665) ?d?d?d?d?d?d: 6,989% (2278919) ?l?l?l?l?l?l?l?l?l: 4,239% (1382159) ?l?l?l?l?l: 2,892% (943190) ?l?l?l?l?l?l?d?d: 2,834% (923984) ?l?l?l?l?l?l?l?l?l?l: 2,667% (869661) ?d?d?d?d?d?d?d?d: 2,507% (817577) ?l?l?l?l?l?d?d: 2,305% (751545) ?l?l?l?l?l?l?d: 2,227% (726218) ?d?d?d?d?d?d?d: 1,968% (641769) ?l?l?l?l?d?d: 1,884% (614415) ?l?l?l?l?l?l?l?d: 1,744% (568666) ?l?l?l?l?l?d: 1,658% (540862) ?d?d?d?d?d?d?d?d?d?d: 1,658% (540758) ?l?l?l?l?l?l?l?d?d: 1,497% (488271) ?l?l?l?l?l?l?l?l?l?l?l: 1,401% (456855) ?d?d?d?d?d?d?d?d?d: 1,377% (449017) ?l?l?l?l?l?l?l?l?d: 1,230% (401068) ?l?l?l?l?l?l?l?l?d?d: 1,093% (356673) Resultat/analyseRockyouWithcount.txt +68 Changes for Resultat/analyseRockyouWithcount.txt: 68 added lines, 0 removed lines. Original line number Diff line number Diff line Error format withcount, line 4751 Error empty password, line 14344392 Selected 0 on 32603048 passwords (0 %) min - max digit: 0 - 255 lower: 0 - 255 upper: 0 - 187 special: 0 - 255 Statistics relative to length: 6: 26,03% (8488397) 8: 19,97% (6513103) 7: 19,28% (6288017) 9: 12,11% (3949837) 10: 9,062% (2954636) 5: 4,070% (1327038) 11: 3,568% (1163314) 12: 2,106% (686849) 13: 1,317% (429680) Statistics relative to charsets: loweralpha: 41,68% (13589189) loweralphanum: 33,17% (10814660) numeric: 15,92% (5192990) loweralphaspecial: 1,641% (535339) upperalphanum: 1,632% (532259) upperalpha: 1,497% (488159) loweralphaspecialnum: 1,442% (470187) mixedalphanum: 1,421% (463511) Statistics relative to simplemasks: lower: 41,68% (13589189) lowerdigit: 27,68% (9026390) digit: 15,92% (5192990) digitlower: 2,533% (826139) lowerdigitlower: 1,619% (527902) upper: 1,497% (488159) upperdigit: 1,348% (439715) Statistics relative to advancedmask: ?l?l?l?l?l?l: 12,23% (3987861) ?l?l?l?l?l?l?l: 8,398% (2738007) ?l?l?l?l?l?l?l?l: 7,574% (2469665) ?d?d?d?d?d?d: 6,989% (2278919) ?l?l?l?l?l?l?l?l?l: 4,239% (1382159) ?l?l?l?l?l: 2,892% (943190) ?l?l?l?l?l?l?d?d: 2,834% (923984) ?l?l?l?l?l?l?l?l?l?l: 2,667% (869661) ?d?d?d?d?d?d?d?d: 2,507% (817577) ?l?l?l?l?l?d?d: 2,305% (751545) ?l?l?l?l?l?l?d: 2,227% (726218) ?d?d?d?d?d?d?d: 1,968% (641769) ?l?l?l?l?d?d: 1,884% (614415) ?l?l?l?l?l?l?l?d: 1,744% (568666) ?l?l?l?l?l?d: 1,658% (540862) ?d?d?d?d?d?d?d?d?d?d: 1,658% (540758) ?l?l?l?l?l?l?l?d?d: 1,497% (488271) ?l?l?l?l?l?l?l?l?l?l?l: 1,401% (456855) ?d?d?d?d?d?d?d?d?d: 1,377% (449017) ?l?l?l?l?l?l?l?l?d: 1,230% (401068) ?l?l?l?l?l?l?l?l?d?d: 1,093% (356673) Loading
Adaptation/include/statsgen.h +2 Changes for Adaptation/include/statsgen.h: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ public: void setHiderare(int); void setTop(int); void setRegex(std::string); void setWithcount(bool); void analyze_password(const std::wstring&, int &, std::wstring &, std::wstring &, std::wstring &,Policy &); int generate_stats(const std::string &); Loading @@ -44,6 +45,7 @@ private: int top = -1; std::wregex current_regex; bool use_regex = false; bool withcount = false; // dico Loading
Adaptation/src/main.cpp +5 −1 Changes for Adaptation/src/main.cpp: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ int main(int argc,char* argv[]) { if (argc > 1) { for (int i = 1; i < argc; i++) { if (string(argv[i]) == "--hiderare" || string(argv[i]) == "-r") { if (string(argv[i]) == "--hiderare" || string(argv[i]) == "-hr") { test.setHiderare(1); } Loading @@ -45,6 +45,10 @@ int main(int argc,char* argv[]) { return 0; } else if (string(argv[i]) == "--withcount" || string(argv[i]) == "-w") { test.setWithcount(true); } else { filename = argv[i]; } Loading
Adaptation/src/statsgen.cpp +61 −6 Changes for Adaptation/src/statsgen.cpp: 61 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -13,11 +13,13 @@ using namespace std; void Statsgen::showHelp() { wcout << "\nUsage database.txt [options]\n" << endl; wcout << "\nUsage: database.txt [options]\n" << endl; wcout << "Options:" << endl; wcout << "\t--help, -h\t\t:\tShow this help message" << endl; wcout << "\t--hiderare, -r\t\t:\tHide all statistics below 1%" << endl; wcout << "\t--withcount, -w\t\t:\tMendatory if the input database has the following format : [number of occurence] [password]\n" << endl; wcout << "\t--hiderare, -hr\t\t:\tHide all statistics below 1%" << endl; wcout << "\t--top, -t [value]\t:\tShow only [value] first results" << endl; wcout << "\t--regex [value]\t\t:\tShow result for password, using the regular expression [value]" << endl; Loading Loading @@ -47,6 +49,9 @@ void Statsgen::setRegex(string expr) { } void Statsgen::setWithcount(bool val) { withcount = val; } Loading Loading @@ -201,6 +206,20 @@ void Statsgen::analyze_password(const wstring & password, int & length, wstring **********************************************************************/ bool analyse_withcount(wstring & line) { wstring key = wstring(L"^\\s+"); wstring repl = wstring(L""); wstring key2 = wstring(L"(\\d+) (.+)"); wstring cleanLine = regex_replace(line, std::wregex(key), repl); wsmatch m; regex_match(cleanLine,m,std::wregex(key2)); return (m.size() > 2); } void Statsgen::updateMinMax(const Policy & pol) { if (mindigit == -1 || mindigit > pol.digit) { mindigit = pol.digit; Loading Loading @@ -232,7 +251,6 @@ void Statsgen::updateMinMax(const Policy & pol) { } int Statsgen::generate_stats(const string & filename) { wifstream readfile(filename); wstring line; Loading @@ -242,28 +260,65 @@ int Statsgen::generate_stats(const string & filename) { wstring advancedmask_string; wstring simplemask_string; Policy pol; int nbline = 0; wstring key = wstring(L"^\\s+"); wstring repl = wstring(L""); wstring key2 = wstring(L"\\s*(\\d+) (.+)"); wsmatch parsedPassword; while(readfile.good()) { getline(readfile, line); nbline++; if (line.size() == 0) { wcout << "Error empty password, line " << nbline << endl; continue; } total_counter++; if (withcount) { regex_match(line, parsedPassword, std::wregex(key2)); if ( (use_regex && regex_match(line, current_regex)) || !use_regex ) { if(parsedPassword.size()>2) { int i = stoi(parsedPassword[1]); total_counter += i; //if ( !use_regex || (use_regex && regex_match(parsedPassword[2],current_regex)) ) { total_filter += i; analyze_password(parsedPassword[2], pass_length, characterset, simplemask_string, advancedmask_string, pol); stats_length[pass_length] += i; stats_charactersets[characterset] += i; stats_simplemasks[simplemask_string] += i; stats_advancedmasks[advancedmask_string] += i; //} } else { wcout << "Error format withcount, line " << nbline << endl; } } else { if ( !use_regex || (use_regex && regex_match(line,current_regex)) ) { total_filter++; analyze_password(line, pass_length, characterset, simplemask_string, advancedmask_string, pol); updateMinMax(pol); stats_length[pass_length] += 1; stats_charactersets[characterset] += 1; stats_simplemasks[simplemask_string] += 1; stats_advancedmasks[advancedmask_string] += 1; } total_counter++; } updateMinMax(pol); } Loading
Resultat/analyseRockyouExtended.txt +67 Changes for Resultat/analyseRockyouExtended.txt: 67 added lines, 0 removed lines. Original line number Diff line number Diff line Error empty password, line 32603049 Selected 32603048 on 32603048 passwords (-31.7351 %) min - max digit: 0 - 255 lower: 0 - 255 upper: 0 - 187 special: 0 - 255 Statistics relative to length: 6: 26,03% (8488397) 8: 19,97% (6513103) 7: 19,28% (6288017) 9: 12,11% (3949837) 10: 9,062% (2954636) 5: 4,070% (1327038) 11: 3,568% (1163314) 12: 2,106% (686849) 13: 1,317% (429680) Statistics relative to charsets: loweralpha: 41,68% (13589189) loweralphanum: 33,17% (10814660) numeric: 15,92% (5192990) loweralphaspecial: 1,641% (535339) upperalphanum: 1,632% (532259) upperalpha: 1,497% (488159) loweralphaspecialnum: 1,442% (470187) mixedalphanum: 1,421% (463511) Statistics relative to simplemasks: lower: 41,68% (13589189) lowerdigit: 27,68% (9026390) digit: 15,92% (5192990) digitlower: 2,533% (826139) lowerdigitlower: 1,619% (527902) upper: 1,497% (488159) upperdigit: 1,348% (439715) Statistics relative to advancedmask: ?l?l?l?l?l?l: 12,23% (3987861) ?l?l?l?l?l?l?l: 8,398% (2738007) ?l?l?l?l?l?l?l?l: 7,574% (2469665) ?d?d?d?d?d?d: 6,989% (2278919) ?l?l?l?l?l?l?l?l?l: 4,239% (1382159) ?l?l?l?l?l: 2,892% (943190) ?l?l?l?l?l?l?d?d: 2,834% (923984) ?l?l?l?l?l?l?l?l?l?l: 2,667% (869661) ?d?d?d?d?d?d?d?d: 2,507% (817577) ?l?l?l?l?l?d?d: 2,305% (751545) ?l?l?l?l?l?l?d: 2,227% (726218) ?d?d?d?d?d?d?d: 1,968% (641769) ?l?l?l?l?d?d: 1,884% (614415) ?l?l?l?l?l?l?l?d: 1,744% (568666) ?l?l?l?l?l?d: 1,658% (540862) ?d?d?d?d?d?d?d?d?d?d: 1,658% (540758) ?l?l?l?l?l?l?l?d?d: 1,497% (488271) ?l?l?l?l?l?l?l?l?l?l?l: 1,401% (456855) ?d?d?d?d?d?d?d?d?d: 1,377% (449017) ?l?l?l?l?l?l?l?l?d: 1,230% (401068) ?l?l?l?l?l?l?l?l?d?d: 1,093% (356673)
Resultat/analyseRockyouWithcount.txt +68 Changes for Resultat/analyseRockyouWithcount.txt: 68 added lines, 0 removed lines. Original line number Diff line number Diff line Error format withcount, line 4751 Error empty password, line 14344392 Selected 0 on 32603048 passwords (0 %) min - max digit: 0 - 255 lower: 0 - 255 upper: 0 - 187 special: 0 - 255 Statistics relative to length: 6: 26,03% (8488397) 8: 19,97% (6513103) 7: 19,28% (6288017) 9: 12,11% (3949837) 10: 9,062% (2954636) 5: 4,070% (1327038) 11: 3,568% (1163314) 12: 2,106% (686849) 13: 1,317% (429680) Statistics relative to charsets: loweralpha: 41,68% (13589189) loweralphanum: 33,17% (10814660) numeric: 15,92% (5192990) loweralphaspecial: 1,641% (535339) upperalphanum: 1,632% (532259) upperalpha: 1,497% (488159) loweralphaspecialnum: 1,442% (470187) mixedalphanum: 1,421% (463511) Statistics relative to simplemasks: lower: 41,68% (13589189) lowerdigit: 27,68% (9026390) digit: 15,92% (5192990) digitlower: 2,533% (826139) lowerdigitlower: 1,619% (527902) upper: 1,497% (488159) upperdigit: 1,348% (439715) Statistics relative to advancedmask: ?l?l?l?l?l?l: 12,23% (3987861) ?l?l?l?l?l?l?l: 8,398% (2738007) ?l?l?l?l?l?l?l?l: 7,574% (2469665) ?d?d?d?d?d?d: 6,989% (2278919) ?l?l?l?l?l?l?l?l?l: 4,239% (1382159) ?l?l?l?l?l: 2,892% (943190) ?l?l?l?l?l?l?d?d: 2,834% (923984) ?l?l?l?l?l?l?l?l?l?l: 2,667% (869661) ?d?d?d?d?d?d?d?d: 2,507% (817577) ?l?l?l?l?l?d?d: 2,305% (751545) ?l?l?l?l?l?l?d: 2,227% (726218) ?d?d?d?d?d?d?d: 1,968% (641769) ?l?l?l?l?d?d: 1,884% (614415) ?l?l?l?l?l?l?l?d: 1,744% (568666) ?l?l?l?l?l?d: 1,658% (540862) ?d?d?d?d?d?d?d?d?d?d: 1,658% (540758) ?l?l?l?l?l?l?l?d?d: 1,497% (488271) ?l?l?l?l?l?l?l?l?l?l?l: 1,401% (456855) ?d?d?d?d?d?d?d?d?d: 1,377% (449017) ?l?l?l?l?l?l?l?l?d: 1,230% (401068) ?l?l?l?l?l?l?l?l?d?d: 1,093% (356673)