Narthex

Modular dictionary generator
git clone git://mcdim.xyz/Narthex.git
Log | Files | Refs | README | LICENSE

commit 38ea128712da6fd102284318094b79df86c6efde
parent 8b787462feef20174205e3a63da1e8ae34e982c1
Author: Michael Constantine Dimopoulos <mk@mcdim.xyz>
Date:   Thu, 28 Dec 2023 20:29:28 +0200

Added ngen

Diffstat:
MMakefile | 6+++++-
MREADME.md | 5+++--
AREADME.txt | 97+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Agen/ngen.1 | 42++++++++++++++++++++++++++++++++++++++++++
Agen/ngen.c | 137+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mrev/nrev.1 | 2+-
Mrev/nrev.sh | 4++--
7 files changed, 287 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile @@ -17,12 +17,14 @@ install: inc/nin.c enhance/nhan.c leet/nleet.c com/ncom.c clean/nclean.c app/nap $(CC) com/ncom.c -o ncom $(CC) clean/nclean.c -o nclean $(CC) app/napp.c -o napp + $(CC) gen/ngen.c -o ngen sudo mv nhance /bin sudo mv ninc /bin sudo mv nleet /bin sudo mv ncom /bin sudo mv nclean /bin sudo mv napp /bin + sudo mv ngen /bin sudo cp rev/nrev.sh /bin/nrev sudo cp wiz/nwiz.sh /bin/nwiz mkdir -p /var/lib/narthex/ @@ -34,9 +36,10 @@ install: inc/nin.c enhance/nhan.c leet/nleet.c com/ncom.c clean/nclean.c app/nap sudo cp clean/nclean.1 $(MD) sudo cp app/napp.1 $(MD) sudo cp rev/nrev.1 $(MD) + sudo cp gen/ngen.1 $(MD) sudo mandb -uninstall: /bin/ninc /bin/nhance /bin/nrev /bin/nleet /bin/ncom /bin/nclean /bin/napp /bin/nwiz $(MD)ninc.1 $(MD)nhance.1 $(MD)nrev.1 $(MD)nleet.1 $(MD)ncom.1 $(MD)nclean.1 $(MD)napp.1 +uninstall: /bin/ninc /bin/nhance /bin/nrev /bin/nleet /bin/ncom /bin/nclean /bin/napp /bin/nwiz /bin/ngen $(MD)ninc.1 $(MD)nhance.1 $(MD)nrev.1 $(MD)nleet.1 $(MD)ncom.1 $(MD)nclean.1 $(MD)napp.1 $(MD)ngen.1 rm /bin/ninc $(MD)ninc.1 rm /bin/nhance $(MD)nhance.1 rm /bin/nleet $(MD)nleet.1 @@ -44,5 +47,6 @@ uninstall: /bin/ninc /bin/nhance /bin/nrev /bin/nleet /bin/ncom /bin/nclean /bin rm /bin/ncom $(MD)ncom.1 rm /bin/nclean $(MD)nclean.1 rm /bin/napp $(MD)napp.1 + rm /bin/ngen $(MD)ngen.1 rm /bin/nwiz rm -r /var/lib/narthex/ diff --git a/README.md b/README.md @@ -2,10 +2,10 @@ <img src="https://mcdim.xyz/projects/n/narthexblack.png" alt="Narthex logo" style="height: 150px; width:150px;"/> <p float="left"> -<img src="https://img.shields.io/badge/version-1.2-blue"/> +<img src="https://img.shields.io/badge/version-1.2.1-blue"/> <img src="https://img.shields.io/badge/language-C-lightgrey"/> <img src="https://img.shields.io/badge/lines%20of%20code-1k-lightgreen"/> -<img src="https://img.shields.io/badge/tools-8-green"/> +<img src="https://img.shields.io/badge/tools-9-green"/> <img src="https://img.shields.io/badge/dependencies-0-green"/> <img src="https://img.shields.io/badge/license-GNU%20GPLv3+-yellow"/> <a href="https://inventory.raw.pm/tools.html#Narthex"/><img src="https://inventory.raw.pm/img/badges/Rawsec-inventoried-FF5050_flat.svg"/></a> @@ -27,6 +27,7 @@ https://www.youtube.com/watch?v=U0UmCeLJSkk&t=938s + *nleet* - A leetifier. Replaces characters with Leet equivalents, such as @ instead of a, or 3 instead of e. + *nclean* - A tool for removing passwords that don't meet your criteria (too short, no special characters etc.) + *napp* - A tool that appends characters or words before or after the lines of the dictionary. ++ *ngen* - A tool that generates permutations of given length & character set (works, but is under development). + *nwiz* - A wizard that asks for the infromation and combines the tools together to create a final dictionary. ## Screenshots diff --git a/README.txt b/README.txt @@ -0,0 +1,97 @@ + _ ,,__ _ + ;=# @#####=##@. + '"":##="=###.# " + .=###,-'#####- + ,:###=###;=" -=####. + (:#.#####"##;:'.#####"##) + /#=-###;"#'"####,####; + " \ \ ##=" " + ":-. ##_ + '##= + .##:. +_ _ _ ___ ___ _ _ ___ _ _ +|\| |_| |_/ | |_| |_ \/ +| | | | | \ | | | |__ /\ + __________________________________________________________________________________________________ +| version 1.2.1 | language C | lines of code 1k | binaries 9 | dependencies 0 | license GNU GPLv3+ | + +Narthex (Greek: Νάρθηξ, νάρθηκας) is a modular & minimal dictionary generator for Unix and Unix-like operating +system written in C and Shell. It contains autonomous Unix-style programs for the creation of personalised +dictionaries that can be used for password recovery & security assessment. The programs make use of Unix text +streams for the collaboration with each other, according to the Unix philosophy. +It is licensed under the GPL v3.0. + +I made a video to explain the usage of Narthex: +https://www.youtube.com/watch?v=U0UmCeLJSkk&t=938s (the timestamp is intentional) + +The tools +========= +nchance - A capitalization tool that appends the results to the bottom of the dictionary. +ninc - A incrementation tool that multiplies alphabetical lines and appends an n++ at the end of each line. +ncom - A combination tool that creates different combinations between the existing lines of the dictionary. +nrev - A reversing tool, that appends the reserved versions of the lines at the end of the dictionary. +nleet - A leetifier. Replaces characters with Leet equivalents, such as @ instead of a, or 3 instead of e. +nclean - A tool for removing passwords that don't meet your criteria (too short, no special characters etc.) +napp - A tool that appends characters or words before or after the lines of the dictionary. +ngen - A tool that generates permutations of given length & character set (works, but is under development). +nwiz - A wizard that asks for the infromation and combines the tools together to create a final dictionary. + +Screenshots +=========== +https://mcdim.xyz/projects/n/screens/narthex2.png +https://mcdim.xyz/projects/n/screens/narthex1.png + +Dependencies +============ +Narthex has no hard dependencies, however there are two building dependencies, `GCC` and `Make`, which are both +required in order to easily compile and install the binaries, but not to run them. + +Install +======= +In order to install, execute the following commands: + + $ git clone https://github.com/MichaelDim02/Narthex.git && cd Narthex + $ sudo make install + +Usage +===== +For easy use, there is a wizard program, nwiz, that you can use. Just run + + $ nwiz + +And it will ask you for the target's information & generate the dictionary for you. + +Advanced usage +============== +If you want to make full use of Narthex, you can read the manpages of each tool. What they all do, really, is +enhance small dictionaries. They are really minimal, and use Unix text streams to read and output data. For +example, save a couple keywords into a textfile ```words.txt``` in a different line each, and run the following + + $ cat words.txt | nhance -f | ncom | nleet a:@ | ninc 1 30 > dictionary.txt + +and you'll see the results for yourself. Alterantively, you can try this for a larger and more complicated dictionary: + + $ cat words.txt | nhance -f | ncom -d .- | ninc 1 200 -d .- | nrev | nleet | napp -c '@#$' > dict1.txt + +The above, with just 4 keywords in words.txt (one of which was numerical), generated a wordlist of 2279744 passwords +(38MB). + +As demonstrated, much like Unix utilities, the tools of Narthex can be thought of as building blocks, where the user +has all the power to connect them in different possible ways to generate the desired list of passwords. + +Donate +====== +https://www.paypal.com/donate/?hosted_button_id=HZXXLD586P5CW + +More donation options on mcdim.xyz + +Links +===== +Website: https://mcdim.xyz/projects/n +Github: https://github.com/MichaelDim02/Narthex +Raw.pm: https://inventory.raw.pm/tools.html#Narthex +BlackArch: https://blackarch.org/tools.html + +_ _ _ ___ _ _ _ ___ +|\| |_| |_/ |.| |_| _ +| | | | | |_| | | ___ diff --git a/gen/ngen.1 b/gen/ngen.1 @@ -0,0 +1,42 @@ +.\" Manpage for ngen + +.TH man 8 "28 Dec 2023" "1.0" "ngen manual page" +.SH NAME +napp \- Narthex appender +.SH SYNOPSIS +ngen [MIN] [MAX] [CHARS] +MAX must be greater than or equal to MIN +.SH DESCRIPTION +ngen generates permutations of given length & character set. As ngen works recursively, you may have to run + +ulimit -s unlimited + +to set the stack size to unlimited. + +.SH OPTIONS + +-v print version and exit + +-h print help panel and exit + +.SH EXAMPLES + +This will generate all permutations of 'a', 'b', 'c', and 'd' of length 3, 4 & 5 and store them in the file output.txt + +ngen 3 5 abcd > output.txt + +The following will generate all permutatitions of '1', '2', '!' and '*' of length 5 and output them to standard output + +ngen 5 5 12\!\* + +The following will generate all permutatitions of '1', '2', and '3' of length 5, 6, 7, 8 and 9 and store them in output.txt + +ngen 5 9 122331 + +.SH AUTHOR +Michael Constantine Dimopoulos <mk@mcdim.xyz> + +https://mcdim.xyz + +.SH LICENSE +GNU General Public License 3.0 (GPL-3.0) diff --git a/gen/ngen.c b/gen/ngen.c @@ -0,0 +1,137 @@ +/* + * ngen - Narthex generator + * + * By Michael Constantine Dimopoulos https://mcdim.xyz <mk@mcdim.xyz> + * License: GNU GPL v3 + * + * ninc will iterate over stdin and after printing the dictionary as is + * it will reprint it but will also multiply each line with the + * difference of max-min, and will append n to each line, where n is + * increased after every line from min to max inclusive. (I know, I know. + * Just try to use it and it will make more sense). + * + * * * * * * * * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define VERSION "v1.0" + +static void +help(char *exename) +{ + printf( "ngen - Narthex generator %s\n" + "By Michael Constantine Dimopoulos <mk@mcdim.xyz>\n\n" + + "-h print this panel & exit\n" + "-v print current version & exit\n\n" + + "Usage: %s [MIN] [MAX] [CHARSET]\n" + "MAX must be greater than or equal to MIN\n", + VERSION, exename); + exit(EXIT_SUCCESS); +} + +static inline void +die(char *str) +{ + printf("%s\n", str); + exit(EXIT_SUCCESS); +} + +int rec(char *chars, int l, int *c, int len, int exit) +{ + if (exit == 1) return 1; + + for (int i=0; i<=len-1; i++) { + printf("%c", chars[c[i]]); + } + printf("\n"); + + for (int i=len-1; i>=0; i--) { + if (c[i] < l) { + c[i]++; + exit = rec(chars, l, c, len, exit); + } else { + if (i == 0) { + return 1; + } + c[i] = 0; + } + } +} + +int main(int argc, char **argv) +{ + if (argc != 2 && argc != 4) { + help(argv[0]); + } + + if (strcmp(argv[1], "-h") == 0) { + help(argv[0]); + } + + if (strcmp(argv[1], "-v") == 0) { + printf("%s\n", VERSION); + exit(EXIT_SUCCESS); + } + + if (argc != 4) { + help(argv[0]); + } + + int min = atoi(argv[1]); + int max = atoi(argv[2]); + + if (min > max) die("MAX must be greater than or equal to MIN"); + + /* get unique */ + int len = strlen(argv[3]); + int size = 1; + char *uniq = (char *)malloc(size * sizeof(char)); + uniq[0] = '\0'; + + for (int i=0; i<len; i++) { + int found = 0; + for (int j=0; j<strlen(uniq); j++) { + if (argv[3][i] == uniq[j]) { + found = 1; + } + } + + if (found == 0) { + size++; + uniq = (char *)realloc(uniq, size * sizeof(char)); + uniq[size-2] = argv[3][i]; + uniq[size-1] = '\0'; + } + } + /* ********** */ + + for (int l=min; l<=max; l++) { + int s = strlen(uniq)-1; + int c[l]; + for (int i=0; i<l; i++) { + c[i] = 0; + } + + rec(uniq, s, c, l, 0); + } + return 0; +} diff --git a/rev/nrev.1 b/rev/nrev.1 @@ -1,6 +1,6 @@ .\" Manpage for nrev -.TH man 8 "15 Jul 2021" "1.2" "nrev manual page" +.TH man 8 "15 Jul 2021" "1.2.1" "nrev manual page" .SH NAME nrev \- Narthex reverser .SH SYNOPSIS diff --git a/rev/nrev.sh b/rev/nrev.sh @@ -23,9 +23,9 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. -version="1.2" +version="1.2.1" -if [ "$1" = "-v" ]; then echo $version; exit; +if [ "$1" = "-v" ]; then echo v$version; exit; elif [ "$1" = "-h" ]; then printf "nrev - Narthex reverser ${version} \n";