Added Host File

dev
Rahmat Nurfauzi 2018-06-06 07:51:36 +07:00 committed by GitHub
parent d50a4793ae
commit 2a14ca1d3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -110,6 +110,11 @@ class Listener:
'Required' : True,
'Value' : 'CF-RAY'
},
'HostPath' : {
'Description' : 'Directory path for hosting files.',
'Required' : False,
'Value' : ''
},
'Headers' : {
'Description' : 'Headers for the control server.',
'Required' : True,
@ -709,6 +714,18 @@ class Listener:
except Exception as e:
routingPacket = None
# handler hosting file
static_dir = self.options['HostPath']['Value']
if static_dir != '':
# make dynamic request uri
host_file = request_uri.split('/')[-1]
packages = static_dir + host_file
# host a packages file, will return valid file if exist
if os.path.isfile(packages) and os.path.exists(packages):
return send_from_directory(static_dir, host_file)
if routingPacket:
# parse the routing packet and process the results
dataResults = self.mainMenu.agents.handle_agent_data(stagingKey, routingPacket, listenerOptions, clientIP)