Skip to content

Commit

Permalink
Updated everything
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDim02 committed Jul 26, 2021
1 parent 1169968 commit 2520e61
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 38 deletions.
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,37 @@

CC=gcc

#all: inc/nin.c enhance/nhan.c leet/nleet.c rev/nrev.sh
#all: inc/nin.c enhance/nhan.c leet/nleet.c com/ncom.c rev/nrev.sh
# $(CC) enhance/nhan.c -o nhance
# $(CC) inc/nin.c -o ninc
# $(CC) leet/nleet.c -o nleet
# $(CC) com/ncom.c -o ncom

install: inc/nin.c enhance/nhan.c leet/nleet.c rev/nrev.sh wiz/nwiz.sh inc/ninc.1 enhance/nhance.1 rev/nrev.1 leet/nleet.1
install: inc/nin.c enhance/nhan.c leet/nleet.c com/ncom.c rev/nrev.sh wiz/nwiz.sh inc/ninc.1 enhance/nhance.1 rev/nrev.1 leet/nleet.1 com/ncom.1
$(CC) enhance/nhan.c -o nhance
$(CC) inc/nin.c -o ninc
$(CC) leet/nleet.c -o nleet
$(CC) com/ncom.c -o ncom
sudo mv nhance /bin
sudo mv ninc /bin
sudo mv nleet /bin
sudo mv rev/nrev.sh /bin/nrev
sudo mv wiz/nwiz.sh /bin/nwiz
sudo mv ncom /bin
sudo cp rev/nrev.sh /bin/nrev
sudo cp wiz/nwiz.sh /bin/nwiz
mkdir -p /var/lib/narthex/
cp wiz/elder.txt /var/lib/narthex/
sudo cp enhance/nhance.1 /usr/share/man/man1
sudo cp inc/ninc.1 /usr/share/man/man1
sudo cp leet/nleet.1 /usr/share/man/man1
sudo cp com/ncom.1 /usr/share/man/man1
sudo cp rev/nrev.1 /usr/share/man/man1
sudo mandb

uninstall: /bin/ninc /bin/nhance /bin/nrev /bin/nleet /bin/nwiz /usr/share/man/man1/ninc.1 /usr/share/man/man1/nhance.1 /usr/share/man/man1/nrev.1 /usr/share/man/man1/nleet.1
uninstall: /bin/ninc /bin/nhance /bin/nrev /bin/nleet /bin/ncom /bin/nwiz /usr/share/man/man1/ninc.1 /usr/share/man/man1/nhance.1 /usr/share/man/man1/nrev.1 /usr/share/man/man1/nleet.1 /usr/share/man/man1/ncom.1
rm /bin/ninc /usr/share/man/man1/ninc.1
rm /bin/nhance /usr/share/man/man1/nhance.1
rm /bin/nleet /usr/share/man/man1/nleet.1
rm /bin/nrev /usr/share/man/man1/nrev.1
rm /bin/ncom /usr/share/man/man1/ncom.1
rm /bin/nwiz
rm -r $${HOME}/.config/narthex/
rm -r /var/lib/narthex/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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. Currently under development!

## The tools
+ nchanc - A capitalization tool that appends the results to the bottom of the dictionary (stdout).
+ nchance - A capitalization tool that appends the results to the bottom of the dictionary (stdout).
+ 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.
Expand Down
32 changes: 32 additions & 0 deletions com/ncom.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.\" Manpage for ncom

.TH man 8 "26 Jul 2021" "1.0" "ncom manual page"
.SH NAME
ncom \- Narthex combinator
.SH SYNOPSIS
cat dictionary.txt | ncom [OPTIONS] > output.txt
.SH DESCRIPTION
ncom iterates over stdin and after printing the dictionary as is, it will print it again but will also append every line of stdin to each iteration creating, that way, a list of combinations (pairs) of the lines.

.SH OPTIONS
-d use dot separator

-u use underscore separator

-m use hyphen separator

-n exclude numerical bases, so if the base is '2002' and the part to be appended is 'word', the operation will not be executed.

-b do not operate when the base is the same with the appended part

-v print version and exit

-h print help panel and exit

.SH AUTHOR
Michael Constantine Dimopoulos <[email protected]>

https://mcdim.xyz

.SH LICENSE
GNU Public License 3.0 (GPL-3.0)
49 changes: 34 additions & 15 deletions com/ncom.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@
#include <ctype.h>

/*
* Ncom - Narthex combinator (?)
* ncom - Narthex combinator (?)
*
* By Michael Constantine Dimopoulos
* https://mcdim.xyz <[email protected]>
* License: GNU GPL v3
*
* Currently under development
* :)
* ncom iterates over stdin and after
* printing the dictionary as is, it will
* print it again but will also append
* every line of stdin to each iteration
* creating, that way, a list of combi-
* nations (pairs) of the lines.
*
* By default, it will append when the
* base is the same as the appended part
* (i.e wordword), but that can be
* switched off with the -b flag. It
* can also use other separators, such
* as a hyphen or a dot, all with their
* own flags.
*
*/

Expand All @@ -27,7 +39,6 @@ save_stdin(FILE *f)
while(fgets(buffer, sizeof(buffer), f) != NULL) {
fprintf(f2, "%s", buffer);
}
fclose(f);
return f2;
}

Expand All @@ -42,7 +53,7 @@ isnumber(char * str)
}

static void
com(FILE *f2, FILE *f3, int d, int u, int m, int n)
com(FILE *f2, FILE *f3, int d, int u, int m, int n, int b)
{
char buffer[BUFFER_SIZE];
char buffer2[BUFFER_SIZE];
Expand All @@ -51,10 +62,12 @@ com(FILE *f2, FILE *f3, int d, int u, int m, int n)
while (fgets(buffer2, sizeof(buffer2), f3) != NULL) {
strtok(buffer2, "\n");
if ((n == 0 && isnumber(buffer) == 0) || n == 1) {
printf("%s%s\n", buffer, buffer2);
if (d == 1) printf("%s%s%s\n", buffer, ".", buffer2);
if (m == 1) printf("%s%s%s\n", buffer, "-", buffer2);
if (u == 1) printf("%s%s%s\n", buffer, "-", buffer2);
if ((b == 1 && strcmp(buffer,buffer2) != 0) || b == 0) {
printf("%s%s\n", buffer, buffer2);
if (d == 1) printf("%s%s%s\n", buffer, ".", buffer2);
if (m == 1) printf("%s%s%s\n", buffer, "-", buffer2);
if (u == 1) printf("%s%s%s\n", buffer, "-", buffer2);
}
}
}
rewind(f3);
Expand All @@ -73,13 +86,14 @@ print_only(FILE *f)
static void
help(char * exename)
{
printf( "Ninc - Narthex incrementor %s\n"
printf( "ncom - Narthex combinator %s\n"
"By Michael C. Dim. <[email protected]>\n\n"

"-d Use dot separator\n"
"-u Use underscore separator\n"
"-m Use hyphen separator\n"
"-n Exclude numerical bases\n"
"-b Exclude base-appended\n"
"-h Print this panel & exit\n"
"-v Print current version & exit\n\n"

Expand All @@ -98,14 +112,14 @@ die(char * str)
void
main(int argc, char * argv[])
{
int d=0, u=0, m=0, n=1;
int d=0, u=0, m=0, b=0, n=1;
char *cvalue = NULL;
int index;
int c;

opterr = 0;

while ( (c = getopt (argc, argv, "dumnvhh:")) != -1 )
while ( (c = getopt(argc, argv, "dumnvbhh:")) != -1 )
switch (c) {
case 'v':
die(VERSION);
Expand All @@ -123,10 +137,15 @@ main(int argc, char * argv[])
case 'n':
n=1;
break;
case 'b':
b=1;
break;
case '?':
fprintf (stderr, "Unknown option `\\x%x'.\n", optopt);
exit(EXIT_FAILURE);
/*fprintf (stderr, "Unknown option `%c`\n", c);
exit(EXIT_FAILURE);*/
break;
}

FILE * f2, * f3;
f2 = save_stdin(stdin);
rewind(f2);
Expand All @@ -136,7 +155,7 @@ main(int argc, char * argv[])
print_only(f2);
rewind(f2);
rewind(f3);
com(f2, f3, d, u, m, n);
com(f2, f3, d, u, m, n, b);

fclose(f2);

Expand Down
14 changes: 11 additions & 3 deletions enhance/nhan.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@
#include <string.h>

/*
* Nhance - Narthex enhancer
* nhance - Narthex enhancer
*
* By Michael Constantine Dimopoulos
* https://mcdim.xyz <[email protected]>
* License: GNU GPL v3
*
*
* nhance iterates over stdin and,
* after printing the dictionary as
* is, it will reprint it this time
* with the first letter capitalized.
* It can also append full capitali-
* zations at the end of the dictio-
* nary with the -f flag.
*
*/


Expand Down Expand Up @@ -76,7 +84,7 @@ die(char * str)
static void
help(char * exename)
{
printf( "Nhance - Narthex enhancer %s\n"
printf( "nhance - Narthex enhancer %s\n"
"By Michael C. Dim. <[email protected]>\n\n"

"-f Append full capitalization\n"
Expand Down
4 changes: 2 additions & 2 deletions enhance/nhance.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

.TH man 8 "15 Jul 2021" "1.2" "nhance manual page"
.SH NAME
Ninc \- Narthex enhancer
ninc \- Narthex enhancer
.SH SYNOPSIS
cat dictionary.txt | nhance [OPTIONS] > output.txt
nhance [OPTIONS] dictionary.txt
.SH DESCRIPTION
nhance reads from standard input or a file and appends to it the lines capitalized. It prints to standard output.

.SH OPTIONS
-f Append full capitalizations as well
-f append full capitalizations as well

-v print version and exit

Expand Down
45 changes: 41 additions & 4 deletions inc/nin.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,40 @@
#include <ctype.h>

/*
* Ninc - Narthex incrementor
* ninc - Narthex incrementor
*
* By Michael Constantine Dimopoulos
* https://mcdim.xyz <[email protected]>
* 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).
*
*/

#define VERSION "v1.0"
#define BUFFER_SIZE 256

FILE *
save_stdin(FILE *f)
{
FILE *f2 = tmpfile();
char buffer[BUFFER_SIZE];
while(fgets(buffer, sizeof(buffer), f) != NULL) {
fprintf(f2, "%s", buffer);
}
fclose(f);
return f2;
}

static int
isnumber(char * str)
{
Expand All @@ -31,7 +54,6 @@ ninc(FILE *f, int min, int max, int numerical)
char buffer[BUFFER_SIZE];
while (fgets(buffer, sizeof(buffer), f) != NULL) {
strtok(buffer, "\n");
puts(buffer);
for (int i = min; i <= max; i++) {
if ((numerical == 0 && isnumber(buffer) == 0) || numerical == 1) {
printf("%s%d\n", buffer, i);
Expand All @@ -40,10 +62,19 @@ ninc(FILE *f, int min, int max, int numerical)
}
}

void
print_only(FILE *f)
{
char buffer[BUFFER_SIZE];
while(fgets(buffer, sizeof(buffer), f) != NULL) {
printf("%s",buffer);
}
}

static void
help(char * exename)
{
printf( "Ninc - Narthex incrementor %s\n"
printf( "ninc - Narthex incrementor %s\n"
"By Michael C. Dim. <[email protected]>\n\n"

"-n Increment numerical lines as well\n"
Expand Down Expand Up @@ -88,7 +119,13 @@ main(int argc, char * argv[])
}

if (min <= max) {
ninc(stdin, min, max, numerical);
FILE * f;
f = save_stdin(stdin);
rewind(f);
print_only(f);
rewind(f);
ninc(f, min, max, numerical);
}

exit(EXIT_SUCCESS);
}
2 changes: 1 addition & 1 deletion inc/ninc.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ninc \- Narthex incrementor
.SH SYNOPSIS
cat dictionary.txt | ninc [MIN] [MAX] [OPTIONS] > output.txt
.SH DESCRIPTION
ninc reads from standard input and multiplies each line with the difference of max-min, and appends n to each line, where n is increased after every line from min to max inclusive. It prints to standard output.
ninc reads from standard input and, after printing the dictionary as is, it reprints it but multiplies each line with the difference of max-min, and appends n to each line, where n is increased after every line from min to max inclusive. It prints to standard output.

.SH OPTIONS
-n increment numerical lines
Expand Down
2 changes: 1 addition & 1 deletion leet/nleet.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.TH man 8 "15 Jul 2021" "1.2" "nleet manual page"
.SH NAME
ninc \- Narthex leetifier
nleet \- Narthex leetifier
.SH SYNOPSIS
cat dictionary.txt | nhance [OPTIONS] > output.txt
nhance [OPTIONS] dictionary.txt
Expand Down
15 changes: 13 additions & 2 deletions leet/nleet.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@
#include <string.h>

/*
* Nhance - Narthex leetifier
* nleet - Narthex leetifier
*
* By Michael Constantine Dimopoulos
* https://mcdim.xyz <[email protected]>
* License: GNU GPL v3
*
* nleet will iterate over stdin or
* a file and, after printing the
* dictionary as is, it will reprint
* it this time with some characters
* replaced with their leet equiva-
* lents. (hello -> h3ll0)
*
* You are encouraged to edit &
* recompile this file if you want
* to edit the substitution rules.
*
*/


Expand Down Expand Up @@ -84,7 +95,7 @@ die(char * str)
static void
help(char * exename)
{
printf( "Nhance - Narthex leetfier %s\n"
printf( "nleet - Narthex leetfier %s\n"
"By Michael C. Dim. <[email protected]>\n\n"

"-h Print this panel & exit\n"
Expand Down
Loading

0 comments on commit 2520e61

Please sign in to comment.