print proxychains version on DLL init

framework to print version stolen from musl
This commit is contained in:
rofl0r 2014-07-22 14:10:08 +02:00
parent 7852269282
commit cd4aee1997
6 changed files with 32 additions and 2 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
*.out
*~
*.patch
version.h
# Autoconf stuff
libtool

View File

@ -15,11 +15,13 @@ sysconfdir=$(prefix)/etc
SRCS = $(sort $(wildcard src/*.c))
OBJS = $(SRCS:.c=.o)
LOBJS = src/nameinfo.o \
LOBJS = src/nameinfo.o src/version.o \
src/core.o src/common.o src/libproxychains.o src/shm.o \
src/allocator_thread.o src/ip_type.o src/stringdump.o \
src/hostentdb.o src/hash.o src/debug.o
GENH = src/version.h
CFLAGS += -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe
NO_AS_NEEDED = -Wl,--no-as-needed
LIBDL = -ldl
@ -61,6 +63,12 @@ clean:
rm -f $(ALL_LIBS)
rm -f $(ALL_TOOLS)
rm -f $(OBJS)
rm -f $(GENH)
src/version.h: $(wildcard VERSION .git)
printf '#define VERSION "%s"\n' "$$(sh tools/version.sh)" > $@
src/version.o: src/version.h
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $<

1
VERSION Normal file
View File

@ -0,0 +1 @@
4.7

View File

@ -98,6 +98,8 @@ static void* load_sym(char* symname, void* proxyfunc) {
#include "allocator_thread.h"
#include "stringdump.h"
const char *proxychains_get_version(void);
static void do_init(void) {
srand(time(NULL));
dumpstring_init(); // global string garbage can
@ -108,7 +110,7 @@ static void do_init(void) {
get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
DUMP_PROXY_CHAIN(proxychains_pd, proxychains_proxy_count);
proxychains_write_log(LOG_PREFIX "DLL init\n");
proxychains_write_log(LOG_PREFIX "DLL init: proxychains-ng %s\n", proxychains_get_version());
SETUP_SYM(connect);
SETUP_SYM(gethostbyname);

6
src/version.c Normal file
View File

@ -0,0 +1,6 @@
#include "version.h"
static const char version[] = VERSION;
const char *proxychains_get_version(void) {
return version;
}

12
tools/version.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
if test -d .git ; then
if type git >/dev/null 2>&1 ; then
git describe --tags --match 'v[0-9]*' 2>/dev/null \
| sed -e 's/^v//' -e 's/-/-git-/'
else
sed 's/$/-git/' < VERSION
fi
else
cat VERSION
fi