Skip to content

Commit

Permalink
Update web_request_socket.py
Browse files Browse the repository at this point in the history
  • Loading branch information
irsdl committed Jun 20, 2018
1 parent 1e3bc48 commit 145cded
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Generic Codes/web_request_socket.py
Expand Up @@ -167,6 +167,7 @@ def RequestObjectsToHTTPPipeline(RequestObjects):
#CRLF + "connection: close" + CRLF + CRLF #CRLF + "connection: close" + CRLF + CRLF
return result return result


# TEST CODE #
def HTTPPipelineTest(): def HTTPPipelineTest():
result = False result = False
testReq1 = RequestObject('OPTIONS', 'https://0me.me/calc.php?a=2222&b=2','', testReq1 = RequestObject('OPTIONS', 'https://0me.me/calc.php?a=2222&b=2','',
Expand All @@ -185,13 +186,22 @@ def HTTPPipelineTest():


try: try:
reqResult = SendHTTPRequestBySocket(pipelineResult, testReq1.targetName, testReq1.targetPort, testReq1.isSSL, 20) reqResult = SendHTTPRequestBySocket(pipelineResult, testReq1.targetName, testReq1.targetPort, testReq1.isSSL, 20)
#reqResult = SendHTTPRequestBySocket(pipelineResult, 'localhost', 8081, False, 5)
except: except:
reqResult = '' reqResult = ''
#print reqResult #print reqResult
if reqResult.find('4444') > 0 and reqResult.find('9999') > 0: if reqResult.find('4444') > 0 and reqResult.find('9999') > 0:
result = True result = True
return result return result


def AnotherPipelineExample():
req1 = RequestObject('GET', 'http://asitename.com:8080/sum.jsp?a=1&b=1&c=2&d=2')
req2 = RequestObject('POST', 'http://asitename.com:8080/sum.jsp?a=3&b=3', 'c=4&d=4',
{'Content-Type': 'application/x-www-form-urlencoded'}, autoContentLength=True,
HTTPVersion="HTTP/1.0")
req3 = RequestObject('POST', 'http://asitename.com:8080/sum.jsp?a=5&b=5', 'c=6&d=6',
{'Content-Type': 'application/x-www-form-urlencoded'}, autoContentLength=True)
joinedReqs = [req1, req2, req3]
pipelineResult = RequestObjectsToHTTPPipeline(joinedReqs)
print SendHTTPRequestBySocket(pipelineResult, req1.targetName, req1.targetPort)




0 comments on commit 145cded

Please sign in to comment.