Skip to content

Commit

Permalink
fix #14
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveYesland committed Sep 10, 2019
1 parent 3a994ce commit 9d92f53
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions IPRotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ def processHttpMessage(self, toolFlag, messageIsRequest, messageInfo):

#Modify the request host, host header, and path to point to the new API endpoint
#Should always use HTTPS because API Gateway only uses HTTPS
if (self.target_host.text == httpService.getHost()):
if ':' in self.target_host.text: #hacky fix for https://github.com/RhinoSecurityLabs/IPRotate_Burp_Extension/issues/14
host_no_port = self.target_host.text.split(':')[0]

else:
host_no_port = self.target_host.text

if (host_no_port == httpService.getHost()):
#Cycle through all the endpoints each request until then end of the list is reached
if self.currentEndpoint < len(self.allEndpoints)-1:
self.currentEndpoint += 1
Expand All @@ -238,8 +244,14 @@ def processHttpMessage(self, toolFlag, messageIsRequest, messageInfo):
new_headers = requestInfo.headers

#Update the path to point to the API Gateway path
req_head = new_headers[0]
new_headers[0] = re.sub(' \/'," /"+STAGE_NAME+"/",req_head)
req_head = new_headers[0]
#hacky fix for https://github.com/RhinoSecurityLabs/IPRotate_Burp_Extension/issues/14
if 'http://' in req_head or 'https://' in req_head:
cur_path = re.findall('https?:\/\/.*?\/(.*) ',req_head)[0]
new_headers[0] = re.sub(' (.*?) '," /"+STAGE_NAME+"/"+cur_path+" ",req_head)

else:
new_headers[0] = re.sub(' \/'," /"+STAGE_NAME+"/",req_head)

#Replace the Host header with the Gateway host
for header in new_headers:
Expand Down

0 comments on commit 9d92f53

Please sign in to comment.