Пример #1
0
        // Handle the downloading of files.
        private void HandleDownload(string host, string url, string urlParams, string urlParamsNoProtocol, string requestMethod, string userAgent, string program, string referer, byte[] bodyBytes)
        {
            string download = Settings.GetDownload(urlParamsNoProtocol);

            if (download != null)
            {
                string method = download.Split('=')[1];
                WebHelperMethods.ProcessDownload(method, host, url, urlParams, requestMethod, userAgent, program, referer, bodyBytes);
            }
        }
Пример #2
0
        // Handle forwarding a url to another.
        private string HandleForward(string url, string urlParamsNoProtocol, string forward, SessionEventArgs e)
        {
            string action = "Redirected";

            if (forward.StartsWith("method=")) // See WebHelperMethods for more information.
            {
                action = "Method (F)";         // Method Forwarding.
                string method = forward.Split('=')[1];
                e.Redirect(WebHelperMethods.ProcessForward(method, url, urlParamsNoProtocol));
            }
            else // Normal forwards.
            {
                e.Redirect("http://" + forward);
            }

            return(action);
        }
Пример #3
0
        private string HandleResponse(string url, string urlParamsNoProtocol, string response, SessionEventArgs e)
        {
            string action;

            if (url.EndsWith(":443"))
            {
                action = "Handshake";
            }
            else
            {
                if (response.StartsWith("file=")) // If you want to provide a response from a file, make sure the file is placd at rules/files folder.
                {
                    string filePath = Settings.GetRulesFilesPath() + response.Split('=')[1];
                    if (File.Exists(filePath))
                    {
                        action = "File";
                        e.Ok(File.ReadAllText(filePath));
                    }
                    else
                    {
                        action = "File (Missing)";
                    }
                }
                else if (response.StartsWith("method=")) // See WebHelperMethods for more information.
                {
                    action = "Method (R)";
                    string method = response.Split('=')[1];
                    e.Ok(WebHelperMethods.ProcessResponse(method, url, urlParamsNoProtocol));
                }
                else // Normal text response from respond.txt.
                {
                    action = "Text";
                    e.Ok(response);
                }
            }

            return(action);
        }