Skip to content

Commit

Permalink
Close #140
Browse files Browse the repository at this point in the history
  • Loading branch information
htnhan committed Feb 27, 2020
1 parent de6e00e commit 1ecc6f3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fakenet/listeners/HTTPListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def respond(self, req, meth, postdata=None):
class HTTPListener(object):

def taste(self, data, dport):
request_methods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE',

request_methods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE',
'OPTIONS', 'CONNECT', 'PATCH']

confidence = 1 if dport in [80, 443] else 0
Expand Down Expand Up @@ -305,10 +305,10 @@ def do_POST(self):

http_f.close()
else:
self.server.logger.error('Failed to write HTTP POST headers and data to %s.', http_filename)
self.server.logger.error('Failed to write HTTP POST headers and data to %s.', http_filename)

# Prepare response
if not self.doCustomResponse('GET', post_body):
if not self.doCustomResponse('POST', post_body):
# Get response type based on the requested path
response, response_type = self.get_response(self.path)

Expand Down Expand Up @@ -356,7 +356,7 @@ def get_response(self, path):
except Exception, e:
self.server.logger.error('Failed to open response file: %s', response_filename)
response_type = 'text/html'
else:
else:
response = f.read()
f.close()

Expand Down Expand Up @@ -397,7 +397,7 @@ def main():
"""
logging.basicConfig(format='%(asctime)s [%(name)15s] %(message)s', datefmt='%m/%d/%y %I:%M:%S %p', level=logging.DEBUG)

config = {'port': '8443', 'usessl': 'Yes', 'webroot': 'fakenet/defaultFiles' }

listener = HTTPListener(config)
Expand Down

0 comments on commit 1ecc6f3

Please sign in to comment.