Skip to content

Commit

Permalink
Improve README.md
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
Xanadrel committed Jun 12, 2021
1 parent 8be220c commit cc6b115
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 53 deletions.
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
*.bin

# Debug files
*.dSYM/

*.su
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Xanadrel
Copyright (c) 2017-2021 Xanadrel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
51 changes: 25 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ CFLAGS += -Wall -W -pipe -O2 -std=c99
all: clean release

release: linux windows
$(STRIP_LINUX) *.bin
$(STRIP_WINDOWS) *.exe
mv *.bin ./bin
mv *.exe ./bin
$(STRIP_LINUX) *.bin
$(STRIP_WINDOWS) *.exe
mv *.bin ./bin
mv *.exe ./bin

clean:
rm -f ./bin/*.bin ./bin/*.exe ./bin/*.pl
rm -f *.bin *.exe
rm -f ./bin/*.bin ./bin/*.exe ./bin/*.pl
rm -f *.bin *.exe

##
## LINUX
Expand All @@ -27,16 +27,16 @@ CFLAGS_LINUX = $(CFLAGS) -D_LINUX
LDFLAGS_LINUX = $(LDFLAGS)

linux:
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o alarm.bin src/alarm.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o dict.bin src/dict.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o leftlist.bin src/leftlist.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o sed_cut_coffee.bin src/sed_cut_coffee.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o dgrep2.bin src/dgrep2.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o metagen.bin src/metagen.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o metabuild.bin src/metabuild.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o rli2_len.bin src/rli2_len.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o cmp_rli2.bin src/cmp_rli2.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o alarm.bin src/alarm.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o dict.bin src/dict.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o leftlist.bin src/leftlist.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o sed_cut_coffee.bin src/sed_cut_coffee.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o dgrep2.bin src/dgrep2.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o metagen.bin src/metagen.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o metabuild.bin src/metabuild.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o rli2_len.bin src/rli2_len.c
${CC_LINUX} ${CFLAGS_LINUX} ${LDFLAGS_LINUX} -o cmp_rli2.bin src/cmp_rli2.c

##
## WINDOWS
##
Expand All @@ -46,13 +46,12 @@ STRIP_WINDOWS = x86_64-w64-mingw32-strip
CFLAGS_WINDOWS = $(CFLAGS) -D_WINDOWS -I/usr/i686-w64-mingw32/include/

windows:
# ${CC_WINDOWS} ${CFLAGS_WINDOWS} -o alarm.exe src/alarm.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o dict.exe src/dict.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o leftlist.exe src/leftlist.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o sed_cut_coffee.exe src/sed_cut_coffee.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o dgrep2.exe src/dgrep2.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o metagen.exe src/metagen.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o metabuild.exe src/metabuild.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o rli2_len.exe src/rli2_len.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o cmp_rli2.exe src/cmp_rli2.c

# ${CC_WINDOWS} ${CFLAGS_WINDOWS} -o alarm.exe src/alarm.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o dict.exe src/dict.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o leftlist.exe src/leftlist.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o sed_cut_coffee.exe src/sed_cut_coffee.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o dgrep2.exe src/dgrep2.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o metagen.exe src/metagen.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o metabuild.exe src/metabuild.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o rli2_len.exe src/rli2_len.c
${CC_WINDOWS} ${CFLAGS_WINDOWS} -o cmp_rli2.exe src/cmp_rli2.c
93 changes: 89 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,97 @@
## lc-utils
# lc-utils

### Important notes
## Description

This is a compilation of small tools to work with files (usually containing hashes).

If you didn't notice it is **heavily** inspired by [hashcat-utils](https://github.com/hashcat/hashcat-utils) (which has other great tools, including the greatest of all: **rli2**).

## Important stuff

Never forget to set `LC_ALL=C` and `sort -u` input files.

## Files used

We are working with different files

- list: list of hashes, sorted and uniqued
- found: list of cracked hashes (in hash[:salt]:pass format), sorted and uniqued
- left: list of hashes not cracked yet (in hash[:salt] format), sorted and uniqued
- dict: list of only plaintext passwords, sorted but not always uniqued
- meta: based on a `list`, contains line number and count of a hash (if count > 1), "sorted"
- original list: list of hashes, sorted but **NOT** uniqued

> Note: the goal of the meta file is to reduce the size of a hashlist without losing the precious number of occurrence of each hash (it's obviously targetted at unsalted algorithms).
## Tools and their uses

### alarm

Stops a cmd ran through it if the time exceeds a given time in seconds.

Usage: `./alarm.bin <secs> <cmd>`

### cmp_rli2

Print the percentage of lines from `infile` which are in `removefile`

Usage: `./cmp_rli2.bin <infile> <removefile>`

### dgrep2

Print first line starting with the provided `search` string in a sorted and uniqued file

Usage: `./dgrep2.bin <file> <search>`

### dict

Generate a `dict` file using provided `list` and `found` files

Usage: `./dict.bin <listfile> <foundfile>`

### Building
### leftlist

Install gcc and stuff and also `gcc-mingw-w64` for compiling for windows
Generate a `left` file using provided `list` and `found` files

Usage: `./leftlist.bin <listfile> <foundfile>`

### metabuild

Generate the `original list`, `dict` and `count` using the `list` and `meta` files (output will match the count of hashes in the **not** uniqued `original list`).

Usage: `./metabuild.bin <type> <listfile> <metafile> [foundfile]`

Where type can be:
- `list` generate the `original list`
- `dict` generate the dict, using `found` file (can use `uniq -c` to get stats and generate a dict sorted by occurrence as well)
- `count` count the total of cracked hashes

### metagen

Generate the `meta` file based on an `original list` file

Usage: `./metagen.bin <listfile> <metafile>`

(After this is done, you can unique the `original list` and keep only the resulting `list` file).

### rli2_len

Generate lines similar to both files but compare using length of `infile` lines

Usage: `./rli2_len.bin <infile> <removefile>`

### sed_cut_coffee

Print lines removing leading count & spaces (from the output of uniq -c)

Usage: `./sed_cut_coffee.bin <file>`

## Building

Install gcc and stuff and also `gcc-mingw-w64` to compile for windows

Just do `make all`

## Binaries

Binaries for Linux and Windows can be found here : https://github.com/Xanadrel/lc-utils/releases
6 changes: 3 additions & 3 deletions src/alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <errno.h>

/**
* Name...: alarm.c
* Author.: not Xanadrel
* Desc...: Stops a cmd ran through it if the time exceeds <secs>
* Name....: alarm.c
* Author..: not Xanadrel
* Desc....: Stops a cmd ran through it if the time exceeds <secs>
* License.: Unknown
*/

Expand Down
2 changes: 1 addition & 1 deletion src/cmp_rli2.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char *argv[])

int comp = 1;
uint similar = 0;
uint total = 0;
uint total = 1;

while (!feof(fd1) && !feof(fd2))
{
Expand Down
8 changes: 4 additions & 4 deletions src/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "utils.c"

/**
* Name...: dict.c
* Author.: Xanadrel
* Desc...: Prints the dictionary/wordlist (plain) using a <leftlist> (hash[:salt]), and a <foundfile> (hash[:salt]:plain)
* Name....: dict.c
* Author..: Xanadrel
* Desc....: Prints the dictionary/wordlist (plain) using a <leftlist> (hash[:salt]), and a <foundfile> (hash[:salt]:plain)
* License.: MIT
*/

Expand All @@ -26,7 +26,7 @@ int main (int argc, char *argv[])

if (argc != 3)
{
fprintf (stderr, "usage: %s <leftfile> <foundfile>\n", argv[0]);
fprintf (stderr, "usage: %s <listfile> <foundfile>\n", argv[0]);

return (-1);
}
Expand Down
8 changes: 4 additions & 4 deletions src/leftlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "utils.c"

/**
* Name...: leftlist.c
* Author.: Xanadrel
* Desc...: Prints the leftlist (hash[:salt]) using a <hashfile> (hash[:salt]), and a <foundfile> (hash[:salt]:plain)
* Name....: leftlist.c
* Author..: Xanadrel
* Desc....: Prints the leftlist (hash[:salt]) using a <hashfile> (hash[:salt]), and a <foundfile> (hash[:salt]:plain)
* License.: MIT
*/

Expand All @@ -26,7 +26,7 @@ int main (int argc, char *argv[])

if (argc != 3)
{
fprintf (stderr, "usage: %s <hashfile> <foundfile>\n", argv[0]);
fprintf (stderr, "usage: %s <listfile> <foundfile>\n", argv[0]);

return (-1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/rli2_len.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Name....: rli2_len.c
* Author..: Xanadrel
* Desc....: Same as rli2 but using line length from infile for the comparison
* Desc....: Generate lines similar to both files but compare using length of infile lines
* License.: MIT
*/

Expand Down
6 changes: 3 additions & 3 deletions src/sed_cut_coffee.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "utils.c"

/**
* Name...: sed_cut_coffee.c
* Author.: Xanadrel
* Desc...: Prints lines removing leading count & spaces (output of uniq -c), replaces cut -bX-
* Name....: sed_cut_coffee.c
* Author..: Xanadrel
* Desc....: Prints lines removing leading count & spaces (output of uniq -c), replaces cut -bX-
* License.: MIT
*/

Expand Down

0 comments on commit cc6b115

Please sign in to comment.