From feddbbc3e81694537eee6bd04cb050a9edbc0958 Mon Sep 17 00:00:00 2001 From: Chris Truncer Date: Fri, 27 Feb 2015 15:48:27 -0500 Subject: [PATCH] Updating dns_resolved module --- protocols/clients/dns_resolved.py | 2 +- protocols/servers/dns_resolved.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/protocols/clients/dns_resolved.py b/protocols/clients/dns_resolved.py index 2e19497..1a88878 100644 --- a/protocols/clients/dns_resolved.py +++ b/protocols/clients/dns_resolved.py @@ -34,7 +34,7 @@ class Client: while (byte_reader < len(data_to_transmit) + self.length): encoded_data = base64.b64encode(data_to_transmit[byte_reader:byte_reader + self.length]) - encoded_data = encoded_data.replace("=", ".--") + encoded_data = encoded_data.replace("=", ".---") # calcalate total packets if ((len(data_to_transmit) % self.length) == 0): diff --git a/protocols/servers/dns_resolved.py b/protocols/servers/dns_resolved.py index 1d32134..2161aa4 100644 --- a/protocols/servers/dns_resolved.py +++ b/protocols/servers/dns_resolved.py @@ -25,8 +25,14 @@ class Server: if packet.haslayer(DNSQR): dnsqr_strings = repr(packet[DNSQR]) try: - incoming_data = base64.b64decode(dnsqr_strings.split('\'')[1].rstrip('.')) - print incoming_data + incoming_data = dnsqr_strings.split('\'')[1].rstrip('.') + number_equals = incoming_data.count('.--') + if '.---' in incoming_data: + encoded_data = incoming_data.split('.')[0] + "=" * number_equals + else: + encoded_data = incoming_data.split('.')[0] + + print encoded_data except TypeError: pass @@ -48,4 +54,4 @@ class Server: print "[*] DNS server started!" sniff(prn=self.customAction) - return + return \ No newline at end of file