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

Some cleanup

parent 117ab72d
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ QT += core gui
QT += widgets
QT += charts

TARGET  = cpack-gui
TARGET  = cppack-gui
TEMPLATE = app

INCLUDEPATH += include
+3 −3
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ LDFLAGS = -lpthread
SRC	 = src
INC	 = include
OBJ = obj
BIN  = cpack
BIN  = cppack
BINGUI = $(BIN)-gui

.PHONY = clean
@@ -21,8 +21,8 @@ $(OBJ)/statsgen.o: $(SRC)/core/statsgen.cpp $(INC)/statsgen.h $(INC)/utils.h
	$(CXX) $(CXXFLAGS) $< -c -o $@

clean:
	-rm -rf $(OBJ)
	-rm -rf $(OBJ)/*

$(BINGUI):
	qmake -o qmakefile
	make -f qmakefile
	$(MAKE) -f qmakefile
+0 −0

File moved.

Report/.gitkeep

deleted100644 → 0
+0 −0

Empty file deleted.

Utils/convert.cpp

deleted100644 → 0
+0 −69
Original line number Diff line number Diff line
#include <iostream>
#include <fstream>
#include <regex>

using namespace std;

int main(int argc,char* argv[]) {
	if(argc < 3)
	{
		wcerr << "\nMissing arguments\n" << endl;
		return -1;
	}

	locale::global(locale(""));
	string filename=argv[1];
	string outputfile=argv[2];

	wifstream readfile(filename);
	wofstream writefile(outputfile.c_str());
	
	wstring line;
	/*wstring cleanKey  = wstring(L"^\\s+");
	wstring repl = wstring(L"");

	wstring parseKey  = wstring(L"\\s*(\\d+) (.+)");*/
	double sum=0;
	while(readfile.good())
	{
  		getline(readfile, line);
		if (line.size() == 0) 
		{
    	continue;
		}

		/*wstring cleanLine = regex_replace(line, std::wregex(cleanKey),  repl);
		wsmatch parsedPassword;
		regex_match(line,parsedPassword,std::wregex(parseKey));
		if(parsedPassword.size()>2)
		{
			int nbPasswords=stoi(parsedPassword[1]);
			
			for(int j=0;j<nbPasswords;j++)
			{
				writefile << parsedPassword[2] << endl;
			}
		}*/
		bool number=false;
		int i=0;
		for(i=0;i<line.length();i++)
		{
			if(iswdigit(line.at(i)))
			{
				number=true;
			}
			else if (!iswdigit(line.at(i)) && number)
			{
				break;
			}
		}
		wstring password=line.substr(i+1,line.length());
		int nbPasswords=stoi(line.substr(0,i));
		sum+=nbPasswords;
		for(int j=0;j<nbPasswords;j++)
		{
			writefile << password << endl;
		}
  }
  wcout << L"Numbers of passwords :"<<sum<<endl;
}
Loading