Compare commits

...

29 Commits
0.1 ... master

Author SHA1 Message Date
Greg Gauthier 7a582b216e add build instructions to the readme
CMake / build (push) Successful in 28s Details
2024-02-23 20:31:03 +00:00
Greg Gauthier fe2e42a3f2 remove exposing echo
CMake / build (push) Successful in 28s Details
2024-02-22 14:56:17 +00:00
Greg Gauthier ca206f231d attempt to use LOCIP var
CMake / build (push) Successful in 28s Details
2024-02-22 14:49:27 +00:00
Greg Gauthier 2a781498e7 force etc/hosts for local server
CMake / build (push) Successful in 27s Details
2024-02-22 14:14:34 +00:00
Greg Gauthier d69279aafd change image name to node16-bullseye to better match what it is
CMake / build (push) Successful in 28s Details
2024-02-22 13:57:49 +00:00
Greg Gauthier 8063e2cd65 Update README.md
CMake / build (push) Successful in 26s Details
2024-02-22 13:35:37 +00:00
Greg Gauthier 541f0aff03 Update .gitea/workflows/cmake.yml
CMake / build (push) Successful in 26s Details
2024-02-22 13:29:10 +00:00
Greg Gauthier 3ff06feb2e Update .gitea/workflows/cmake.yml
CMake / build (push) Failing after 21s Details
2024-02-22 13:27:25 +00:00
Greg Gauthier 255b18e2c5 Update .gitea/workflows/cmake.yml
CMake / build (push) Successful in 26s Details
2024-02-20 18:22:25 +00:00
Greg Gauthier 8cbfd64f2d fixed yaml error 2024-02-20 18:21:36 +00:00
Greg Gauthier 1d890a4593 trying again, but with one runner 2024-02-20 18:19:45 +00:00
Greg Gauthier 51e761df38 make sure build still works
CMake / build (push) Failing after 1s Details
2024-02-20 18:06:35 +00:00
Greg Gauthier 4784a9c5c5 one more time with ubuntu-latest
CMake / build (push) Successful in 30s Details
2024-02-20 17:44:35 +00:00
Greg Gauthier ec66f74d7d modified build steps
CMake / build (push) Has been cancelled Details
2024-02-20 17:31:27 +00:00
Greg Gauthier 24ee2009b0 modified docker image
CMake / build (push) Has been cancelled Details
2024-02-20 17:21:22 +00:00
Greg Gauthier e1def09764 try a different docker image
CMake / build (push) Has been cancelled Details
2024-02-20 17:15:45 +00:00
Greg Gauthier 6027c4f1ba change workflow runson
CMake / build (push) Failing after 8s Details
2024-02-15 22:13:13 +00:00
Greg Gauthier 36ed1f9ebc drive a runner action
CMake / build (push) Failing after 4s Details
2024-02-15 22:11:33 +00:00
Greg Gauthier 2d2f392c1e drive a runner action
CMake / build (push) Failing after 11s Details
2024-02-15 21:54:52 +00:00
Greg Gauthier 9ede962190 remove circleci workflow; convert github workflow into gitea workflow 2024-02-15 21:52:54 +00:00
Greg Gauthier 1921f3434d remove circleci workflow; convert github workflow into gitea workflow 2024-02-15 21:52:41 +00:00
Greg Gauthier f23bd5fe14 remove product bins 2020-11-07 10:11:53 +00:00
Greg Gauthier 2b86b0bf51
Merge pull request #1 from gmgauthier/circleci-project-setup
Circleci project setup
2020-11-07 10:00:13 +00:00
Greg Gauthier 9176175019 Add .circleci/config.yml 2020-11-07 09:58:20 +00:00
Greg Gauthier bde4be616f rename source file; fix argument parsing; 2020-11-07 09:52:46 +00:00
Greg Gauthier f32c89452d Add .circleci/config.yml 2020-10-22 13:52:45 +01:00
Greg Gauthier 8a342387f6 add readme 2020-10-22 13:48:54 +01:00
Greg Gauthier 1e5b75eab6 Add .circleci/config.yml 2020-10-22 13:45:52 +01:00
Greg Gauthier a2eaef3df1 add compiled binaries for various environments 2020-10-22 13:28:47 +01:00
4 changed files with 54 additions and 12 deletions

View File

@ -12,11 +12,19 @@ jobs:
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
runs-on: node16-bullseye
steps:
- name: Prep For Local Builds
run: echo "${LOCIP} gitea.comnenos" >> /etc/hosts
- uses: actions/checkout@v2
- name: Install Build Tools
run: apt-get update && apt-get -y --no-install-recommends install build-essential clang cmake gdb git wget && echo "********* INSTALLS COMPLETED *****************************************************************"
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands

View File

@ -3,4 +3,4 @@ project(passwdgen)
set(CMAKE_CXX_STANDARD 20)
add_executable(passwdgen main.cpp)
add_executable(passwdgen passwdgen.cpp)

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# passwdgen
### a rudimentary random string password generator
For demo purposes only
## Build
**Bare Bones**
```bash
mkdir build
g++ -o build/passwdgen ./passwdgen.cpp
```
**From CMAKE**
```bash
mkdir build
cd build
cmake ..
make
```
Then, just copy the compiled binary to somewhere on your $PATH

View File

@ -1,6 +1,12 @@
//
// passwdgen.cpp
// Created by Greg Gauthier on 2020.10.22.
//
#include <iostream>
#include <random>
std::string random_string(std::size_t length, bool punc) {
std::string CHARACTERS;
std::string ALPHANUM = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@ -13,7 +19,7 @@ std::string random_string(std::size_t length, bool punc) {
}
std::random_device random_device;
std::mt19937 generator(random_device());
std::uniform_int_distribution<> distribution(0, CHARACTERS.size() - 1);
std::uniform_int_distribution<> distribution(0.0, CHARACTERS.size() - 1.0);
std::string random_string;
for (std::size_t i = 0; i < length; ++i) {
@ -25,15 +31,15 @@ std::string random_string(std::size_t length, bool punc) {
void show_usage(std::string binname) {
std::cerr << "Usage: " << binname << " [OPTIONS] " << std::endl
<< "Options:" << std::endl
<< "\t-h, --help \t\tShow this help message" << std::endl
<< "\t-l, --length \t\tThe length of the password (default: 32)" << std::endl
<< "\t-h, --help \t\tShow this help message" << std::endl
<< "\t-l, --length [n] \t\tThe length of the password (default: 32)" << std::endl
<< "\t-p, --punctuation \t\tToggle special characters (default: false)"
<< std::endl;
}
int main(int argc, char *argv[]) {
std::string passlenstr;
int passlen;
int passlen = 0;
bool punc = false;
if (argc < 1) {
@ -48,18 +54,24 @@ int main(int argc, char *argv[]) {
} else if (arg == "-p") {
punc = true;
} else if ((arg == "-l") || (arg == "--length")) {
passlenstr = argv[i + 1];
if (passlenstr.empty()) {
std::cerr << "--destination option requires one argument." << std::endl;
if (not argv[i +1]) {
std::cerr << "Specify a password length" << std::endl;
return 1;
} else {
passlenstr = argv[i + 1];
try {
passlen = std::stoi(passlenstr);
} catch (const std::invalid_argument& e){
std::cerr << "Length must be a valid integer" << std::endl;
return 1;
}
}
}
}
if (passlenstr.empty()) {
passlenstr = "32";
if (passlen == 0) {
passlen = 32;
}
passlen = std::stoi(passlenstr);
std::string password = random_string(passlen, punc);
std::cout << password << std::endl;
return 0;