diff --git a/Makefile b/Makefile index 4fab1390..33591e98 100644 --- a/Makefile +++ b/Makefile @@ -3,23 +3,52 @@ # # See LICENSE.md +# Can't use a '#' in the shell command +VERSION=$(shell egrep '^.define VERSION' client/dnscat.c | head -n1 | cut -d\" -f2) + +OS=$(shell uname -s) +ARCH=$(shell uname -p | sed 's/x86_64/x64/i' | sed 's/i.86/x86/i') + +ifeq ($(OS), Linux) + RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(ARCH)" +else + RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(OS)-$(ARCH)" +endif + all: @cd client && make @echo "Compile complete!" @echo "* Client: client/dnscat" @echo "* Server: server/dnscat_*.rb" +clean: + @cd client && make clean + @rm -rf dist/* + debug: @cd client && make debug @echo "Debug compile complete!" -release: +release: clean + -mkdir dist/ @cd client && make release + @mv client/dnscat . + @strip dnscat + @tar -cvvjf dist/${RELEASE_FILENAME}.tar.bz2 dnscat + @echo "*** Release compiled: `pwd`/${RELEASE_FILENAME}" + @echo "*** By the way, did you update the version number in the server?" @echo "Release compile complete!" -clean: - @cd client && make clean - @rm -rf dist/* +source_release: clean + -mkdir dist/ + @cp -r client dnscat2_client + @tar -cvvjf dist/dnscat2-${VERSION}-client-source.tar.bz2 dnscat2_client + @zip -r dist/dnscat2-${VERSION}-client-source.zip dnscat2_client + @rm -rf dnscat2_client + @cp -r server dnscat2_server + @tar -cvvjf dist/dnscat2-${VERSION}-server.tar.bz2 dnscat2_server + @zip -r dist/dnscat2-${VERSION}-server.zip dnscat2_server + @rm -rf dnscat2_server dnscat: @cd client && make dnscat diff --git a/client/Makefile b/client/Makefile index ce607bf8..0dc51c08 100644 --- a/client/Makefile +++ b/client/Makefile @@ -12,18 +12,6 @@ RELEASE_CFLAGS?=-Os CFLAGS?=--std=c89 -I. -Wall -D_DEFAULT_SOURCE -fstack-protector-all -Wformat -Wformat-security -g LIBS=-pie -Wl,-z,relro,-z,now -# Can't use a '#' in the shell command -VERSION=$(shell egrep '^.define VERSION' dnscat.c | head -n1 | cut -d\" -f2) - -OS=$(shell uname -s) -ARCH=$(shell uname -p | sed 's/x86_64/x64/i' | sed 's/i.86/x86/i') - -ifeq ($(OS), Linux) - RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(ARCH)" -else - RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(OS)-$(ARCH)" -endif - OBJS=controller/packet.o \ controller/session.o \ controller/controller.o \ @@ -58,11 +46,7 @@ debug: dnscat @echo "*** Debug build complete" release: CFLAGS += ${RELEASE_CFLAGS} -release: clean dnscat - strip dnscat - tar -cjf ${RELEASE_FILENAME}.tar.bz2 dnscat - @echo "*** Release compiled: `pwd`/${RELEASE_FILENAME}" - @echo "*** By the way, did you update the version number in the server?" +release: dnscat nocrypto: CFLAGS += -DNO_ENCRYPTION nocrypto: all diff --git a/client/controller/session.c b/client/controller/session.c index 10de57c6..db4fb130 100644 --- a/client/controller/session.c +++ b/client/controller/session.c @@ -261,19 +261,23 @@ static NBBOOL _handle_enc_before_init(session_t *session, packet_t *packet) exit(1); } + if(LOG_LEVEL_INFO >= log_get_min_console_level()) + encryptor_print(session->encryptor); + if(preshared_secret) + { session->state = SESSION_STATE_BEFORE_AUTH; + } else + { session->state = SESSION_STATE_NEW; - if(LOG_LEVEL_INFO >= log_get_min_console_level()) - encryptor_print(session->encryptor); - - printf("\n"); - printf("Encrypted session established! For added security, please verify the server also displays this string:\n"); - printf("\n"); - encryptor_print_sas(session->encryptor); - printf("\n"); + printf("\n"); + printf("Encrypted session established! For added security, please verify the server also displays this string:\n"); + printf("\n"); + encryptor_print_sas(session->encryptor); + printf("\n"); + } return TRUE; } diff --git a/doc/how_to_do_a_release.md b/doc/how_to_do_a_release.md index 0b56eab5..4d6fb65a 100644 --- a/doc/how_to_do_a_release.md +++ b/doc/how_to_do_a_release.md @@ -50,30 +50,28 @@ Release versions on Linux can be compiled using: make release -It even zips them for you! Releases on other platforms (like Windows) -require some manual work at the moment. Please try to follow my naming -scheme: - -* dnscat2-v0.02beta-client-win32.zip -* dnscat2-v0.02beta-client-x64.tar.bz2 -* dnscat2-v0.02beta-client-x86.tar.bz2 -* dnscat2-v0.02beta-client-source.tar.bz2 -* dnscat2-v0.02beta-client-source.zip -* dnscat2-v0.02beta-server.tar.bz2 -* dnscat2-v0.02beta-server.zip - -For binaries, the binaries in the archive should be simply "dnscat". - -For source, the full client or server directory should be named -"dnscat2-client" or "dnscat2-server" and zipped: - - mv client dnscat2-client - tar -cvvjf dnscat2-v0.02beta-client-source.tar.bz2 dnscat2-client-source/ - zip -r dnscat2-v0.02beta-client-source.zip dnscat2-client-source/ - mv dnscat2-client client - -I don't provide a zip of the client and server source together because -that's just what you get on github. :) +Source distros can be packaged using: + + make source_release + +It even zips them for you! They're put into the dist/ folder. + +Releases on other platforms (like Windows) require some manual work at +the moment. Please try to follow my naming scheme: + +dnscat2-v0.04-client-source.tar.bz2 +dnscat2-v0.04-client-source.zip +dnscat2-v0.04-client-win32.zip +dnscat2-v0.04-client-x64.tar.bz2 +dnscat2-v0.04-client-x86.tar.bz2 +dnscat2-v0.04-server.tar.bz2 +dnscat2-v0.04-server.zip + +For binaries, the binaries in the archive should be simply "dnscat" - no +paths or anything like that. + +FWIW, I don't provide a zip of the client and server source together +because that's exactly just what you get on github. :) ## Sign and upload the release files diff --git a/server/tunnel_drivers/driver_dns.rb b/server/tunnel_drivers/driver_dns.rb index 39d12cc7..d7393937 100644 --- a/server/tunnel_drivers/driver_dns.rb +++ b/server/tunnel_drivers/driver_dns.rb @@ -192,14 +192,14 @@ def initialize(parent_window, host, port, domains) @window.puts("the client anywhere with the following (--secret is optional):") @window.puts() domains.each do |domain| - @window.puts(" ./dnscat2 --secret=#{Settings::GLOBAL.get('secret')} #{domain}") + @window.puts(" ./dnscat --secret=#{Settings::GLOBAL.get('secret')} #{domain}") end @window.puts("") end @window.puts("To talk directly to the server without a domain name, run:") @window.puts() - @window.puts(" ./dnscat2 --dns server=x.x.x.x,port=#{port} --secret=#{Settings::GLOBAL.get('secret')}") + @window.puts(" ./dnscat --dns server=x.x.x.x,port=#{port} --secret=#{Settings::GLOBAL.get('secret')}") @window.puts("") @window.puts("Of course, you have to figure out yourself! Clients") @window.puts("will connect directly on UDP port #{port}.")