From d2c9eb633008931a792e8bf5c710ea0e00b6ff4c Mon Sep 17 00:00:00 2001 From: Colum Paget Date: Tue, 18 Jun 2024 14:12:09 +0100 Subject: [PATCH] fix 'make check', compile without zlib or openssl --- CHANGELOG | 6 + Makefile | 10 +- Makefile.in | 2 +- README.md | 21 +- cgi.c | 15 +- check-hash.c | 2 +- check.sh | 42 +- common.h | 2 +- configure | 119 +- configure.ac | 49 +- find.c | 7 +- find.h | 2 +- fingerprint.c | 4 +- include-exclude.c | 1 - libUseful-5/CHANGELOG | 40 +- libUseful-5/Compression.c | 4 +- libUseful-5/DataParser.c | 88 +- libUseful-5/Encodings.c | 68 +- libUseful-5/FileSystem.c | 2 +- libUseful-5/GeneralFunctions.c | 70 +- libUseful-5/HttpServer.c | 7 +- libUseful-5/Inet.h | 0 libUseful-5/LICENCE | 0 libUseful-5/Makefile | 39 +- libUseful-5/Makefile.in | 35 +- libUseful-5/Markup.h | 0 libUseful-5/OAuth.c | 2 +- libUseful-5/OTP.c | 38 +- libUseful-5/OpenSSL.c | 254 +- libUseful-5/Process.c | 2 + libUseful-5/README.md | 0 libUseful-5/Socket.c | 14 +- libUseful-5/Socket.h | 4 + libUseful-5/SpawnPrograms.c | 32 +- libUseful-5/Ssh.h | 0 libUseful-5/Stream.c | 40 +- libUseful-5/Stream.h | 42 +- libUseful-5/StreamAuth.c | 6 +- libUseful-5/Terminal.c | 8 +- libUseful-5/Terminal.h | 4 + libUseful-5/TerminalChoice.h | 18 +- libUseful-5/TerminalProgress.c | 63 + libUseful-5/TerminalProgress.h | 82 + libUseful-5/TerminalTheme.c | 27 +- libUseful-5/TerminalWidget.c | 26 +- libUseful-5/TerminalWidget.h | 2 +- libUseful-5/URL.h | 0 libUseful-5/Unicode.c | 2 +- libUseful-5/Users.c | 19 +- libUseful-5/Users.h | 8 +- libUseful-5/base32.c | 110 +- libUseful-5/base64.h | 0 libUseful-5/configure | 3811 ++++++++++++++++----------- libUseful-5/configure.ac | 102 +- libUseful-5/examples/.Hash.c.swp | Bin 12288 -> 0 bytes libUseful-5/examples/Hash.c | 2 +- libUseful-5/examples/Makefile | 1 + libUseful-5/examples/TermProgress.c | 28 + libUseful-5/examples/base32.c | 11 +- libUseful-5/examples/ssh-time.c | 31 + libUseful-5/includes.h | 0 libUseful-5/libUseful.h | 1 + libUseful-5/md5-global.h | 0 main.c | 8 +- output.c | 7 +- xdialog.c | 2 +- 66 files changed, 3430 insertions(+), 2012 deletions(-) mode change 100755 => 100644 libUseful-5/Inet.h mode change 100755 => 100644 libUseful-5/LICENCE mode change 100755 => 100644 libUseful-5/Makefile.in mode change 100755 => 100644 libUseful-5/Markup.h mode change 100755 => 100644 libUseful-5/README.md mode change 100755 => 100644 libUseful-5/Ssh.h create mode 100644 libUseful-5/TerminalProgress.c create mode 100644 libUseful-5/TerminalProgress.h mode change 100755 => 100644 libUseful-5/URL.h mode change 100755 => 100644 libUseful-5/base64.h mode change 100755 => 100644 libUseful-5/configure.ac delete mode 100644 libUseful-5/examples/.Hash.c.swp create mode 100644 libUseful-5/examples/TermProgress.c create mode 100644 libUseful-5/examples/ssh-time.c mode change 100755 => 100644 libUseful-5/includes.h mode change 100755 => 100644 libUseful-5/md5-global.h diff --git a/CHANGELOG b/CHANGELOG index f1976ab..9c03d7c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +v1.20 (2024-06-18) + * Bring "make check" (check.sh) up to date with latest functioning of hashrat + * Compile if openssl not available (update to latest libUseful) + * Honor stdin-supplied hash type when using 'match' (-m) functionality + * Add -enable-harden, --enable-zlib and other options to ./configure + v1.19 (2024-01-15) * Don't push comment to clipboard, just code/hash. diff --git a/Makefile b/Makefile index 28f5cc5..bc1055a 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CC = gcc -CFLAGS = -g -O2 -LIBS = libUseful-5/libUseful.a -lssl -lcrypto +CFLAGS = -g -O2 -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong +LIBS = libUseful-5/libUseful.a -lssl -lcrypto -lz INSTALL=/usr/bin/install -c -prefix=/usr +prefix=/usr/local bindir=$(prefix)${exec_prefix}/bin -FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBSSL=1 +FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -DHAVE_LIBCRYPTO=1 -DHAVE_LIBSSL=1 OBJ=common.o encodings.o command-line-args.o ssh.o http.o fingerprint.o include-exclude.o files.o filesigning.o xattr.o check-hash.o find.o otp.o memcached.o frontend.o cgi.o xdialog.o output.o EXE=hashrat @@ -74,7 +74,7 @@ check: hashrat @./check.sh clean: - -rm -f *.o */*.o */*.a */*.so *.orig $(EXE) + -rm -f *.o */*.o */*.a */*.so *.orig *.out $(EXE) -rm -f config.log config.status */config.log */config.status -rm -fr autom4te.cache */autom4te.cache diff --git a/Makefile.in b/Makefile.in index b4058f3..c698652 100644 --- a/Makefile.in +++ b/Makefile.in @@ -74,7 +74,7 @@ check: hashrat @./check.sh clean: - -rm -f *.o */*.o */*.a */*.so *.orig $(EXE) + -rm -f *.o */*.o */*.a */*.so *.orig *.out $(EXE) -rm -f config.log config.status */config.log */config.status -rm -fr autom4te.cache */autom4te.cache diff --git a/README.md b/README.md index fa5aafa..47104b6 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,8 @@ OPTIONS -period Produce TOTP code with period/lifetime of seconds. -8 Encode with octal instead of hex -10 Encode with decimal instead of hex - -H Encode with UPPERCASE hexadecimal - -HEX Encode with UPPERCASE hexadecimal + -H Encode with UPPERCASE hexadecimal instead of lowercase + -HEX Encode with UPPERCASE hexadecimal instead of lowercase -32 Encode with base32 instead of hex -base32 Encode with base32 instead of hex -c32 Encode with Crockford base32 instead of hex @@ -348,7 +348,6 @@ Hashrat can be used as a TOTP authenticator, and defaults to google-authenticato - HOOKSCRIPTS =========== @@ -359,6 +358,22 @@ Hookscripts, defined using the `-h` or `-hook` command-line options, are scripts * 'Find duplicates' mode: The hookscript is called if a file is a duplicate of another file. It is passed the paths of both files. + +MATCH Mode +========== + +The '-m' function allows matching a list of file hashes input on stdin. It differs from check mode in that, instead of checking a specific file against a hash supplied for the file, it accepts a hash and goes looking for any files that match that hash. However, this causes problems if different hash functions are used in the file input. Hashrat's native format allows specifying the hash-type that is supplied on a hash-by-hash basis. This works fine for 'check' mode, but in 'match' mode hashrat does not know which fingerprint/hash a file will match before it hashes it. Therefore hashrat will expect all the supplied hashes to be the same hash format when in match mode. This if suppling native-format hashes like this: + +``` +hash='sha1:c04b4a87e789eceb7c10c2d6a785f91820bf9db4' type='file' mode='100664' uid='1000' gid='1000' size='5759' mtime='1718700145' inode='8436275' path='tests/help.txt' +hash='md5:10fc712fd1298e2cb7a34303242d8ae4' type='file' mode='100664' uid='1000' gid='1000' size='621' mtime='1718700145' inode='8436276' path='tests/quotes.txt' +``` + +Hashrat will honor the LAST format given (in this case md5) and use it for matching all files. + +Basically, don't mix hash types when using 'match' mode. + + CGI Mode ======== diff --git a/cgi.c b/cgi.c index d55f51b..6e27fe2 100644 --- a/cgi.c +++ b/cgi.c @@ -19,8 +19,8 @@ static void CGIPrintSelect(const char *Name, const char *CurrType, ListNode *Ite Curr=ListGetNext(Items); while(Curr) { - if (StrValid(CurrType) && (strcmp(Curr->Tag,CurrType)==0)) printf("