Commit f76b0b19 authored by Mathieu Valois's avatar Mathieu Valois
Browse files

moved showHelp

parent c3e53a7c
Loading
Loading
Loading
Loading
+31 −1
Changes for Statsgen/src/main.cpp: 31 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -15,9 +15,39 @@
#include <fstream>
#include <unistd.h>
#include "statsgen.h"

using namespace std;


void showHelp() {
	static const char* USAGE[] = {
		"Usage: stats database.txt [OPTIONS]",
		"To be sure the database's format can be read, please use this command before:",
		"	iconv -f ISO-8859-1 -t UTF-8 databaseInput.txt -o databaseOutput.txt",
		"Options:",
		"	--help, -h          Show this help message",
		"	--withcount, -w     Mendatory if the input database has the following format : [number of occurence] [password]",
		"	--hiderare, -hr     Hide all statistics below 1%",
		"	--top, -t [value]   Show only [value] first results",
		"	--regex, -r [value] Show result for password, using the regular expression [value]",
		"",
		"Optimisation options to reduce the execution time : ",
		"	--limitadvancedmasks, -lam [value]  Limit the size of the advanced masks at [value], if size>[value]: othermasks",
		"	--limitsimplemasks, -lsm [value]    Limit the size of the simple masks at [value], if size>[value]: othermasks",
		"	--parallel, -p [value]              Number of usable threads",
		"",
		"",
		"Security rules: ",
		"	--security, -s		Define the security rules",
		"",
        NULL
    };
    for(int line = 0; USAGE[line] != NULL; line++){
            cerr << USAGE[line] << endl;
    }
    exit(EXIT_FAILURE);
}


int main(int argc,char* argv[]) {
	if(argc < 2){
@@ -73,7 +103,7 @@ int main(int argc,char* argv[]) {
			}

			else if (string(argv[i]) == "--help" || string(argv[i]) == "-h") {
				test.showHelp();
				showHelp();
				return 0;
			}

−28
Changes for Statsgen/src/statsgen.cpp: 0 added lines, 28 removed lines.
Original line number Diff line number Diff line
@@ -24,34 +24,6 @@
using namespace std;




void Statsgen::showHelp() {
	wcout << "\nUsage: database.txt [options]\n" << endl;

	wcout << "To be sure the database's format can be read, please use this command before:" << endl;
	wcout << "\ticonv -f ISO-8859-1 -t UTF-8 databaseInput.txt -o databaseOutput.txt\n" << endl;

	wcout << "Options:" << endl;
	wcout << "\t--help, -h\t\t:\tShow this help message" << 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, -r [value]\t:\tShow result for password, using the regular expression [value]" << endl;

	wcout << "\n\nOptimisation options to reduce the execution time : " << endl;
	wcout << "\t--limitadvancedmasks, -lam [value]\t:\tLimit the size of the advanced masks at [value], if size>[value]: othermasks" << endl;
	wcout << "\t--limitsimplemasks, -lsm [value]\t:\tLimit the size of the simple masks at [value], if size>[value]: othermasks" << endl;
	wcout << "\t--parallel, -p [value]\t\t\t:\tNumber of usable threads" << endl;
	
	wcout << "\n\nSecurity rules: " << endl;
	wcout << "\t--security, -s\t:\tDefine the security rules" << endl;
	wcout << "\n" << endl;
}



void Statsgen::setFilename(std::string name) {
	filename = name;
}