/** * リクエストを送信し、レスポンスを受信する * * @param url URL * @param pCallBack コールバック */ public IEnumerator Fetch( string url, CallBackResponse pCallBack ) { WWW www = new WWW( url ); // レスポンスが返ってくるまで待つ while ( ! www.isDone ){ yield return www; } HttpResponseInfo info = new HttpResponseInfo(); MatchCollection mc = Regex.Matches( www.responseHeaders[ "STATUS" ], "[0-9]{3}" ); info.code = ( 0 == mc.Count ) ? 0 : Convert.ToInt32( mc[ 0 ].Value ); info.str = String.IsNullOrEmpty( www.error ) ? www.text : www.error; info.www = www; pCallBack( info ); }
private static void ValidateResponse(HttpClientRequest request) { Assert.IsNotNull(request.Response); //parse the response and validate it is correct HttpResponseInfo respInfo = new HttpResponseInfo(); respInfo.ProcessResponse(request.Response); Assert.AreEqual(200, respInfo.Status); //parse the response body XmlDocument dom; HtmlParserHelper.Parse(respInfo, out dom); XmlNode title = dom.SelectSingleNode("//title"); Assert.IsTrue(title.InnerText.Contains("Altoro Mutual: Online Banking Login")); }
private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, string tempFile, long?contentLength) { var responseInfo = new HttpResponseInfo { TempFilePath = tempFile, StatusCode = httpResponse.StatusCode, ContentType = httpResponse.ContentType, ContentLength = contentLength }; if (httpResponse.Headers != null) { SetHeaders(httpResponse.Headers, responseInfo); } return(responseInfo); }
private async Task CacheResponse(HttpResponseInfo response, string responseCachePath) { _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(responseCachePath)); using (var responseStream = response.Content) { var memoryStream = _memoryStreamProvider.CreateNew(); await responseStream.CopyToAsync(memoryStream).ConfigureAwait(false); memoryStream.Position = 0; using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true)) { await memoryStream.CopyToAsync(fileStream).ConfigureAwait(false); memoryStream.Position = 0; response.Content = memoryStream; } } }
public virtual T Get(string id) { string path = ""; if (String.IsNullOrWhiteSpace(id)) { path = String.Format("{0}/{1}", API_BASE_PATH, Path); } else { path = String.Format("{0}/{1}/{2}", API_BASE_PATH, Path, id); } HttpResponseInfo resp = SendRequest("GET", path, null); string jsonData = resp.ResponseBody.ToString(); JavaScriptSerializer ser = new JavaScriptSerializer(); ser.MaxJsonLength = 1024 * 1024 * 1024; return(ser.Deserialize <T>(jsonData)); }
private Response CreateResponse(HttpResponseInfo responseInfo) { Response response = new Response(); string body = responseInfo.Body; if (responseInfo.ContentType != null && responseInfo.ContentType.StartsWith(JsonMimeType, StringComparison.OrdinalIgnoreCase)) { response = Response.FromJson(body); } else { response.Value = body; } if (response.Value is string) { response.Value = ((string)response.Value).Replace("\r\n", "\n").Replace("\n", Environment.NewLine); } return(response); }
public bool ValidateResponse(HttpResponseInfo respInfo) { bool found = false; lock (_lock) { if (_curMutatedRequestList != null && _curTestJob != null) { string testResponse = null; if (respInfo != null) { testResponse = respInfo.ToString(); } if (!_tester.IsMultiValidationRule(_curTestJob.TestDef.Validation)) { found = _tester.ValidateSingleTest(_curWorkingRawRequest, "\r\nTesting proxy, original not available\r\n", new Uri(_curWorkingReqInfo.FullUrl), _curTestJob.ParameterName, _curEntityId, _curTestJob.TestDef, _curMutatedRawReq, testResponse); } else if (_curMutatedRequestList.Count > 1) { List <string> currentRequestTestResponseSet = null; if (!_curTestResponseCollection.TryGetValue(_currentReqIdx, out currentRequestTestResponseSet)) { currentRequestTestResponseSet = new List <string>(); _curTestResponseCollection.Add(_currentReqIdx, currentRequestTestResponseSet); } currentRequestTestResponseSet.Add(testResponse); if (_curTestResponseCollection[_currentReqIdx].Count == _curMutatedRequestList.Count) { found = _tester.ValidateTest(_curWorkingRawRequest, "\r\nTesting proxy, original not available\r\n", new Uri(_curWorkingReqInfo.FullUrl), _curTestJob.ParameterName, _curEntityId, _curTestJob.TestDef, _curMutatedRequestList, _curTestResponseCollection[_currentReqIdx]); } } } } return(found); }
private async Task <HttpResponseInfo> MakeHttpRequest(HttpRequestInfo requestInfo) { SendingRemoteHttpRequestEventArgs eventArgs = new SendingRemoteHttpRequestEventArgs(null, requestInfo.RequestBody); this.OnSendingRemoteHttpRequest(eventArgs); HttpMethod method = new HttpMethod(requestInfo.HttpMethod); HttpRequestMessage requestMessage = new HttpRequestMessage(method, requestInfo.FullUri); if (requestInfo.HttpMethod == CommandInfo.GetCommand) { CacheControlHeaderValue cacheControlHeader = new CacheControlHeaderValue(); cacheControlHeader.NoCache = true; requestMessage.Headers.CacheControl = cacheControlHeader; } if (requestInfo.HttpMethod == CommandInfo.PostCommand) { MediaTypeWithQualityHeaderValue acceptHeader = new MediaTypeWithQualityHeaderValue(JsonMimeType); acceptHeader.CharSet = Utf8CharsetType; requestMessage.Headers.Accept.Add(acceptHeader); byte[] bytes = Encoding.UTF8.GetBytes(eventArgs.RequestBody); requestMessage.Content = new ByteArrayContent(bytes, 0, bytes.Length); MediaTypeHeaderValue contentTypeHeader = new MediaTypeHeaderValue(JsonMimeType); contentTypeHeader.CharSet = Utf8CharsetType; requestMessage.Content.Headers.ContentType = contentTypeHeader; } HttpResponseMessage responseMessage = await this.client.SendAsync(requestMessage); HttpResponseInfo httpResponseInfo = new HttpResponseInfo(); httpResponseInfo.Body = await responseMessage.Content.ReadAsStringAsync(); httpResponseInfo.ContentType = responseMessage.Content.Headers.ContentType.ToString(); httpResponseInfo.StatusCode = responseMessage.StatusCode; return(httpResponseInfo); }
//[TestMethod] public void TestSendingMultiPartRequest() { TrafficViewer.Instance.NewTvf(); TrafficViewer.Instance.TrafficViewerFile.AddRequestResponse(Resources.MultipartRequest, "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n"); TrafficStoreProxy httpProxy = new TrafficStoreProxy(TrafficViewer.Instance.TrafficViewerFile); httpProxy.Start(); HttpRequestInfo reqInfo = new HttpRequestInfo(Resources.MultipartRequest); TrafficViewerHttpClient client = new TrafficViewerHttpClient(); client.SetProxySettings("127.0.0.1", httpProxy.Port, null); HttpResponseInfo respInfo = client.SendRequest(reqInfo); Assert.AreEqual(200, respInfo.Status); TrafficViewer.Instance.CloseTvf(false); }
private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, Stream content, long?contentLength, IDisposable disposable) { var responseInfo = new HttpResponseInfo(disposable) { Content = content, StatusCode = httpResponse.StatusCode, ContentType = httpResponse.ContentType, ContentLength = contentLength, ResponseUrl = httpResponse.ResponseUri.ToString() }; if (httpResponse.Headers != null) { SetHeaders(httpResponse.Headers, responseInfo); } return(responseInfo); }
/// <summary> /// Gets the TMDB settings. /// </summary> /// <returns>Task{TmdbSettingsResult}.</returns> internal async Task <TmdbSettingsResult> GetTmdbSettings(CancellationToken cancellationToken) { if (_tmdbSettings != null) { return(_tmdbSettings); } using (HttpResponseInfo response = await GetMovieDbResponse(new HttpRequestOptions { Url = string.Format(TmdbConfigUrl, TmdbUtils.ApiKey), CancellationToken = cancellationToken, AcceptHeader = TmdbUtils.AcceptHeader }).ConfigureAwait(false)) { using (Stream json = response.Content) { _tmdbSettings = await _jsonSerializer.DeserializeFromStreamAsync <TmdbSettingsResult>(json).ConfigureAwait(false); return(_tmdbSettings); } } }
/// <summary> /// Sends the specified request info /// </summary> /// <param name="source"></param> /// <param name="info"></param> private void SendRequest(ITrafficDataAccessor source, TVRequestInfo info) { byte[] reqBytes = source.LoadRequestData(info.Id); string updatedRequest = PatternTracker.Instance.UpdateRequest(Constants.DefaultEncoding.GetString(reqBytes)); HttpRequestInfo reqInfo = new HttpRequestInfo(updatedRequest); reqInfo.IsSecure = info.IsHttps; _sessionIdHelper.UpdateSessionIds(reqInfo, _prevRequest, _prevResponse); info.RequestTime = DateTime.Now; //save the request that will be sent source.SaveRequest(info.Id, Constants.DefaultEncoding.GetBytes(updatedRequest)); try { _prevResponse = _httpClient.SendRequest(reqInfo); _prevRequest = reqInfo; //save the request and response if (_prevResponse != null) { info.ResponseTime = DateTime.Now; PatternTracker.Instance.UpdatePatternValues(_prevResponse); source.SaveResponse(info.Id, _prevResponse.ToArray()); } else { source.SaveResponse(info.Id, Constants.DefaultEncoding.GetBytes(_communicationError)); } } catch (Exception ex) { SdkSettings.Instance.Logger.Log(TraceLevel.Error, "Error playing back request {0}", ex.Message); source.SaveResponse(info.Id, Constants.DefaultEncoding.GetBytes(Resources.CommunicationError)); } }
protected HttpResponseInfo MakeHttpRequest(HttpRequestInfo requestInfo) { var request = CreateHttpWebRequest(requestInfo); HttpResponseInfo responseInfo = new HttpResponseInfo(); HttpWebResponse webResponse = null; try { webResponse = request.GetResponse() as HttpWebResponse; } catch (WebException ex) { webResponse = ex.Response as HttpWebResponse; if (ex.Status == WebExceptionStatus.Timeout) { string timeoutMessage = "The HTTP request to the remote WebDriver server for URL {0} timed out after {1} seconds."; throw new WebDriverException(string.Format(CultureInfo.InvariantCulture, timeoutMessage, request.RequestUri.AbsoluteUri, ServerResponseTimeout.TotalSeconds), ex); } else if (ex.Response == null) { string nullResponseMessage = "A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL {0}. The status of the exception was {1}, and the message was: {2}"; throw new WebDriverException(string.Format(CultureInfo.InvariantCulture, nullResponseMessage, request.RequestUri.AbsoluteUri, ex.Status, ex.Message), ex); } } if (webResponse == null) { throw new WebDriverException("No response from server for url " + request.RequestUri.AbsoluteUri); } else { responseInfo.Body = GetTextOfWebResponse(webResponse); responseInfo.ContentType = webResponse.ContentType; responseInfo.StatusCode = webResponse.StatusCode; } return(responseInfo); }
private Task StartStreaming(HttpResponseInfo response, TaskCompletionSource <bool> openTaskCompletionSource, CancellationToken cancellationToken) { return(Task.Run(async() => { try { Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath); using (response) using (var stream = response.Content) using (var fileStream = new FileStream(TempFilePath, FileMode.Create, FileAccess.Write, FileShare.Read)) { await StreamHelper.CopyToAsync( stream, fileStream, IODefaults.CopyToBufferSize, () => Resolve(openTaskCompletionSource), cancellationToken).ConfigureAwait(false); } } catch (OperationCanceledException ex) { Logger.LogInformation("Copying of {0} to {1} was canceled", GetType().Name, TempFilePath); openTaskCompletionSource.TrySetException(ex); } catch (Exception ex) { Logger.LogError(ex, "Error copying live stream {0} to {1}.", GetType().Name, TempFilePath); openTaskCompletionSource.TrySetException(ex); } openTaskCompletionSource.TrySetResult(false); EnableStreamSharing = false; await DeleteTempFiles(new List <string> { TempFilePath }).ConfigureAwait(false); })); }
public HttpResponseInfo SendRequest(HttpRequestInfo requestInfo) { int idx = -1; TVRequestInfo currDataSourceInfo = null; byte[] response = null; while ((currDataSourceInfo = _mockSite.GetNext(ref idx)) != null) { if (String.Compare(currDataSourceInfo.RequestLine, requestInfo.RequestLine) == 0) { response = _mockSite.LoadResponseData(currDataSourceInfo.Id); break; } } HttpResponseInfo respInfo = null; if (response != null) { respInfo = new HttpResponseInfo(response); } return(respInfo); }
public string SendTest(string mutatedRequest, string host, int port, bool useSSL) { //do nothing _mutatedRequests.Add(mutatedRequest); if (mutatedRequest.Contains(PATH_TRAVERSAL)) { return(PATH_TRAVERSAL_RESPONSE); } HttpRequestInfo testReqInfo = new HttpRequestInfo(mutatedRequest); testReqInfo.Host = host; testReqInfo.Port = port; testReqInfo.IsSecure = useSSL; HttpResponseInfo respInfo = _httpClient.SendRequest(testReqInfo); if (respInfo != null) { return(respInfo.ToString()); } return(null); }
/// <summary> /// Calculates if the current response is different than the original response /// </summary> /// <param name="responseInfo"></param> /// <returns></returns> private bool IsDifferentThanOriginalResponse(HttpResponseInfo responseInfo) { bool isDifferent; if (!_trackingReqInfo.ResponseStatus.Equals(responseInfo.Status.ToString())) { isDifferent = true; } else if (ResponseLengthIsSignificantlyDifferent(responseInfo, _trackingReqInfo)) { isDifferent = true; } else //calculate response similarity { byte[] oldRespBytes = _dataStore.LoadResponseData(_trackingReqInfo.Id); string oldRespString = Constants.DefaultEncoding.GetString(oldRespBytes); double similarity = ASESimilarityAlgorithm.CalculateSimilarity(oldRespString, responseInfo.ToString()); isDifferent = similarity < 0.98; } return(isDifferent); }
private TVRequestInfo SaveRequest(string description, HttpRequestInfo reqInfo, bool isSecure, string testResponse, DateTime requestTime, DateTime responseTime, string validation) { TVRequestInfo newReqInfo = new TVRequestInfo(); newReqInfo.Description = description; newReqInfo.Validation = validation; newReqInfo.Host = reqInfo.Host; newReqInfo.ResponseStatus = HttpResponseInfo.GetResponseStatus(testResponse); newReqInfo.RequestTime = requestTime; newReqInfo.IsHttps = isSecure; newReqInfo.ThreadId = Utils.GetCurrentWin32ThreadId().ToString(); newReqInfo.RequestLine = reqInfo.RequestLine; int newId = _trafficFile.AddRequestInfo(newReqInfo); _trafficFile.SaveRequest(newId, Constants.DefaultEncoding.GetBytes(reqInfo.ToString(false))); if (!String.IsNullOrWhiteSpace(testResponse)) { _trafficFile.SaveResponse(newId, Constants.DefaultEncoding.GetBytes(testResponse)); newReqInfo.ResponseTime = responseTime; } return(newReqInfo); }
public void Test_HttpClient_ResponseBody_ChunkedResponse() { ByteArrayBuilder builder = new ByteArrayBuilder(); HttpRequestInfo reqInfo = new HttpRequestInfo("GET /chunked HTTP/1.1"); HttpResponseInfo respInfo = new HttpResponseInfo(Resources.ChunkedResponse); HttpRequestInfo receivedReqInfo; HttpResponseInfo receivedResponseInfo; SendTestRequestToMockProxy(reqInfo, respInfo, out receivedReqInfo, out receivedResponseInfo); Assert.IsNotNull(receivedResponseInfo); Assert.IsNull(receivedResponseInfo.Headers["Content-length"]); byte[] respBody = receivedResponseInfo.ResponseBody.ToArray(); Assert.IsNotNull(respBody); ValidateChunk("This is the data in the first chunk\r\n", receivedResponseInfo.ResponseBody.ReadChunk()); ValidateChunk("and this is the second one\r\n", receivedResponseInfo.ResponseBody.ReadChunk()); ValidateChunk("con", receivedResponseInfo.ResponseBody.ReadChunk()); ValidateChunk("sequence", receivedResponseInfo.ResponseBody.ReadChunk()); }
public HttpResponseInfo SendRequest(HttpRequestInfo request) { if (_skipHtmlEncoding) { request.Headers["Accept"] = "application/json;opt=no-html-encoding"; } bool isLogin = request.Path.Equals(LOGIN_PATH); if (String.IsNullOrWhiteSpace(_asmRestSettings.AscSessionId) && !isLogin) { Login(); } if (!isLogin) { SetSessionIds(request); } request.HostAndPort = _asmRestSettings.HostAndPort; request.IsSecure = true; IHttpClient client = GetHttpClient(); HttpResponseInfo respInfo = client.SendRequest(request); if (respInfo.Status == 401 && !isLogin) //session may have expired, relogin { Login(); SetSessionIds(request); //try again client = GetHttpClient(); respInfo = client.SendRequest(request); } return(respInfo); }
public void TestGETRequestToProxy() { TrafficViewerFile dataStore = new TrafficViewerFile(); TrafficViewerFile mockSite = new TrafficViewerFile(); string testRequest = "GET http://site.com/a HTTP/1.1\r\n"; string expectedResponseLine = "HTTP/1.1 200 OK"; mockSite.AddRequestResponse(testRequest, expectedResponseLine); MockProxy proxy = new MockProxy(dataStore, mockSite); proxy.Start(); IHttpClient httpClient = GetHttpClient(proxy.Port); HttpRequestInfo testRequestInfo = new HttpRequestInfo(testRequest); HttpResponseInfo respInfo = httpClient.SendRequest(testRequestInfo); Assert.AreEqual(200, respInfo.Status); proxy.Stop(); }
/// <summary> /// Writes a XML BLOB similar to /// <response status="200" isFrameset="false" isAttack="false" analyzed="false" parsed="true" errorText="" contentType="HTML" headersBuildable="true" bodyBuildable="false" xmlType="XML" japEncoding="2"> /// <body encodeValue="true" value="DQoNCjwhRE9DVFlQRSBodG1sIFBVQkxJQyAiLS8vVzNDLy9EVEQgWEhUTUwgMS4wIFRyYW5zaXRpb25hbC8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9UUi94aHRtbDEvRFREL3hodG1sMS10cmFuc2l0aW9uYWwuZHRkIj4NCg0KPGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiIHhtbDpsYW5nPSJlbiIgPg0KPGhlYWQgaWQ9Il9jdGwwX19jdGwwX2hlYWQiPjx0aXRsZT4NCglBbHRvcm8gTXV0dWFsDQo8L3RpdGxlPjxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PWlzby04ODU5LTEiPjxsaW5rIGhyZWY9InN0eWxlLmNzcyIgc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ICAgICBub3QgYXNzdW1lIGFueSByaXNrIGluIHJlbGF0aW9uIHRvIHlvdXIgdXNlIG9mIHRoaXMgd2Vic2l0ZS4gRm9yIGFkZGl0aW9uYWwgVGVybXMgb2YgVXNlLA0KICAgICAgICBwbGVhc2UgZ28gdG8gPGEgaWQ9Il9jdGwwX19jdGwwX0h5cGVyTGluazciIGhyZWY9Imh0dHA6Ly93d3cud2F0Y2hmaXJlLmNvbS9zdGF0ZW1lbnRzL3Rlcm1zLmFzcHgiPmh0dHA6Ly93d3cud2F0Y2hmaXJlLmNvbS9zdGF0ZW1lbnRzL3Rlcm1zLmFzcHg8L2E+LjxiciAvPjxiciAvPg0KDQogICAgICAgIENvcHlyaWdodCAmY29weTsgMjAwOSwgV2F0Y2hmaXJlIENvcnBvcmF0aW9uLCBBbGwgcmlnaHRzIHJlc2VydmVkLg0KICAgIDwvZGl2Pg0KPC9kaXY+DQoNCjwvYm9keT4NCjwvaHRtbD4=" /> /// <header name="Date" value="Thu, 28 May 2009 19:36:29 GMT" /> /// <header name="Server" value="Microsoft-IIS/6.0" /> /// <header name="X-Powered-By" value="ASP.NET" /> /// <header name="X-AspNet-Version" value="2.0.50727" /> /// <header name="Set-Cookie" value="ASP.NET_SessionId=n0gzurjs2dtehryqs20ypb55; path=/; HttpOnly" /> /// <header name="Set-Cookie" value="amSessionId=143629170095; path=/" /> /// <header name="Cache-Control" value="no-cache" /> /// <header name="Pragma" value="no-cache" /> /// <header name="Expires" value="-1" /> /// <header name="Content-Type" value="text/html; charset=utf-8" /> /// <header name="Content-Length" value="9605" /> /// <cookie name="ASP.NET_SessionId" value="n0gzurjs2dtehryqs20ypb55" /> /// <cookie name="amSessionId" value="143629170095" /> /// </response> /// </summary> /// <param name="writer"></param> /// <param name="respInfo"></param> protected virtual void WriteResponse(XmlWriter writer, HttpResponseInfo respInfo) { writer.WriteStartElement("response"); writer.WriteAttributeString("status", respInfo.Status.ToString()); writer.WriteAttributeString("isFrameset", "false"); writer.WriteAttributeString("isAttack", "false"); writer.WriteAttributeString("analyzed", "false"); writer.WriteAttributeString("parsed", "true"); writer.WriteAttributeString("errorText", ""); writer.WriteAttributeString("contentType", respInfo.Headers["Content-Type"]); writer.WriteAttributeString("headersBuildable", "true"); writer.WriteAttributeString("bodyBuildable", "false"); writer.WriteAttributeString("xmlType", "XML"); writer.WriteAttributeString("japEncoding", "2"); //write body writer.WriteStartElement("body"); //writer.WriteAttributeString("encodeValue", "true"); writer.WriteAttributeString(" compressedBinaryValue", "true"); writer.WriteAttributeString(" compressedBinary", "true"); byte[] respBodyBytes = respInfo.ResponseBody.ToArray(); writer.WriteAttributeString("value", Utils.CompressToBase64String(respBodyBytes??new byte[0])); writer.WriteEndElement(); //write headers WriteHeaders(writer, "", -1, respInfo.Headers); //end response writer.WriteEndElement(); }
private async Task CacheResponse(HttpResponseInfo response, string responseCachePath) { _fileSystem.CreateDirectory(Path.GetDirectoryName(responseCachePath)); using (var responseStream = response.Content) { using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, true)) { var memoryStream = new MemoryStream(); await responseStream.CopyToAsync(memoryStream).ConfigureAwait(false); memoryStream.Position = 0; await memoryStream.CopyToAsync(fileStream).ConfigureAwait(false); memoryStream.Position = 0; response.Content = memoryStream; } } }
private void AddASERequest(XmlNode url) { XmlNode requestNode = url.SelectSingleNode("option[@enum='esCOTExploreRequest']"); XmlNode responseNode = url.SelectSingleNode("option[@enum='esCOTExploreResponse']"); XmlNode requestTypeNode = url.SelectSingleNode("option[@enum='elCOTExploreType']"); XmlNode responseHeaderNode = url.SelectSingleNode("option[@enum='esCOTExploreResponseHeader']"); ExploreType requestType = (ExploreType)int.Parse(requestTypeNode.Attributes["value"].Value); string description = String.Empty; switch (requestType) { case ExploreType.eETLogin: description = Resources.RecordedLoginPage; break; case ExploreType.eETRegularInSession: description = Resources.InSessionPage; break; case ExploreType.eETRegular: description = Resources.ManualExplore; break; } string request = requestNode.Attributes["value"].Value; request = Utils.Base64Decode(request); HttpRequestInfo reqInfo = new HttpRequestInfo(request); TVRequestInfo tvInfo = new TVRequestInfo(); tvInfo.RequestLine = reqInfo.RequestLine; tvInfo.ThreadId = Resources.Settings; tvInfo.Description = description; RequestResponseBytes data = new RequestResponseBytes(); data.AddToRequest(request); if (responseHeaderNode != null && responseHeaderNode.Attributes["value"] != null) { data.AddToResponse(responseHeaderNode.Attributes["value"].Value + Environment.NewLine); } byte[] response = Convert.FromBase64String(responseNode.Attributes["value"].Value); response = Utils.DecompressData(response); response = Encoding.Convert(Encoding.Unicode, Constants.DefaultEncoding, response); data.AddToResponse(response); //attempt to parse the response try { HttpResponseInfo respInfo = new HttpResponseInfo(); respInfo.ProcessResponse(data.RawResponse); tvInfo.ResponseStatus = respInfo.Status.ToString(); } catch { tvInfo.ResponseStatus = "???"; } _tvFile.AddRequestInfo(tvInfo); _tvFile.SaveRequest(tvInfo.Id, data); _tvFile.SaveResponse(tvInfo.Id, data); }
private void OnServicesReceived(HttpResponseInfo response) { int abortCount = 0; int bytesRead = 0; byte[] buffer = new byte[10240]; StringBuilder servicesXml = new StringBuilder(); XmlDocument xmldoc = new XmlDocument(); using (var s = response.Content) { if (response.StatusCode != HttpStatusCode.OK) { _logger.Debug("{0}: Couldn't get services list: {1}", HostEndPoint, response.StatusCode); return; // FIXME: This the best thing to do?? } while (true) { bytesRead = s.Read(buffer, 0, buffer.Length); servicesXml.Append(Encoding.UTF8.GetString(buffer, 0, bytesRead)); try { xmldoc.LoadXml(servicesXml.ToString()); break; } catch (XmlException) { // If we can't receive the entire XML within 500ms, then drop the connection // Unfortunately not all routers supply a valid ContentLength (mine doesn't) // so this hack is needed to keep testing our recieved data until it gets successfully // parsed by the xmldoc. Without this, the code will never pick up my router. if (abortCount++ > 50) { return; } _logger.Debug("{0}: Couldn't parse services list", HostEndPoint); System.Threading.Thread.Sleep(10); } } _logger.Debug("{0}: Parsed services list", HostEndPoint); XmlNamespaceManager ns = new XmlNamespaceManager(xmldoc.NameTable); ns.AddNamespace("ns", "urn:schemas-upnp-org:device-1-0"); XmlNodeList nodes = xmldoc.SelectNodes("//*/ns:serviceList", ns); foreach (XmlNode node in nodes) { //Go through each service there foreach (XmlNode service in node.ChildNodes) { //If the service is a WANIPConnection, then we have what we want string type = service["serviceType"].InnerText; _logger.Debug("{0}: Found service: {1}", HostEndPoint, type); StringComparison c = StringComparison.OrdinalIgnoreCase; // TODO: Add support for version 2 of UPnP. if (type.Equals("urn:schemas-upnp-org:service:WANPPPConnection:1", c) || type.Equals("urn:schemas-upnp-org:service:WANIPConnection:1", c)) { this.controlUrl = service["controlURL"].InnerText; _logger.Debug("{0}: Found upnp service at: {1}", HostEndPoint, controlUrl); try { Uri u = new Uri(controlUrl); if (u.IsAbsoluteUri) { EndPoint old = hostEndPoint; this.hostEndPoint = new IPEndPoint(IPAddress.Parse(u.Host), u.Port); _logger.Debug("{0}: Absolute URI detected. Host address is now: {1}", old, HostEndPoint); this.controlUrl = controlUrl.Substring(u.GetLeftPart(UriPartial.Authority).Length); _logger.Debug("{0}: New control url: {1}", HostEndPoint, controlUrl); } } catch { _logger.Debug("{0}: Assuming control Uri is relative: {1}", HostEndPoint, controlUrl); } _logger.Debug("{0}: Handshake Complete", HostEndPoint); return; } } } //If we get here, it means that we didn't get WANIPConnection service, which means no uPnP forwarding //So we don't invoke the callback, so this device is never added to our lists } }
public void TestGetAltoroNonChunkedResponseWithChunkedHeader() { HttpResponseInfo respInfo = new HttpResponseInfo(Resources.AltoroDifChunkedResponse); Assert.AreNotEqual(0, respInfo.ResponseBody.Length); }
public void TestGetResponseStatusFromEmptyBytes() { Assert.AreEqual(String.Empty, HttpResponseInfo.GetResponseStatus(Encoding.UTF8.GetBytes(String.Empty))); }
public void TestGetResponseStatusFromBytes() { Assert.AreEqual("200", HttpResponseInfo.GetResponseStatus(Encoding.UTF8.GetBytes("HTTP/1.1 200 OK"))); }
public void TestGetResponseStatus() { Assert.AreEqual("200", HttpResponseInfo.GetResponseStatus("HTTP/1.1 200 OK")); }
private HttpResponseInfo MakeHttpRequest(HttpRequestInfo requestInfo) { HttpWebRequest request = HttpWebRequest.Create(requestInfo.FullUri) as HttpWebRequest; if (!string.IsNullOrEmpty(requestInfo.FullUri.UserInfo) && requestInfo.FullUri.UserInfo.Contains(":")) { string[] userInfo = this.remoteServerUri.UserInfo.Split(new char[] { ':' }, 2); request.Credentials = new NetworkCredential(userInfo[0], userInfo[1]); request.PreAuthenticate = true; } string userAgentString = string.Format(CultureInfo.InvariantCulture, UserAgentHeaderTemplate, ResourceUtilities.AssemblyVersion, ResourceUtilities.PlatformFamily); request.UserAgent = userAgentString; request.Method = requestInfo.HttpMethod; request.Timeout = (int)this.serverResponseTimeout.TotalMilliseconds; request.Accept = RequestAcceptHeader; request.KeepAlive = this.enableKeepAlive; request.Proxy = this.proxy; request.ServicePoint.ConnectionLimit = 2000; if (request.Method == CommandInfo.GetCommand) { request.Headers.Add("Cache-Control", "no-cache"); } SendingRemoteHttpRequestEventArgs eventArgs = new SendingRemoteHttpRequestEventArgs(request, requestInfo.RequestBody); this.OnSendingRemoteHttpRequest(eventArgs); if (request.Method == CommandInfo.PostCommand) { string payload = eventArgs.RequestBody; byte[] data = Encoding.UTF8.GetBytes(payload); request.ContentType = ContentTypeHeader; Stream requestStream = request.GetRequestStream(); requestStream.Write(data, 0, data.Length); requestStream.Close(); } HttpResponseInfo responseInfo = new HttpResponseInfo(); HttpWebResponse webResponse = null; try { webResponse = request.GetResponse() as HttpWebResponse; } catch (WebException ex) { webResponse = ex.Response as HttpWebResponse; if (ex.Status == WebExceptionStatus.Timeout) { string timeoutMessage = "The HTTP request to the remote WebDriver server for URL {0} timed out after {1} seconds."; throw new WebDriverException(string.Format(CultureInfo.InvariantCulture, timeoutMessage, request.RequestUri.AbsoluteUri, this.serverResponseTimeout.TotalSeconds), ex); } else if (ex.Response == null) { string nullResponseMessage = "A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL {0}. The status of the exception was {1}, and the message was: {2}"; throw new WebDriverException(string.Format(CultureInfo.InvariantCulture, nullResponseMessage, request.RequestUri.AbsoluteUri, ex.Status, ex.Message), ex); } } if (webResponse == null) { throw new WebDriverException("No response from server for url " + request.RequestUri.AbsoluteUri); } else { responseInfo.Body = GetTextOfWebResponse(webResponse); responseInfo.ContentType = webResponse.ContentType; responseInfo.StatusCode = webResponse.StatusCode; } return(responseInfo); }
private void RequestHandlerThread() { while (IsListening) { HttpRequestInfo reqInfo = null; HttpResponseInfo respInfo = null; int thisThreadRequestIndex = -1; lock (_lock) { reqInfo = null; if (_requestsToTest.Count > 0) { thisThreadRequestIndex = _requestsToTest.Dequeue(); _currentTestReqIdx = thisThreadRequestIndex; reqInfo = _requestIndex[thisThreadRequestIndex]; respInfo = _responseIndex[thisThreadRequestIndex]; } } if (reqInfo != null) { bool isSecure = reqInfo.IsSecure; string rawRequest = reqInfo.ToString(); string rawResponse = respInfo != null?respInfo.ToString() : String.Empty; if (ShouldBeTested(rawRequest)) { //parse parameters reqInfo = new HttpRequestInfo(rawRequest, true); reqInfo.IsSecure = isSecure; int hash = reqInfo.GetHashCode(TrafficServerMode.IgnoreCookies); lock (_lock) { if (_testedRequestHashes.Contains(hash)) { HttpServerConsole.Instance.WriteLine(LogMessageType.Warning, "Request already tested: '{0}'", reqInfo.FullUrl); continue; //we tested this request before } else { _testedRequestHashes.Add(hash); } } Uri reqUri = new Uri(reqInfo.FullUrl); MultiThreadedTestExecution testExecution = new MultiThreadedTestExecution(_tester, rawRequest, rawResponse, reqUri, _numThreads); lock (_lock) { GenerateEntities(thisThreadRequestIndex, reqInfo); testExecution.TestsQueue = _workList[thisThreadRequestIndex]; } testExecution.StartTestsAsync(); while (testExecution.IsRunning) { if (!IsListening) { testExecution.CancelTests(); break; } HttpServerConsole.Instance.WriteLine(LogMessageType.Notification, "Requests in queue: {0}, Tests in queue for current request: {1}, testing with {2} threads.", _requestsToTest.Count, testExecution.TestsQueue.Count, _numThreads); Thread.Sleep(1000); } HttpServerConsole.Instance.WriteLine(LogMessageType.Notification, "Test execution completed."); } } Thread.Sleep(10); } HttpServerConsole.Instance.WriteLine(LogMessageType.Notification, "Drive by Attack Proxy stopped."); }
public StaticRemoteStreamWriter(HttpResponseInfo response) { _response = response; }