Skip to content

Commit

Permalink
pswdgn all commit
Browse files Browse the repository at this point in the history
  • Loading branch information
belajarqywok committed Dec 31, 2022
0 parents commit 7ce0476
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 RQ-21-Engineer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
build :

mkdir bin
g++ pswdgn.cpp -o pswdgn
mv pswdgn.exe ./bin

run :

C:\Users\kiwog\Documents\projects\"hacking projects"\pswdgn\bin\pswdgn.exe -l 256 --all > password.txt











33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# pswdgn

**_pswdgn_** is a tool for generate password, public / private key, and other credentials.

<hr>

# USAGE

## Installation

```
using g++ :
$ g++ pswdgn.cpp -o pswdgn
using gcc :
$ gcc pswdgn.cpp -o pswdgn -lstdc++
using clang :
$ clang pswdgn.cpp -o pswdgn -lstdc++
using clang++ :
$ clang++ pswdgn.cpp -o pswdgn
```

## how to use

```
docs :
pswdgn [ -L | --length ] [NUMBER] [ -ON | --only-number ]
example :
$ pswdgn -l 256 --all > password.txt
```
Binary file added bin/pswdgn.exe
Binary file not shown.
47 changes: 47 additions & 0 deletions example/expectsh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

pswdgn -l 256 --all > password.txt

# read https://www.howtogeek.com/devops/automate-inputs-to-linux-scripts-with-the-expect-command/
cat << 'EOF' > expectsh.exp
#!/usr/bin/expect -f
set timeout -1
spawn ./register
expect "new username : r"
send -- "rootr"
expect "new password : r"
send -- "$(cat password.txt)"
expect eof
EOF

: '
Which user?
u user/owner
g group
o other
a all
What to do?
+ add this permission
- remove this permission
= set exactly this permission
Which permissions?
r read
w write
x execute
'
chmod ugo+x expectsh.exp


./expectsh.exp







19 changes: 19 additions & 0 deletions example/freepascal.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
program powerWIN;

uses SysUtils, Process;

begin
ExecuteProcess('cmd','/c pswdgn -l 256 --all > password.txt');
end.












59 changes: 59 additions & 0 deletions include/generator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>



class Generator {

public :
void key (int lengthKey, bool numberOnlyOption) {

std::string result = "";

std::string numberCharacters = "1234567890";
std::string lowerCharacters = "abcdefghijklmnopqrstuvwxyz";
std::string upperCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string allCharacters = (

lowerCharacters +
numberCharacters +
upperCharacters
);

srand (
time(0)
);

if ( numberOnlyOption ) {

for (int i = 0; i < lengthKey; i ++) {

result += numberCharacters [

rand() % numberCharacters.length()
];

}

} else {

for ( int i = 0; i < lengthKey; i ++) {

result += allCharacters [

rand() % allCharacters.length()
];

}
}

std::cout << result << std::endl;
}

};



39 changes: 39 additions & 0 deletions pswdgn.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "include/generator.h"


int main (int argc, char** argv) {

Generator gen;

if( (strcmp(argv[1], "-l") == 0) || (strcmp(argv[1], "--length") == 0) ) {


if( (strcmp(argv[3], "-on") == 0) || (strcmp(argv[3], "--only-number") == 0) ) {

gen.key(

std::atoi(argv[2]), true
);


}else if( (strcmp(argv[3], "-a") == 0) || (strcmp(argv[3], "--all") == 0) ){

gen.key(

std::atoi(argv[2]), false
);

}


} else {

std::cout << "pswdgn [ -L | --length ] [NUMBER] [ -ON | --only-number ]" << std::endl;
}


return 0;

}


0 comments on commit 7ce0476

Please sign in to comment.