Skip to content

Commit

Permalink
Merge branch 'crypto' of github.com:iagox86/dnscat2 into crypto
Browse files Browse the repository at this point in the history
  • Loading branch information
iagox86 committed Nov 16, 2015
2 parents a726d1a + 25efa66 commit cd5a158
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 55 deletions.
37 changes: 33 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 1 addition & 17 deletions client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions client/controller/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
46 changes: 22 additions & 24 deletions doc/how_to_do_a_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions server/tunnel_drivers/driver_dns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <server> yourself! Clients")
@window.puts("will connect directly on UDP port #{port}.")
Expand Down

0 comments on commit cd5a158

Please sign in to comment.