Example #1
0
 public bool DoesMatchResponseInterceptionRules(Session Sess)
 {
     if (Sess.Response == null)
     {
         return(false);
     }
     else
     {
         return(IronProxy.CanInterceptBasedOnFilter(Sess.Request, Sess.Response));
     }
 }
        private void ProxyListenPortTB_TextChanged(object sender, EventArgs e)
        {
            int PortNumber = 0;

            if (IronProxy.ValidProxyPort(ProxyListenPortTB.Text))
            {
                PortNumber = Int32.Parse(ProxyListenPortTB.Text);
                ProxyListenPortTB.BackColor = Color.White;
            }
            else
            {
                ProxyListenPortTB.BackColor = Color.Red;
            }
        }
Example #3
0
        internal static void StartLogsImportFromIronwaspProjectFile(object ProjectDir)
        {
            IronProxy.Stop();
            DirectoryInfo Di         = new DirectoryInfo(ProjectDir.ToString());
            string        NewDirName = string.Format("{0}\\ImportedFrom{1}", Di.Parent.FullName, Di.Name);
            int           Counter    = 0;

            while (Directory.Exists(NewDirName))
            {
                Counter++;
                NewDirName = string.Format("{0}\\ImportedFrom{1}_{2}", Di.Parent.FullName, Di.Name, Counter);
            }
            Directory.CreateDirectory(NewDirName);
            IronDB.UpdateLogFilePaths(NewDirName);
            IronDB.CreateNewLogFiles();
            //Proxy.ironlog
            //Probes.ironlog
            File.Copy(string.Format("{0}\\Proxy.ironlog", ProjectDir), string.Format("{0}\\Proxy.ironlog", NewDirName), true);
            File.Copy(string.Format("{0}\\Probes.ironlog", ProjectDir), string.Format("{0}\\Probes.ironlog", NewDirName), true);
            IronUI.StartUpdatingFullUIFromDB();
        }
        private void StartBtn_Click(object sender, EventArgs e)
        {
            int ProxyPortNumber = 0;

            if (Int32.TryParse(ProxyListenPortTB.Text.Trim(), out ProxyPortNumber))
            {
                if (!(ProxyPortNumber > 0 && ProxyPortNumber < 65536))
                {
                    ShowMessage("Invalid Proxy port number. Enter a value between 1 and 65535", true);
                    return;
                }
            }
            else
            {
                ShowMessage("Invalid Proxy port number. Enter a value between 1 and 65535", true);
                return;
            }
            IronProxy.Port = ProxyPortNumber;


            string UpstreamProxyIP   = "";
            int    UpstreamProxyPort = 0;


            if (AcceptRemoteYesRB.Checked)
            {
                IronProxy.LoopBackOnly = false;
            }
            else
            {
                IronProxy.LoopBackOnly = true;
            }

            if (SetAsSystemProxyYesRB.Checked)
            {
                IronProxy.SystemProxy = true;
            }
            else
            {
                IronProxy.SystemProxy = false;
            }

            if (UseBrowserUpstreamRB.Checked)
            {
                IronProxy.UseSystemProxyAsUpStreamProxy = true;
                IronProxy.UseUpstreamProxy = false;
            }
            else if (UseCustomUpstreamProxyRB.Checked)
            {
                IronProxy.UseUpstreamProxy = true;
                IronProxy.UseSystemProxyAsUpStreamProxy = false;

                if (UpstreamProxyIPTB.Text.Trim().Length > 0)
                {
                    UpstreamProxyIP = UpstreamProxyIPTB.Text.Trim();
                }
                else
                {
                    ShowMessage("The IP address/hostname of the Upstream proxy server is empty. Please enter an IP address or unselect the option to use an custom upstream proxy.", true);
                    return;
                }
                if (Int32.TryParse(UpstreamProxyPortTB.Text, out UpstreamProxyPort))
                {
                    if (!(UpstreamProxyPort > 0 && UpstreamProxyPort < 65536))
                    {
                        ShowMessage("Invalid Upstream Proxy port number. Enter a value between 1 and 65535", true);
                        return;
                    }
                }
                else
                {
                    ShowMessage("Invalid Upstream Proxy port number. Enter a value between 1 and 65535", true);
                    return;
                }
                IronProxy.UpstreamProxyIP   = UpstreamProxyIP;
                IronProxy.UpstreamProxyPort = UpstreamProxyPort;
            }
            else
            {
                IronProxy.UseUpstreamProxy = false;
                IronProxy.UseSystemProxyAsUpStreamProxy = false;
            }
            if (IronProxy.Start())
            {
                IronDB.StoreProxyConfig();
                IronDB.StoreUpstreamProxyConfig();
                IronUI.UpdateProxyStatusInConfigPanel(true);
                IronUI.SetProxyLoopbackLabel();
                IronUI.SetProxyPortLabel();
                this.Close();
            }
            else
            {
                if (ProxyPortNumber > 1024)
                {
                    ShowMessage(string.Format("Unable to start the IronWASP proxy on port {0}. \r\nThis could be happening because there is another service listening on the same port. \r\nPlease choose some other port and try again.", ProxyPortNumber), true);
                }
                else
                {
                    ShowMessage(string.Format("Unable to start the IronWASP proxy on port {0}. \r\nThis could be happening because IronWASP does not have administrative privileges. \r\nTo listen on ports from 1 to 1024 IronWASP must be started with Administrative privileges. \r\nYou can either do that or pick a port above 1024 for the proxy. \r\nIf you still have this problem then it could be because there is another service listening on the same port. Please choose some other port and try again.", ProxyPortNumber), true);
                }
            }
        }
Example #5
0
 public bool DoesMatchRequestInterceptionRules(Session Sess)
 {
     return(IronProxy.CanInterceptBasedOnFilter(Sess.Request));
 }