Compile to .exe
This commit is contained in:
parent
7704d049ab
commit
1d19ad496f
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
*.o
|
*.o
|
||||||
|
*.exe
|
||||||
passgen
|
passgen
|
||||||
.cache/
|
.cache/
|
||||||
|
27
Makefile
27
Makefile
@ -1,13 +1,34 @@
|
|||||||
TARGETS = passgen
|
TARGETS = passgen
|
||||||
|
BINARYOUT_TARGETS = passgen.o
|
||||||
|
|
||||||
CPPFLAGS += -I./include
|
CPPFLAGS += -I./include
|
||||||
CXXFLAGS += -std=c++20 -O2
|
CXXFLAGS += -std=c++20 -O2
|
||||||
CC = $(CXX) # Cheat so that linking uses the C++ compiler
|
|
||||||
|
|
||||||
all: $(TARGETS)
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
CC = x86_64-w64-mingw32-g++
|
||||||
|
LD = x86_64-w64-mingw32-g++
|
||||||
|
EXE_EXT = .exe
|
||||||
|
else
|
||||||
|
CC = g++
|
||||||
|
LD = g++
|
||||||
|
EXE_EXT =
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: $(TARGETS)$(EXE_EXT)
|
||||||
|
|
||||||
|
run:
|
||||||
|
./passgen$(EXE_EXT)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(TARGETS) $(BINARYOUT_TARGETS)
|
rm -f *.o *.exe $(TARGETS) $(BINARYOUT_TARGETS)
|
||||||
|
|
||||||
|
passgen.exe: passgen.o
|
||||||
|
$(LD) -static-libgcc -static-libstdc++ passgen.o -o passgen.exe
|
||||||
|
|
||||||
|
passgen: passgen.o
|
||||||
|
$(LD) passgen.o -o passgen
|
||||||
|
|
||||||
passgen.o: passgen.cpp ./include/pcg_random.hpp \
|
passgen.o: passgen.cpp ./include/pcg_random.hpp \
|
||||||
./include/pcg_extras.hpp ./include/pcg_uint128.hpp
|
./include/pcg_extras.hpp ./include/pcg_uint128.hpp
|
||||||
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) -c -o passgen.o passgen.cpp
|
||||||
|
23
passgen.cpp
23
passgen.cpp
@ -1,6 +1,7 @@
|
|||||||
#include <format>
|
#include <format>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <random>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -25,13 +26,16 @@ std::vector<std::string> readWordlist(std::string filePath)
|
|||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
std::string path;
|
std::string path;
|
||||||
|
int count;
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 3) {
|
||||||
path = argv[1];
|
path = argv[1];
|
||||||
|
count = atoi(argv[2]);
|
||||||
} else if (argc == 1) {
|
} else if (argc == 1) {
|
||||||
path = "eff_large_wordlist.txt";
|
path = "eff_large_wordlist.txt";
|
||||||
|
count = 5;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "usage: passgen <wordlist_path>\n";
|
std::cout << "usage: passgen <wordlist_path> <wordcount>\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,5 +45,18 @@ int main(int argc, char *argv[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << wordlist[0] << "\n";
|
for (int i = 0; i < count; i++) {
|
||||||
|
pcg_extras::seed_seq_from<std::random_device> seed_source;
|
||||||
|
pcg32 rng(seed_source);
|
||||||
|
|
||||||
|
int random_int = std::uniform_int_distribution<int>(0, wordlist.size())(rng);
|
||||||
|
|
||||||
|
std::cout << wordlist[random_int];
|
||||||
|
|
||||||
|
if (i+1 == count) {
|
||||||
|
std::cout << "\n";
|
||||||
|
} else {
|
||||||
|
std::cout << "-";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user