|
|
@ -71,13 +71,6 @@ class FileResolver(BaseResolver):
|
|
|
|
reply.add_answer(RR(name, QTYPE.TXT, ttl=self.ttl, rdata=TXT("Domain not found")))
|
|
|
|
reply.add_answer(RR(name, QTYPE.TXT, ttl=self.ttl, rdata=TXT("Domain not found")))
|
|
|
|
return reply
|
|
|
|
return reply
|
|
|
|
|
|
|
|
|
|
|
|
# Request method for uploads
|
|
|
|
|
|
|
|
if qry_type == "SRV":
|
|
|
|
|
|
|
|
with open('/tmp/dns-srv.log', 'a') as f:
|
|
|
|
|
|
|
|
f.write(str(name.stripSuffix("." + self.domain)) + "\n")
|
|
|
|
|
|
|
|
reply.add_answer(RR(name, QTYPE.SRV, ttl=self.ttl, rdata=TXT("accepted")))
|
|
|
|
|
|
|
|
return reply
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Request method for downloads
|
|
|
|
# Request method for downloads
|
|
|
|
if qry_type == "TXT":
|
|
|
|
if qry_type == "TXT":
|
|
|
|
# Format is filename.count.domain for count
|
|
|
|
# Format is filename.count.domain for count
|
|
|
@ -91,10 +84,11 @@ class FileResolver(BaseResolver):
|
|
|
|
pname = '.'.join(parts[:-2])
|
|
|
|
pname = '.'.join(parts[:-2])
|
|
|
|
path = self.directory + "/" + pname
|
|
|
|
path = self.directory + "/" + pname
|
|
|
|
command = ''.join(parts[-2:-1])
|
|
|
|
command = ''.join(parts[-2:-1])
|
|
|
|
|
|
|
|
# TODO: circumvent caching, eg by counting up
|
|
|
|
if command == "u":
|
|
|
|
if command == "u":
|
|
|
|
with open('/tmp/dns-srv.log', 'a') as f:
|
|
|
|
with open('/tmp/dns-srv.log', 'a') as f:
|
|
|
|
f.write(str(name.stripSuffix("." + self.domain)) + "\n")
|
|
|
|
f.write(str(pname) + "\n")
|
|
|
|
reply.add_answer(RR(name, QTYPE.SRV, ttl=self.ttl, rdata=TXT("accepted")))
|
|
|
|
reply.add_answer(RR(name, QTYPE.TXT, ttl=self.ttl, rdata=TXT("Upload accepted")))
|
|
|
|
return reply
|
|
|
|
return reply
|
|
|
|
if not os.path.isfile(path):
|
|
|
|
if not os.path.isfile(path):
|
|
|
|
reply.add_answer(RR(name, QTYPE.TXT, ttl=self.ttl, rdata=TXT("File not found")))
|
|
|
|
reply.add_answer(RR(name, QTYPE.TXT, ttl=self.ttl, rdata=TXT("File not found")))
|
|
|
|