46 lines
825 B
C++
46 lines
825 B
C++
#include <format>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "pcg_random.hpp"
|
|
|
|
std::vector<std::string> readWordlist(std::string filePath)
|
|
{
|
|
std::vector<std::string> map;
|
|
|
|
std::ifstream file(filePath);
|
|
if (file.is_open()) {
|
|
std::string line;
|
|
while (std::getline(file, line)) {
|
|
map.push_back(line);
|
|
}
|
|
} else {
|
|
std::cout << std::format("ERROR: failed op open '{}'\n", filePath);
|
|
}
|
|
|
|
return map;
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
std::string path;
|
|
|
|
if (argc == 2) {
|
|
path = argv[1];
|
|
} else if (argc == 1) {
|
|
path = "eff_large_wordlist.txt";
|
|
} else {
|
|
std::cout << "usage: passgen <wordlist_path>\n";
|
|
return 1;
|
|
}
|
|
|
|
std::vector<std::string> wordlist = readWordlist(path);
|
|
|
|
if (wordlist.size() == 0) {
|
|
return 1;
|
|
}
|
|
|
|
std::cout << wordlist[0] << "\n";
|
|
}
|