Skip to content

Commit cd5a158

Browse files
committedNov 16, 2015
Merge branch 'crypto' of github.com:iagox86/dnscat2 into crypto
2 parents a726d1a + 25efa66 commit cd5a158

File tree

5 files changed

+70
-55
lines changed

5 files changed

+70
-55
lines changed
 

‎Makefile

+33-4
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,52 @@
33
#
44
# See LICENSE.md
55

6+
# Can't use a '#' in the shell command
7+
VERSION=$(shell egrep '^.define VERSION' client/dnscat.c | head -n1 | cut -d\" -f2)
8+
9+
OS=$(shell uname -s)
10+
ARCH=$(shell uname -p | sed 's/x86_64/x64/i' | sed 's/i.86/x86/i')
11+
12+
ifeq ($(OS), Linux)
13+
RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(ARCH)"
14+
else
15+
RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(OS)-$(ARCH)"
16+
endif
17+
618
all:
719
@cd client && make
820
@echo "Compile complete!"
921
@echo "* Client: client/dnscat"
1022
@echo "* Server: server/dnscat_*.rb"
1123

24+
clean:
25+
@cd client && make clean
26+
@rm -rf dist/*
27+
1228
debug:
1329
@cd client && make debug
1430
@echo "Debug compile complete!"
1531

16-
release:
32+
release: clean
33+
-mkdir dist/
1734
@cd client && make release
35+
@mv client/dnscat .
36+
@strip dnscat
37+
@tar -cvvjf dist/${RELEASE_FILENAME}.tar.bz2 dnscat
38+
@echo "*** Release compiled: `pwd`/${RELEASE_FILENAME}"
39+
@echo "*** By the way, did you update the version number in the server?"
1840
@echo "Release compile complete!"
1941

20-
clean:
21-
@cd client && make clean
22-
@rm -rf dist/*
42+
source_release: clean
43+
-mkdir dist/
44+
@cp -r client dnscat2_client
45+
@tar -cvvjf dist/dnscat2-${VERSION}-client-source.tar.bz2 dnscat2_client
46+
@zip -r dist/dnscat2-${VERSION}-client-source.zip dnscat2_client
47+
@rm -rf dnscat2_client
48+
@cp -r server dnscat2_server
49+
@tar -cvvjf dist/dnscat2-${VERSION}-server.tar.bz2 dnscat2_server
50+
@zip -r dist/dnscat2-${VERSION}-server.zip dnscat2_server
51+
@rm -rf dnscat2_server
2352

2453
dnscat:
2554
@cd client && make dnscat

‎client/Makefile

+1-17
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ RELEASE_CFLAGS?=-Os
1212
CFLAGS?=--std=c89 -I. -Wall -D_DEFAULT_SOURCE -fstack-protector-all -Wformat -Wformat-security -g
1313
LIBS=-pie -Wl,-z,relro,-z,now
1414

15-
# Can't use a '#' in the shell command
16-
VERSION=$(shell egrep '^.define VERSION' dnscat.c | head -n1 | cut -d\" -f2)
17-
18-
OS=$(shell uname -s)
19-
ARCH=$(shell uname -p | sed 's/x86_64/x64/i' | sed 's/i.86/x86/i')
20-
21-
ifeq ($(OS), Linux)
22-
RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(ARCH)"
23-
else
24-
RELEASE_FILENAME="dnscat2-$(VERSION)-client-$(OS)-$(ARCH)"
25-
endif
26-
2715
OBJS=controller/packet.o \
2816
controller/session.o \
2917
controller/controller.o \
@@ -58,11 +46,7 @@ debug: dnscat
5846
@echo "*** Debug build complete"
5947

6048
release: CFLAGS += ${RELEASE_CFLAGS}
61-
release: clean dnscat
62-
strip dnscat
63-
tar -cjf ${RELEASE_FILENAME}.tar.bz2 dnscat
64-
@echo "*** Release compiled: `pwd`/${RELEASE_FILENAME}"
65-
@echo "*** By the way, did you update the version number in the server?"
49+
release: dnscat
6650

6751
nocrypto: CFLAGS += -DNO_ENCRYPTION
6852
nocrypto: all

‎client/controller/session.c

+12-8
Original file line numberDiff line numberDiff line change
@@ -261,19 +261,23 @@ static NBBOOL _handle_enc_before_init(session_t *session, packet_t *packet)
261261
exit(1);
262262
}
263263

264+
if(LOG_LEVEL_INFO >= log_get_min_console_level())
265+
encryptor_print(session->encryptor);
266+
264267
if(preshared_secret)
268+
{
265269
session->state = SESSION_STATE_BEFORE_AUTH;
270+
}
266271
else
272+
{
267273
session->state = SESSION_STATE_NEW;
268274

269-
if(LOG_LEVEL_INFO >= log_get_min_console_level())
270-
encryptor_print(session->encryptor);
271-
272-
printf("\n");
273-
printf("Encrypted session established! For added security, please verify the server also displays this string:\n");
274-
printf("\n");
275-
encryptor_print_sas(session->encryptor);
276-
printf("\n");
275+
printf("\n");
276+
printf("Encrypted session established! For added security, please verify the server also displays this string:\n");
277+
printf("\n");
278+
encryptor_print_sas(session->encryptor);
279+
printf("\n");
280+
}
277281

278282
return TRUE;
279283
}

‎doc/how_to_do_a_release.md

+22-24
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,28 @@ Release versions on Linux can be compiled using:
5050

5151
make release
5252

53-
It even zips them for you! Releases on other platforms (like Windows)
54-
require some manual work at the moment. Please try to follow my naming
55-
scheme:
56-
57-
* dnscat2-v0.02beta-client-win32.zip
58-
* dnscat2-v0.02beta-client-x64.tar.bz2
59-
* dnscat2-v0.02beta-client-x86.tar.bz2
60-
* dnscat2-v0.02beta-client-source.tar.bz2
61-
* dnscat2-v0.02beta-client-source.zip
62-
* dnscat2-v0.02beta-server.tar.bz2
63-
* dnscat2-v0.02beta-server.zip
64-
65-
For binaries, the binaries in the archive should be simply "dnscat".
66-
67-
For source, the full client or server directory should be named
68-
"dnscat2-client" or "dnscat2-server" and zipped:
69-
70-
mv client dnscat2-client
71-
tar -cvvjf dnscat2-v0.02beta-client-source.tar.bz2 dnscat2-client-source/
72-
zip -r dnscat2-v0.02beta-client-source.zip dnscat2-client-source/
73-
mv dnscat2-client client
74-
75-
I don't provide a zip of the client and server source together because
76-
that's just what you get on github. :)
53+
Source distros can be packaged using:
54+
55+
make source_release
56+
57+
It even zips them for you! They're put into the dist/ folder.
58+
59+
Releases on other platforms (like Windows) require some manual work at
60+
the moment. Please try to follow my naming scheme:
61+
62+
dnscat2-v0.04-client-source.tar.bz2
63+
dnscat2-v0.04-client-source.zip
64+
dnscat2-v0.04-client-win32.zip
65+
dnscat2-v0.04-client-x64.tar.bz2
66+
dnscat2-v0.04-client-x86.tar.bz2
67+
dnscat2-v0.04-server.tar.bz2
68+
dnscat2-v0.04-server.zip
69+
70+
For binaries, the binaries in the archive should be simply "dnscat" - no
71+
paths or anything like that.
72+
73+
FWIW, I don't provide a zip of the client and server source together
74+
because that's exactly just what you get on github. :)
7775

7876
## Sign and upload the release files
7977

‎server/tunnel_drivers/driver_dns.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ def initialize(parent_window, host, port, domains)
192192
@window.puts("the client anywhere with the following (--secret is optional):")
193193
@window.puts()
194194
domains.each do |domain|
195-
@window.puts(" ./dnscat2 --secret=#{Settings::GLOBAL.get('secret')} #{domain}")
195+
@window.puts(" ./dnscat --secret=#{Settings::GLOBAL.get('secret')} #{domain}")
196196
end
197197
@window.puts("")
198198
end
199199

200200
@window.puts("To talk directly to the server without a domain name, run:")
201201
@window.puts()
202-
@window.puts(" ./dnscat2 --dns server=x.x.x.x,port=#{port} --secret=#{Settings::GLOBAL.get('secret')}")
202+
@window.puts(" ./dnscat --dns server=x.x.x.x,port=#{port} --secret=#{Settings::GLOBAL.get('secret')}")
203203
@window.puts("")
204204
@window.puts("Of course, you have to figure out <server> yourself! Clients")
205205
@window.puts("will connect directly on UDP port #{port}.")

0 commit comments

Comments
 (0)
Failed to load comments.