From 16ee03f5904318e4a624ffe7a8228ed71b6aaeb5 Mon Sep 17 00:00:00 2001 From: Konrads Smelkovs Date: Fri, 18 May 2018 20:42:59 +0100 Subject: [PATCH 1/4] Fix a crash on Solaris 10 where a NULL pointer printf causes SEGV --- client/dnscat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/dnscat.c b/client/dnscat.c index 43563739..f2a95d10 100644 --- a/client/dnscat.c +++ b/client/dnscat.c @@ -287,7 +287,7 @@ driver_dns_t *create_dns_driver_internal(select_group_t *group, char *domain, ch } printf("Creating DNS driver:\n"); - printf(" domain = %s\n", domain); + printf(" domain = %s\n", (domain ? domain :"")); printf(" host = %s\n", host); printf(" port = %u\n", port); printf(" type = %s\n", type); From 6fde996d60de6a3a9c9740b87990b3afc968042f Mon Sep 17 00:00:00 2001 From: Konrads Smelkovs Date: Fri, 18 May 2018 23:34:45 +0100 Subject: [PATCH 2/4] This small rename of flags for d->debug and q->quiet seems to work-around a bug on Solaris 10 whereby these options in their short version would be treated as unknown options. Small price to pay... --- client/dnscat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/dnscat.c b/client/dnscat.c index f2a95d10..cfba38c1 100644 --- a/client/dnscat.c +++ b/client/dnscat.c @@ -392,8 +392,8 @@ int main(int argc, char *argv[]) #endif /* Debug options */ - {"d", no_argument, 0, 0}, /* More debug */ - {"q", no_argument, 0, 0}, /* Less debug */ + {"debug", no_argument, 0, 0}, /* More debug */ + {"quiet", no_argument, 0, 0}, /* Less debug */ {"packet-trace", no_argument, 0, 0}, /* Trace packets */ /* Sentry */ @@ -527,7 +527,7 @@ int main(int argc, char *argv[]) } /* Debug options */ - else if(!strcmp(option_name, "d")) + else if(!strcmp(option_name, "debug")) { if(min_log_level > 0) { @@ -535,7 +535,7 @@ int main(int argc, char *argv[]) log_set_min_console_level(min_log_level); } } - else if(!strcmp(option_name, "q")) + else if(!strcmp(option_name, "quiet")) { min_log_level++; log_set_min_console_level(min_log_level); From 2f01d4193e4339e3e42d6acfeb6422dc47ac6f2f Mon Sep 17 00:00:00 2001 From: Konrads Smelkovs Date: Sun, 20 May 2018 00:17:53 +0100 Subject: [PATCH 3/4] Small improvement works on debug vs non-debug builds: - moved -g flag to debugflugs - added -ggdb - squelched char-subscript error in uECC.c --- client/Makefile | 4 ++-- client/libs/crypto/micro-ecc/uECC.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/Makefile b/client/Makefile index 3049eadf..336dbadb 100644 --- a/client/Makefile +++ b/client/Makefile @@ -7,9 +7,9 @@ # Should work for Linux and BSD make. CC?=gcc -DEBUG_CFLAGS?=-DTESTMEMORY -Werror -O0 +DEBUG_CFLAGS?=-DTESTMEMORY -Werror -O0 -g -ggdb RELEASE_CFLAGS?=-Os -CFLAGS?=--std=c89 -I. -Wall -D_DEFAULT_SOURCE -Wformat -Wformat-security -g +CFLAGS?=--std=c89 -I. -Wall -D_DEFAULT_SOURCE -Wformat -Wformat-security LIBS=-pie -Wl,-z,relro,-z,now LDFLAGS= diff --git a/client/libs/crypto/micro-ecc/uECC.c b/client/libs/crypto/micro-ecc/uECC.c index c385aef8..2fedd1af 100644 --- a/client/libs/crypto/micro-ecc/uECC.c +++ b/client/libs/crypto/micro-ecc/uECC.c @@ -1,4 +1,5 @@ /* Copyright 2014, Kenneth MacKay. Licensed under the BSD 2-clause license. */ +#pragma GCC diagnostic ignored "-Wchar-subscripts" #include "uECC.h" #include "uECC_vli.h" From da4a1bc1807482fd57c45fdef8738beac34e9033 Mon Sep 17 00:00:00 2001 From: Konrads Smelkovs Date: Sun, 20 May 2018 00:24:24 +0100 Subject: [PATCH 4/4] Add a note on compiling on Solaris 10 --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7153665d..d475b22d 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,10 @@ On Windows, load client/win32/dnscat2.vcproj into Visual Studio and hit free legit copy of a newer version, I'll likely be sticking with that one. :) +**NB: You need a recent gcc compiler**. On Solaris 10, the gcc that ships with +it- 3.4.3 produces buggy code in encryption routines and you will expericence crashes. +Try with [CSW gcc 5.5.0](https://www.opencsw.org/packages/CSWgcc5core/) + If compilation fails, please file a bug on my [github page](https://github.com/iagox86/dnscat2/issues)! Please send details about your system.