Exemple #1
0
 private CANAPEProject()
 {
     _documents     = new Dictionary <string, IDocumentObject>();
     _properties    = new Dictionary <string, string>();
     _defaultClient = new IpProxyClientFactory();
     _globalMeta    = new MetaDictionary();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public GenericProxyDocument()
     : base()
 {
     _port = 1080;
     _filters = new ProxyFilterFactory[0];
     _clientFactory = new DefaultProxyClientFactory();
 }
Exemple #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GenericProxyDocument()
     : base()
 {
     _port          = 1080;
     _filters       = new ProxyFilterFactory[0];
     _clientFactory = new DefaultProxyClientFactory();
 }
Exemple #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public NetClientDocument()
        {
            _clientFactory = new DefaultProxyClientFactory();
            _layers = new INetworkLayerFactory[0];

            _port = 12345;
            _destination = "127.0.0.1";
        }
Exemple #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public NetClientDocument()
        {
            _clientFactory = new DefaultProxyClientFactory();
            _layers        = new INetworkLayerFactory[0];

            _port        = 12345;
            _destination = "127.0.0.1";
        }
Exemple #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 public FixedProxyDocument()
     : base()
 {
     _localPort     = 10000;
     _port          = 12345;
     _host          = "127.0.0.1";
     _udp           = false;
     _clientFactory = new DefaultProxyClientFactory();
     _layers        = new INetworkLayerFactory[0];
     _sslConfig     = null;
 }
Exemple #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 public FixedProxyDocument()
     : base()
 {
     _localPort = 10000;
     _port = 12345;
     _host = "127.0.0.1";
     _udp = false;
     _clientFactory = new DefaultProxyClientFactory();
     _layers = new INetworkLayerFactory[0];
     _sslConfig = null;
 }
Exemple #8
0
        private void NewDocument(bool fromTemplate)
        {
            if (!CheckDirtyFlag())
            {
                CANAPETemplate template = null;

                if (fromTemplate)
                {
                    using (SelectProjectTemplateForm frm = new SelectProjectTemplateForm())
                    {
                        if (frm.ShowDialog(this) == DialogResult.OK)
                        {
                            template = frm.Template;
                        }
                    }
                }

                CANAPEProject.New();
                InitializeTree();
                SetTitle(null);

                if (template != null)
                {
                    try
                    {
                        // Allow insecure load, if someone has added a template they could just add a plugin
                        CANAPEProject.Load(template.GetStream(), null, true, false);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, Properties.Resources.MessageBox_ErrorString,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                IProxyClientFactory client = (IProxyClientFactory)GeneralUtils.StringToObject(Properties.Settings.Default.ProxyClient);
                if (client != null)
                {
                    try
                    {
                        CANAPEProject.CurrentProject.DefaultProxyClient = client;
                    }
                    catch (ArgumentException)
                    {
                        CANAPEProject.CurrentProject.DefaultProxyClient = new IpProxyClientFactory();
                    }
                }

                OnProjectChanged();
            }
        }
Exemple #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        private void UpdateClient(IProxyClientFactory client)
        {
            _inupdate = true;

            if ((client is DefaultProxyClientFactory) && (!HideDefault))
            {
                radioDefault.Checked = true;
            }
            else if ((client is IpProxyClientFactory) || (client is DefaultProxyClientFactory))
            {
                radioDirect.Checked = true;
            }
            else if (client is TcpProxyClientFactory)
            {
                TcpProxyClientFactory c = (TcpProxyClientFactory)client;
                radioProxy.Checked = true;

                textBoxHost.Text        = c.Hostname;
                numericUpDownPort.Value = c.Port;
                checkBoxIpv6.Checked    = c.IPv6;

                if (client is HttpProxyClientFactory)
                {
                    radioHttp.Checked = true;
                }
                else
                {
                    SocksProxyClientFactory socks = (SocksProxyClientFactory)client;
                    if (socks.Version4)
                    {
                        radioSocksv4.Checked = true;
                    }
                    else
                    {
                        radioSocksv5.Checked = true;
                    }
                }
            }
            else if (client is SystemProxyClientFactory)
            {
                radioSystem.Checked = true;
            }
            else if (client is ScriptProxyClientFactory)
            {
                _currentScript         = ((ScriptProxyClientFactory)client).Script ?? String.Empty;
                radioButtonPac.Checked = true;
            }

            _inupdate = false;
        }
Exemple #10
0
        private void RebuildClient()
        {
            if (radioDefault.Checked)
            {
                _client = new DefaultProxyClientFactory();
            }
            else if (radioDirect.Checked)
            {
                _client = new IpProxyClientFactory();
            }
            else if (radioProxy.Checked)
            {
                TcpProxyClientFactory factory;

                if (radioHttp.Checked)
                {
                    factory = new HttpProxyClientFactory();
                }
                else
                {
                    SocksProxyClientFactory f = new SocksProxyClientFactory();
                    f.Version4     = radioSocksv4.Checked;
                    f.SendHostname = checkBoxSendHostName.Checked;
                    factory        = f;
                }

                factory.Hostname = textBoxHost.Text;
                factory.Port     = (int)numericUpDownPort.Value;
                factory.IPv6     = checkBoxIpv6.Checked;

                _client = factory;
            }
            else if (radioSystem.Checked)
            {
                _client = new SystemProxyClientFactory();
            }
            else if (radioButtonPac.Checked)
            {
                _client = new ScriptProxyClientFactory()
                {
                    Script = _currentScript
                };
            }
        }
Exemple #11
0
        private void ProxyClientControl_Load(object sender, EventArgs e)
        {
            if (HideDefault)
            {
                radioDefault.Visible = false;
                radioDefault.Checked = false;
                if (_client == null)
                {
                    _client = new IpProxyClientFactory();
                }
            }
            else
            {
                if (_client == null)
                {
                    _client = new DefaultProxyClientFactory();
                }
            }

            UpdateClient(_client);
        }
Exemple #12
0
        private void CloneCertChain(Uri url, string destination)
        {
            IProxyClientFactory factory = proxyClientControl.Client;

            if (factory == null)
            {
                factory = new IpProxyClientFactory();
            }

            ProxyClient client = factory.Create(new Logger());

            collection = new X509Certificate2Collection();

            using (IDataAdapter adapter = client.Connect(new IpProxyToken(null, url.Host, url.Port, IpProxyToken.IpClientType.Tcp, false),
                                                         new Logger(), new Nodes.MetaDictionary(), new Nodes.MetaDictionary(), new PropertyBag(), new Security.CredentialsManagerService()))
            {
                DataAdapterToStream stm = new DataAdapterToStream(adapter);

                using (SslStream ssl = new SslStream(stm, false, VerifyCallback))
                {
                    ssl.AuthenticateAsClient(url.Host);
                }
            }

            if (collection.Count > 0)
            {
                File.WriteAllBytes(Path.Combine(destination, String.Format("certchain_{0}.pfx", url.Host)), collection.Export(X509ContentType.Pfx));
                int count = 1;

                foreach (X509Certificate2 cert in collection)
                {
                    string path = Path.Combine(destination, String.Format("cert_{0}_{1}.cer", url.Host, count++));

                    File.WriteAllText(path, CertificateUtils.ExportToPEM(cert) +
                                      CertificateUtils.ExportToPEM((RSA)cert.PrivateKey, null));
                }
            }
        }
Exemple #13
0
 public UserController(IProxyClientFactory proxyClient)
 {
     schoolService = proxyClient.GetProxy <ISchoolService>();
 }
Exemple #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="client"></param>
        private void UpdateClient(IProxyClientFactory client)
        {
            _inupdate = true;

            if ((client is DefaultProxyClientFactory) && (!HideDefault))
            {
                radioDefault.Checked = true;
            }
            else if ((client is IpProxyClientFactory) || (client is DefaultProxyClientFactory))
            {
                radioDirect.Checked = true;
            }
            else if (client is TcpProxyClientFactory)
            {
                TcpProxyClientFactory c = (TcpProxyClientFactory)client;
                radioProxy.Checked = true;

                textBoxHost.Text = c.Hostname;
                numericUpDownPort.Value = c.Port;
                checkBoxIpv6.Checked = c.IPv6;

                if (client is HttpProxyClientFactory)
                {
                    radioHttp.Checked = true;
                }
                else
                {
                    SocksProxyClientFactory socks = (SocksProxyClientFactory)client;
                    if (socks.Version4)
                    {
                        radioSocksv4.Checked = true;
                    }
                    else
                    {
                        radioSocksv5.Checked = true;
                    }
                }
            }
            else if (client is SystemProxyClientFactory)
            {
                radioSystem.Checked = true;
            }
            else if (client is ScriptProxyClientFactory)
            {
                _currentScript = ((ScriptProxyClientFactory)client).Script ?? String.Empty;
                radioButtonPac.Checked = true;
            }

            _inupdate = false;
        }
Exemple #15
0
        private void RebuildClient()
        {
            if (radioDefault.Checked)
            {
                _client = new DefaultProxyClientFactory();
            }
            else if (radioDirect.Checked)
            {
                _client = new IpProxyClientFactory();
            }
            else if(radioProxy.Checked)
            {
                TcpProxyClientFactory factory;

                if (radioHttp.Checked)
                {
                    factory = new HttpProxyClientFactory();
                }
                else
                {
                    SocksProxyClientFactory f = new SocksProxyClientFactory();
                    f.Version4 = radioSocksv4.Checked;
                    f.SendHostname = checkBoxSendHostName.Checked;
                    factory = f;
                }

                factory.Hostname = textBoxHost.Text;
                factory.Port = (int)numericUpDownPort.Value;
                factory.IPv6 = checkBoxIpv6.Checked;

                _client = factory;
            }
            else if (radioSystem.Checked)
            {
                _client = new SystemProxyClientFactory();
            }
            else if (radioButtonPac.Checked)
            {
                _client = new ScriptProxyClientFactory() { Script = _currentScript };
            }
        }
Exemple #16
0
        private void ProxyClientControl_Load(object sender, EventArgs e)
        {
            if (HideDefault)
            {
                radioDefault.Visible = false;
                radioDefault.Checked = false;
                if (_client == null)
                {
                    _client = new IpProxyClientFactory();
                }
            }
            else
            {
                if (_client == null)
                {
                    _client = new DefaultProxyClientFactory();
                }
            }

            UpdateClient(_client);
        }