diff --git a/Makefile b/Makefile
index c82e9d6d..8267ac74 100644
--- a/Makefile
+++ b/Makefile
@@ -5,14 +5,14 @@
##############################################################################################################
# Compiler
-CC := g++
+CC := g++
#output directory
-BIN := bin
+BIN := bin
#include directory
-INCLUDE := include
+INCLUDE := include
#Libraries
-LIB := lib
-LIBRARIES :=
+LIB := lib
+LIBRARIES :=
ifndef PYTHON_VERSION
PYTHON_VERSION := $(shell python3 -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";) #3.8
@@ -20,34 +20,21 @@ endif
PYTHON_VERSION_ :=$(shell python$(PYTHON_VERSION) -c "import sys;t='{v[0]}{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";) #38
PYTHON_VERSION3 :=$(shell python$(PYTHON_VERSION) -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)";) #3.8.s2
-##############################################################################################################
-##################################### MarkovPassword project options #################################
-##############################################################################################################
-
-MP_C_FLAGS := -Wall -Wextra -g
-MP_EXEC := Markov
-MP_SRC := $(shell find ./MarkovPasswords/src/ -name '*.cpp') $(shell find ./MarkovModel/src/ -name '*.cpp')
-
-#build pattern
-$(BIN)/$(MP_EXEC): $(MP_SRC)
- $(CC) $(MP_C_FLAGS) -I$(INCLUDE) -L$(LIB) $^ -o $@ $(LIBRARIES)
-
-PYTHON_VERSION_ :=$(shell python$(PYTHON_VERSION) -c "import sys;t='{v[0]}{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";) #38
-PYTHON_VERSION3 :=$(shell python$(PYTHON_VERSION) -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)";) #3.8.s2
##############################################################################################################
##################################### MarkovPassword project options #################################
##############################################################################################################
MP_C_FLAGS := -Wall -Wextra -g
MP_EXEC := Markov
-MP_SRC := $(shell find ./MarkovPasswords/src/ -name '*.cpp') $(shell find ./MarkovModel/src/ -name '*.cpp')
+MP_SRC := $(shell find ./MarkovPasswords/src/ -name '*.cpp')
MP_INC :=
MP_LIB := -lboost_program_options
+MP_INC := $(shell pwd)
+
#build pattern
$(BIN)/$(MP_EXEC): $(MP_SRC)
- $(CC) $(MP_C_FLAGS) -I$(MP_INC) -L$(LIB) $^ -o $@ $(MP_LIB)
-
+ $(CC) $(MP_C_FLAGS) -I$(MP_INC) -L$(LIB) $^ -o $@ $(MP_LIB)
##############################################################################################################
##################################### MarkovModel project options #################################
@@ -77,12 +64,13 @@ $(BIN)/%.cpp.o:%.cpp
##################################### Markopy Options #################################
##############################################################################################################
-MPY_SRC := $(shell find MarkovModel/src/ -name '*.cpp') MarkovPasswords/src/markovPasswords.cpp $(shell find Markopy/src/Module/ -name '*.cpp')
+MPY_SRC_DIR := Markopy/src/
+MPY_SRC := MarkovPasswords/src/markovPasswords.cpp $(shell find Markopy/src/Module/ -name '*.cpp')
MPY_OBJS := $(MPY_SRC:%=$(BIN)/%.o)
MPY_DEPS := $(MPY_OBJS:.o=.d)
MPY_LDFLAGS := -shared -lboost_python$(PYTHON_VERSION_) -lpython$(PYTHON_VERSION)
MPY_C_FLAGS := $(MPY_INC_FLAGS) -MMD -MP -fPIC -I/usr/include/python$(PYTHON_VERSION)
-MPY_INC_DIRS := $(shell find $(MPY_SRC_DIR) -type d)
+MPY_INC_DIRS := $(shell find $(MPY_SRC_DIR) -type d) $(shell pwd)
MPY_INC_FLAGS := $(addprefix -I,$(MPY_INC_DIRS))
MPY_SO := markopy.so
@@ -92,7 +80,7 @@ $(BIN)/$(MPY_SO): $(MPY_OBJS)
# Build step for C++ source
$(BIN)/%.cpp.o:%.cpp
mkdir -p $(dir $@)
- $(CC) $(MPY_C_FLAGS) -c $< -o $@
+ $(CC) $(MPY_C_FLAGS) $(MPY_INC_FLAGS) -c $< -o $@
-include $(MPY_DEPS)
diff --git a/Markopy/Markopy.vcxproj b/Markopy/Markopy.vcxproj
index 866a6c59..230cb0fd 100644
--- a/Markopy/Markopy.vcxproj
+++ b/Markopy/Markopy.vcxproj
@@ -84,6 +84,7 @@
false
.pyd
+ $(SolutionDir)$(Platform)\intermediate\Markopy
@@ -140,7 +141,8 @@
true
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
- $(pythonLocation)\include;$(PYTHON_PATH)\include;$(BOOST_ROOT);$(SolutionDir)MarkovModel\src\;$(SolutionDir)\MarkovPasswords\src\;
+ $(SolutionDir);$(SolutionDir)\MarkovPasswords\src\;$(SolutionDir)MarkovModel\src\;$(pythonLocation)\include;$(PYTHON_PATH)\include;$(BOOST_ROOT);$(SolutionDir)MarkovModel\src\;$(SolutionDir)\MarkovPasswords\src\;
+ Default
Console
@@ -152,9 +154,6 @@
-
-
-
diff --git a/Markopy/Markopy.vcxproj.filters b/Markopy/Markopy.vcxproj.filters
index a7f1e7ac..5c063a6c 100644
--- a/Markopy/Markopy.vcxproj.filters
+++ b/Markopy/Markopy.vcxproj.filters
@@ -22,9 +22,6 @@
{9fe04840-08b7-4f78-8ae7-6513c3349fd5}
-
- {e1af0caf-1390-43cd-b7d4-57fe1d3ff9dd}
-
{ab5a1a08-ca20-48d3-9c82-4fd5e43bb20a}
@@ -33,15 +30,6 @@
Source Files\Module
-
- Dependencies\MarkovModel
-
-
- Dependencies\MarkovModel
-
-
- Dependencies\MarkovModel
-
Dependencies\MarkovPasswords
diff --git a/Markopy/src/Module/markopy.cpp b/Markopy/src/Module/markopy.cpp
index ed33e2aa..b4704f6e 100644
--- a/Markopy/src/Module/markopy.cpp
+++ b/Markopy/src/Module/markopy.cpp
@@ -7,9 +7,6 @@
using namespace boost::python;
-std::random_device rd;
-std::default_random_engine generator(rd());
-std::uniform_int_distribution distribution(0, 0xffffFFFF);
BOOST_PYTHON_MODULE(markopy)
{
diff --git a/MarkovModel/MarkovModel.vcxproj b/MarkovModel/MarkovModel.vcxproj
index 31c3df45..42186f68 100644
--- a/MarkovModel/MarkovModel.vcxproj
+++ b/MarkovModel/MarkovModel.vcxproj
@@ -112,7 +112,7 @@
false
$(SolutionDir)$(Platform)\Release\
- $(Platform)\Release\
+ $(SolutionDir)$(Platform)\intermediate\MarkovModel\
false
@@ -204,7 +204,7 @@
true
true
false
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);cudart.lib
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
$(IntDir)$(TargetName).device-link.obj
@@ -221,6 +221,7 @@
NotUsing
pch.h
%(AdditionalIncludeDirectories);$(SolutionDir)MarkovModel\src
+ Default
Windows
@@ -243,11 +244,7 @@
-
-
-
-
diff --git a/MarkovModel/MarkovModel.vcxproj.filters b/MarkovModel/MarkovModel.vcxproj.filters
index 0d54954f..212cb18f 100644
--- a/MarkovModel/MarkovModel.vcxproj.filters
+++ b/MarkovModel/MarkovModel.vcxproj.filters
@@ -38,17 +38,5 @@
Source Files
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Header Files
-
\ No newline at end of file
diff --git a/MarkovModel/src/MarkovModel.h b/MarkovModel/src/MarkovModel.h
deleted file mode 100644
index 0cb0b0af..00000000
--- a/MarkovModel/src/MarkovModel.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* @brief
-* Templates are instantiated during compile time,
-* so alternative to this approach is instantiating the classes/methods
-* with supported/allowed types to avoid a linker error
-*/
-
-#pragma once
-#include "model.cpp"
-#include "node.cpp"
-#include "edge.cpp"
-
-//fixed code smell
-
diff --git a/MarkovModel/src/dllmain.cpp b/MarkovModel/src/dllmain.cpp
index 89dd7648..64afc084 100644
--- a/MarkovModel/src/dllmain.cpp
+++ b/MarkovModel/src/dllmain.cpp
@@ -2,10 +2,6 @@
#include "model.h"
#include
-// dllmain.cpp : Defines the entry point for the DLL application.
-//std::random_device rd;
-//std::default_random_engine generator(rd());
-//std::uniform_int_distribution distribution(0, 0xffffFFFF);
#ifdef _WIN32
__declspec(dllexport) void dll_loadtest() {
diff --git a/MarkovModel/src/edge.cpp b/MarkovModel/src/edge.cpp
deleted file mode 100644
index 2b48d3f6..00000000
--- a/MarkovModel/src/edge.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "edge.h"
-#include
-
-//default constructor of edge
-template
-Markov::Edge::Edge() {
- this->_left = NULL;
- this->_right = NULL;
- this->_weight = 0;
-}
-//constructor of edge
-template
-Markov::Edge::Edge(Markov::Node* _left, Markov::Node* _right) {
- this->_left = _left;
- this->_right = _right;
- this->_weight = 0;
-}
-//to AdjustEdge the edges by the edge with its offset
-template
-void Markov::Edge::AdjustEdge(uint64_t offset) {
- this->_weight += offset;
- this->LeftNode()->UpdateTotalVerticeWeight(offset);
-}
-//to TraverseNode the node
-template
-Markov::Node* Markov::Edge::TraverseNode() {
- if (this->RightNode()->NodeValue() == 0xff) //terminator node
- return NULL;
- return _right;
-}
-//to set the LeftNode of the node
-template
-void Markov::Edge::SetLeftEdge(Markov::Node* n) {
- this->_left = n;
-}
-//to set the RightNode of the node
-template
-void Markov::Edge::SetRightEdge(Markov::Node* n) {
- this->_right = n;
-}
-//to get the EdgeWeight of the node
-template
-uint64_t Markov::Edge::EdgeWeight() {
- return this->_weight;
-}
-//to get the LeftNode of the node
-template
-Markov::Node* Markov::Edge::LeftNode() {
- return this->_left;
-}
-//to get the RightNode of the node
-template
-Markov::Node* Markov::Edge::RightNode() {
- return this->_right;
-}
-
-
diff --git a/MarkovModel/src/edge.h b/MarkovModel/src/edge.h
index e4f8e2a6..cbffa815 100644
--- a/MarkovModel/src/edge.h
+++ b/MarkovModel/src/edge.h
@@ -1,6 +1,6 @@
#pragma once
#include
-
+#include
namespace Markov {
@@ -69,3 +69,57 @@ namespace Markov {
};
+//default constructor of edge
+template
+Markov::Edge::Edge() {
+ this->_left = NULL;
+ this->_right = NULL;
+ this->_weight = 0;
+}
+//constructor of edge
+template
+Markov::Edge::Edge(Markov::Node* _left, Markov::Node* _right) {
+ this->_left = _left;
+ this->_right = _right;
+ this->_weight = 0;
+}
+//to AdjustEdge the edges by the edge with its offset
+template
+void Markov::Edge::AdjustEdge(uint64_t offset) {
+ this->_weight += offset;
+ this->LeftNode()->UpdateTotalVerticeWeight(offset);
+}
+//to TraverseNode the node
+template
+Markov::Node* Markov::Edge::TraverseNode() {
+ if (this->RightNode()->NodeValue() == 0xff) //terminator node
+ return NULL;
+ return _right;
+}
+//to set the LeftNode of the node
+template
+void Markov::Edge::SetLeftEdge(Markov::Node* n) {
+ this->_left = n;
+}
+//to set the RightNode of the node
+template
+void Markov::Edge::SetRightEdge(Markov::Node* n) {
+ this->_right = n;
+}
+//to get the EdgeWeight of the node
+template
+uint64_t Markov::Edge::EdgeWeight() {
+ return this->_weight;
+}
+//to get the LeftNode of the node
+template
+Markov::Node* Markov::Edge::LeftNode() {
+ return this->_left;
+}
+//to get the RightNode of the node
+template
+Markov::Node* Markov::Edge::RightNode() {
+ return this->_right;
+}
+
+
diff --git a/MarkovModel/src/model.cpp b/MarkovModel/src/model.cpp
deleted file mode 100644
index c08c2c1b..00000000
--- a/MarkovModel/src/model.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-#pragma once
-#include "model.h"
-#include "node.h"
-#include
-#include
-#include
-#include
-
-template
-Markov::Model::Model() {
- this->starterNode = new Markov::Node(0);
- this->nodes.insert({ 0, this->starterNode });
-
- std::random_device rd;
- generator = new std::default_random_engine(rd());
- distribution = std::uniform_int_distribution(0, 0xffffFFFF);
-}
-
-template
-bool Markov::Model::Import(std::ifstream *f) {
- std::string cell;
-
- char src;
- char target;
- int oc;
-
- while (std::getline(*f, cell) ) {
- //std::cout << "cell: " << cell << std::endl;
- src = cell[0];
- target = cell[cell.length()-1];
- oc = std::atoi(cell.substr(2, cell.length() - 2).c_str());
-
-
- Markov::Node* srcN;
- Markov::Node* targetN;
- Markov::Edge* e;
- if (this->nodes.find(src) == this->nodes.end()) {
- srcN = new Markov::Node(src);
- this->nodes.insert(std::pair*>(src, srcN));
- //std::cout << "Creating new node at start.\n";
- }else {
- srcN = this->nodes.find(src)->second;
- }
-
- if (this->nodes.find(target) == this->nodes.end()) {
- targetN = new Markov::Node(target);
- this->nodes.insert(std::pair*>(target, targetN));
- //std::cout << "Creating new node at end.\n";
- }
- else {
- targetN = this->nodes.find(target)->second;
- }
- e = srcN->Link(targetN);
- e->AdjustEdge(oc);
- this->edges.push_back(e);
-
- //std::cout << int(srcN->NodeValue()) << " --" << e->EdgeWeight() << "--> " << int(targetN->NodeValue()) << "\n";
-
-
- }
-
- //std::cout << "Total number of nodes: " << this->nodes.size() << std::endl;
- //std::cout << "Total number of edges: " << this->edges.size() << std::endl;
-
- return true;
-}
-
-template
-bool Markov::Model::Import(const char* filename) {
- std::ifstream importfile;
- importfile.open(filename);
- return this->Import(&importfile);
-
-}
-
-template
-bool Markov::Model::Export(std::ofstream* f) {
- Markov::Edge* e;
- for (std::vector::size_type i = 0; i != this->edges.size(); i++) {
- e = this->edges[i];
- //std::cout << e->LeftNode()->NodeValue() << "," << e->EdgeWeight() << "," << e->RightNode()->NodeValue() << "\n";
- *f << e->LeftNode()->NodeValue() << "," << e->EdgeWeight() << "," << e->RightNode()->NodeValue() << "\n";
- }
-
- return true;
-}
-
-template
-bool Markov::Model::Export(const char* filename) {
- std::ofstream exportfile;
- exportfile.open(filename);
- return this->Export(&exportfile);
-}
-
-template
-NodeStorageType* Markov::Model::RandomWalk(int minSetting, int maxSetting) {
- Markov::Node* n = this->starterNode;
- int len = 0;
- NodeStorageType *ret = new NodeStorageType[64];
- Markov::Node *temp_node;
- while (n != NULL) {
- //n = n->RandomNext();
- temp_node = n->RandomNext();
- //dirty cutoff, needs better solution
- if (len == 60)
- break;
- if (len > maxSetting) {
- //std::cout<<"MAX ->"<< "node*: " << temp_node << ", len: " << len << "\n";
- break;
- }
-
- if ((temp_node == NULL) && (len < minSetting)) {
- //std::cout << "node*: " << temp_node << ", len: " << len << "\n";
- continue;
- }
-
- if (temp_node == NULL)
- break;
- n = temp_node;
-
- //std::cout << n->NodeValue();
- ret[len++] = n->NodeValue();
-
- //maximum character length exceeded and stack will overflow.
- //assert(len<32 && "return buffer overflowing, this will segfault if not aborted.");
- }
-
- //null terminate the string
- ret[len] = 0x00;
-
- //do something with the generated string
- return ret; //for now
-}
-
-template
-void Markov::Model::AdjustEdge(const NodeStorageType* payload, long int occurrence) {
- NodeStorageType p = payload[0];
- Markov::Node* curnode = this->starterNode;
- Markov::Edge *e;
- int i = 0;
-
- if(p == 0) return;
- while (p != 0) {
- e = curnode->FindEdge(p);
- if(e==NULL) return;
- e->AdjustEdge(occurrence);
- curnode = e->RightNode();
- p = payload[++i];
- }
-
- e = curnode->FindEdge('\xff');
- e->AdjustEdge(occurrence);
- return;
-}
-
diff --git a/MarkovModel/src/model.h b/MarkovModel/src/model.h
index 1e4be6ca..7732a939 100644
--- a/MarkovModel/src/model.h
+++ b/MarkovModel/src/model.h
@@ -7,12 +7,10 @@
#include
+
+
+ Default
+ $(Qt_INCLUDEPATH_);%(AdditionalIncludeDirectories);$(SolutionDir)MarkovModel/src/;$(SolutionDir)MarkovPasswords/src/;$(SolutionDir);
+
+
+
+
+ stdcpp17
+
+
core;gui;widgets;webenginewidgets;
debug
diff --git a/MarkovPasswordsGUI/MarkovPasswordsGUI.vcxproj.filters b/MarkovPasswordsGUI/MarkovPasswordsGUI.vcxproj.filters
index 1bbae0d0..ccdb887d 100644
--- a/MarkovPasswordsGUI/MarkovPasswordsGUI.vcxproj.filters
+++ b/MarkovPasswordsGUI/MarkovPasswordsGUI.vcxproj.filters
@@ -25,6 +25,9 @@
{3c3f933a-cec8-4731-b7a0-77b5b4b2e1cb}
+
+ {a16bc5c3-bf52-491c-ab24-3439caad494e}
+
@@ -71,7 +74,7 @@
Source Files
- Source Files
+ Source Files\dependencies
diff --git a/MarkovPasswordsGUI/Train.cpp b/MarkovPasswordsGUI/Train.cpp
index 7e582812..300885fe 100644
--- a/MarkovPasswordsGUI/Train.cpp
+++ b/MarkovPasswordsGUI/Train.cpp
@@ -6,14 +6,10 @@
#include
#include
#include "src/CLI.h"
-#include "../MarkovPasswords/src/markovPasswords.h"
+#include "MarkovPasswords/src/markovPasswords.h"
#include
-std::random_device rd;
-std::default_random_engine generator(rd());
-std::uniform_int_distribution distribution(0, 0xffffFFFF);
-
Train::Train(QWidget* parent)
: QMainWindow(parent)
{
diff --git a/UnitTests/UnitTests.cpp b/UnitTests/UnitTests.cpp
index d1d7b0c1..f6e6bbcc 100644
--- a/UnitTests/UnitTests.cpp
+++ b/UnitTests/UnitTests.cpp
@@ -6,10 +6,6 @@
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
-std::random_device rd;
-std::default_random_engine generator(rd());
-std::uniform_int_distribution distribution(0, 0xffffFFFF);
-
/** @brief Namespace for Microsoft Native Unit Testing Classes
*/
namespace Testing {