public windows_certificate_store ()
		{
			Setting ca_name = new Setting(
				typeof(String),
				"Certificate Authority Name",
				_ca_name,
				"The CA name of the certificate",
				"General");
			ca_name.OnSettingChanged += delegate(object sender, EventArgs e) {
				_ca_name = (String)((Setting)sender).Value;
			};

			Setting path_to_makecert = new Setting(
				typeof(String),
				"Path to makecert.exe",
				_path_to_makecert,
				"...",
				"General");
			path_to_makecert.OnSettingChanged += delegate(object sender, EventArgs e) {
				_path_to_makecert = (String)((Setting)sender).Value;
			};

			_settings.Add(ca_name);
			_settings.Add(path_to_makecert);
		}
예제 #2
0
        private void initialize()
        {
            
            Setting enable = new Setting(typeof(Boolean),"Enable",true,"Enable domain blocking", "General");
            enable.OnSettingChanged += new EventHandler(enable_OnSettingChanged);

            Setting errorOnBlock = new Setting(typeof(Boolean), "Show As Error",false,"Blocked domains are given the status \"ERR\"","General");
            errorOnBlock.OnSettingChanged += new EventHandler(errorOnBlock_OnSettingChanged);

            _domains = new String[BlockedDomains.Count];
            domainlist = new Setting(typeof(String[]),"Domain List",_domains ,"A line separated list of domains to block. (i.e. www.doubleclick.net)", "Domain List");
            domainlist.OnSettingChanged += new EventHandler(domainlist_OnSettingChanged);
            _settings.AddRange(new Setting[]{domainlist,errorOnBlock,enable});

			contextual_action block_domain = new contextual_action(
				"block domain(s)",
				new Type[]{ typeof(proxy_transaction),typeof(proxy_transaction[]) });
			block_domain.DoWork += handle_block_domain;

			contextual_action unblock_domain = new contextual_action(
				"unblock domain(s)",
				new Type[] { typeof(proxy_transaction), typeof(proxy_transaction[]) });
			unblock_domain.DoWork += handle_unblock_domain;

			_contextual_actions.Add(block_domain);
			_contextual_actions.Add(unblock_domain);
        }
예제 #3
0
		public footer ()
		{
			Setting enable = new Setting(
				typeof(Boolean),
				"Enable",
				_active,
				"Enable/Disable Footer. Footer allows you to inject html/javascript/whatever into any html page just before the ending body tag",
				"General");
			enable.OnSettingChanged += delegate(object sender, EventArgs e) {
				_active = (Boolean)((Setting)sender).Value;
				if(OnActiveChanged != null) { OnActiveChanged(this, new EventArgs()); }
			};

			Setting code_to_inject = new Setting(
				typeof(String),
				"Code to Inject",
				_code_to_inject,
				"HTML/Javascript/whatever you want to inject into html pages just before the ending body tag",
				"General");
			code_to_inject.OnSettingChanged += delegate(object sender, EventArgs e) {
				_code_to_inject = (String)((Setting)sender).Value;
			};

			_settings.Add(code_to_inject);
			_settings.Add(enable);
		}
예제 #4
0
        private void initialize()
        {
			Setting user_agent = new Setting(
				typeof(string), 
				"User-Agent",
				"",
				"Select a \"User-Agent\" and I'll replace this existing one, in all requests, with this one.",
				"Pick a User-Agent"
				);

			user_agent.Choices = UserAgentStrings;
			user_agent.OnSettingChanged += new EventHandler(UserAgentRewriter_OnSettingChanged);

			// TODO: In order to implement this you are going to need syncronized access to a
			// data store.

//			Setting collect_ua = new Setting (
//				typeof(Boolean),
//				"Collect UAs",
//				false,
//				"I can collect user-agents that pass through in order provide more choices below.",
//				"General");

            Setting enable = new Setting(
				typeof(bool), 
				"Enable", 
				false, 
				"Turn User-Agent Switching on or off",
				"General"
				);
			enable.OnSettingChanged += new EventHandler(UserAgentRewriter_OnSettingChanged);

			_settings.AddRange (new Setting[] { user_agent, /*collect_ua,*/enable });
        }
예제 #5
0
		public void set_setting (Setting s)
		{
			_s = s;
			this.checkbutton1.Active = (Boolean)s.Value;
			this.checkbutton1.Name = _s.Name;
			this.checkbutton1.Label = _s.Name;
			this.desc_label.Text = _s.Description;

		}
		public void set_setting (Setting s)
		{
			if(_s != null)
				throw new Exception("set_setting may only be used once per instance!");
			_s = s;
			textview2.Buffer.Text = String.Join("\n",(String[])_s.Value);
			this.textview2.Buffer.Changed += HandleChanged;
			this.name_label.Text = _s.Name;
			this.desc_label.Text = _s.Description;
		}
예제 #7
0
		public void set_setting (Setting s)
		{
			_s = s;
			this.spinbutton1.Value = Convert.ToDouble((int)_s.Value);
			this.spinbutton1.Changed += HandleChanged;
			this.spinbutton1.ValueChanged += HandleChanged;
			this.spinbutton1.KeyReleaseEvent += HandleKeyReleaseEvent;
			this.desc_label.Text = _s.Description;
			this.name_label.Text = _s.Name;
		}
예제 #8
0
		public Directives ()
		{
			Setting enable = new Setting (
				typeof(Boolean),
				"Enable",
				true,
				"Enable (limited) support for .htaccessfiles",
				"General");
			enable.OnSettingChanged += OnEnabledChanged;
			_settings.Add (enable);
		}
예제 #9
0
        public connection_manager()
        {
             

            Setting staticRouteList =new Setting(typeof(String[]),
                "Static Routes List",
                new String[]{},
                "Use this to route a host to specific adapter! eg(google.com,local area connection)\r\n" + 
                "This is just like lock host to adapter except you can specify the adapter.",
                "Static Routes");

            Setting enableStaticRoutes = new Setting(typeof(Boolean),
                "Enable Static Routes", 
                false,
                "If checked, the Static Routes list will be used",
                "Static Routes");

            _hostToAdapterLock= new Setting(typeof(Boolean),
                "Host Lock", 
                true,
                "All Connections to a Host/Domain will be on the Same Adapter once Selected by the 'Adapter Selection Method'",
                "General");

            _randomSelection = new Setting(typeof(Boolean),
                "Random",
                false,
                "Internet Connected Adapters will be selected randomly per request",
                "Adapter Selection Method");

            _squentialselection = new Setting(typeof(Boolean),
                "Sequential",
                true,
                "Internet Connected Adapters will be selected one sequentially per request",
                "Adapter Selection Method");

            Setting enable = new Setting(typeof(Boolean), 
                "Enable",
                false, 
                "Enable Connection Manager",
                "General");

            _settings.Add(staticRouteList);
            _settings.Add(enableStaticRoutes);   
            _settings.Add(_squentialselection);
            _settings.Add(_randomSelection);
            _settings.Add(_hostToAdapterLock);
            _settings.Add(enable);

            enable.OnSettingChanged+=new EventHandler(ConnectionManager_OnSettingChanged);
            staticRouteList.OnSettingChanged += new EventHandler(_staticRoute_OnSettingChanged);
            enableStaticRoutes.OnSettingChanged += new EventHandler(enableStaticRoutes_OnSettingChanged);
            _squentialselection.OnSettingChanged += new EventHandler(_squentialselection_OnSettingChanged);
            _randomSelection.OnSettingChanged += new EventHandler(_randomSelection_OnSettingChanged);
        }     
예제 #10
0
        private void initialize()
        {
			Setting enable = new Setting (
				typeof(bool), 
				"Enable", 
				false, 
				"Tunnel https connections. No interception will be possible on HTTPS with this enabled.\n\n" +
				"NOTE: Due to the way connections are managed internally, you may not notice the effects of " +
				"changing this setting on already established connections until they 'idle timeout'.",
				"General");
			enable.OnSettingChanged += new EventHandler(UserAgentRewriter_OnSettingChanged);
			_settings.Add(enable);
        }
예제 #11
0
		public PHP_REQAM ()
		{
			_php = new PHP();
			_php.OnActiveChanged += delegate(object sender, EventArgs e) {
				_active = _php.Active;
				if(OnActiveChanged != null){ OnActiveChanged(this,new EventArgs()); }
			};
			Setting switchPairsList = new Setting(
				typeof(filter_file[]),
				"Switch Pairs",
				new filter_file[0],
				"A list of filters with an associated file.",
				"Switch Pairs List");
			switchPairsList.OnSettingChanged += new EventHandler(switchPairsList_OnSettingChanged);
			_settings.Add(switchPairsList);
			_settings.AddRange(_php.Settings.Settings);
		}
예제 #12
0
		public void set_setting (Setting s)
		{
			if(_s != null)
				throw new Exception("set_setting may only be used once per instance!");
			_s = s;

			name_label.Text = _s.Name;

			if (_s.Choices != null && _s.Limited) {

				// TODO: This is broken, code was originally written to store a string
				// but in this particular case there is a setting with string type
				// and you are given an array of choices, so what should really be
				// stored is a value between 0 and the length of the array; to 
				// indicate which choice is selected. As I am changing User-Agent
				// switcher to "Un Limited" I do not have a use case for this yet.
				ComboBox cobo = new ComboBox ((String[])_s.Choices);
				cobo.SetSizeRequest (100, 20);
				cobo.Name = _s.Name;
				cobo.Changed += cobo_changed;
				vbox2.Add (cobo);
			} else if (_s.Choices != null && !_s.Limited) {
				ComboBoxEntry combo = new ComboBoxEntry ((String[])_s.Choices);
				combo.SetSizeRequest (100, 20);
				combo.Name = _s.Name;
				combo.Entry.Text = (String)_s.Value;
				combo.Changed += combo_changed;
				vbox2.Add (combo);
			} else {
				Entry e = new Entry ((string)_s.Value);
				e.Name = _s.Name;
				e.Changed += e_changed;
				vbox2.Add (e);
			}
			Label l = new Label (_s.Description);
			l.SetSizeRequest (315, 100);
			l.SetAlignment (0, 0);
			l.LineWrap = true;
			l.SingleLineMode = false;
			l.SetPadding (10, 2);
			Pango.FontDescription pf2 = new Pango.FontDescription ();
			pf2.Weight = Pango.Weight.Light;
			l.ModifyFont (pf2);
			vbox2.Add(l);
		}
예제 #13
0
        public switcharoo()
        {
             Setting enable = new Setting(
				typeof(Boolean),"Enable",
				true,
				"Enable/Disable Switcharoo. Switcharoo allows you to specify a file to be used as the response when the condition is satified!",
			    "General");
             enable.OnSettingChanged += new EventHandler(enable_OnSettingChanged);

            Setting switchPairsList = new Setting(
				typeof(filter_file[]),
				"Switch Pairs",
				new filter_file[0],
			"A list of filters with an associated file.",
			"Switch Pairs List");
            switchPairsList.OnSettingChanged += new EventHandler(switchPairsList_OnSettingChanged);
            _settings.AddRange(new Setting[]{switchPairsList, enable});
        }
예제 #14
0
		public http_server_secure ():base(443)
		{

			Setting cert_path = new Setting(
				typeof(String),
				"Certificate Path",
				_cert_path,
				"PEM Certificate",
				"General");

			cert_path.OnSettingChanged += delegate(object sender, EventArgs e) {
				_cert_path = (String)((Setting)sender).Value;
			};

			Setting private_key = new Setting(
				typeof(String),
				"Certificate Private Key",
				_private_key,
				"XML private key",
				"General");

			private_key.OnSettingChanged += delegate(object sender, EventArgs e) {
				_private_key = (String)((Setting)sender).Value;
			};

			Setting secure_port = new Setting(
				typeof(int),
				"Secure port",
				443,
				"The port to listen on for SSL Connections",
				"General");

			secure_port.OnSettingChanged += delegate(object sender, EventArgs e) {
				_secure_port = (int)((Setting)sender).Value;
			};

			_settings.Add(secure_port);
			_settings.Add(cert_path);
			_settings.Add(private_key);
		}
예제 #15
0
파일: PHP.cs 프로젝트: Meticulus/tactical
		public PHP()
		{
			if (!global.environment.isLinux)
				_pathtophp = @"C:\php\php-cgi.exe";

			Setting pathtophp = new Setting
				(typeof(String), "File path to php cgi binary/executable",
				 _pathtophp, "File path to php[5]-cgi", "File Path");

			pathtophp.OnSettingChanged += _pathtophp_changed;

			Setting redirectdirtoindex = new Setting(
				typeof(Boolean),
				"Redirect to Indexs",
				_redirectdirtoindex,
				"Instead of processing the current request for a directory, we use a 302 redirect to the actual path of the index script." +
				"When this is off, we send the current request to the index script.",
				"General");

			redirectdirtoindex.OnSettingChanged += delegate(object sender, EventArgs e) {
				_redirectdirtoindex = (Boolean)((Setting)sender).Value;
			};

			Setting append_error_to_output = new Setting(
				typeof(Boolean),
				"Append PHP errors to output",
				_append_error_to_output,
				"When php-cgi outputs errors or warnings to stdout, append that data to the end of the response body.",
				"General");
			append_error_to_output.OnSettingChanged += delegate(object sender, EventArgs e) {
				_append_error_to_output = (Boolean)((Setting)sender).Value;
			};

			Setting _enabled = new Setting
				(typeof(Boolean),"Enabled",_active,"Enable PHP","General");
			_enabled.OnSettingChanged += new EventHandler(_enabled_OnSettingChanged);

			_settings.AddRange(new Setting[] { pathtophp,redirectdirtoindex, append_error_to_output,_enabled });
		}
예제 #16
0
        public redirector()
        {
             Setting enable = new Setting(
				typeof(Boolean), 
			    "Enable",
				true,
				"on/off switch for Redirector. " +
			    "Redirector can substitue one url for another " +
			    "when a client requests it.",
			    "General");

             enable.OnSettingChanged += new EventHandler(enable_OnSettingChanged);

            Setting switchPairsList = new Setting(
				typeof(filter_target[]),
				"Redirect Pairs",
				new String[]{} ,
			"Comma delimited Redirect pairs e.g http://www.google.com,http://yahoo.com\\n",
			"Redirect Pairs List");
            switchPairsList.OnSettingChanged += new EventHandler(switchPairsList_OnSettingChanged);

            _settings.AddRange(new Setting[]{switchPairsList, enable});
        }
예제 #17
0
		void InitSettings ()
		{
			String rp = "/var/www";
			if(Environment.OSVersion.Platform == PlatformID.Win32NT)
				rp = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),"www");

			_dataLayer = new FileDataAccessLayer(rp);

			Setting root_path = new Setting(
				typeof(String),
				"Document Root",
				rp,
				"The root directory for the webserver",
				"General");

			root_path.OnSettingChanged += delegate(object sender, EventArgs e) {
				String path = (String)((Setting)sender).Value;
				if(!Directory.Exists(path))
					Directory.CreateDirectory(path);
				_dataLayer = new FileDataAccessLayer(path);
			};
			_settings.Add(root_path);
		}
예제 #18
0
		public void set_setting (Setting s)
		{
			_set = s;
			this.name_label.Text = _set.Name;
			this.desc_label.Text = _set.Description;
			_ffa.AddRange((filter_file[])s.Value);
			if(_ffa == null)
				return;
			foreach(filter_file ff in _ffa) {
				this.nodeview1.NodeStore.AddNode(new filter_file_node(ff));
			}
		}
예제 #19
0
        private void            InitSettings(String dip,int dport)
        {
            Setting port = new Setting(

                typeof(int),
                "Port",
                dport,
                "This is the port that the proxy will run on." +
                "Make sure to pick on that is not already in use." +
                "Restart server for changes to take effect",

                "General");

			port.OnSettingChanged += delegate(object sender, EventArgs e) {
				_port = (int)((Setting)sender).Value;
			};

            Setting threadpriority = new Setting(

                typeof(int),
                "Thread Priority",
                _thread_priority,
                String.Format("{0} = {1}\r\n",ThreadPriority.Highest, (int)ThreadPriority.Highest) +
                String.Format("{0} = {1}\r\n",ThreadPriority.AboveNormal, (int)ThreadPriority.AboveNormal) +
                String.Format("{0} = {1}\r\n",ThreadPriority.Normal, (int)ThreadPriority.Normal) +
                String.Format("{0} = {1}\r\n",ThreadPriority.BelowNormal, (int)ThreadPriority.BelowNormal) +
                String.Format("{0} = {1}\r\n",ThreadPriority.Lowest, (int)ThreadPriority.Lowest),
                "Performance");

			threadpriority.OnSettingChanged += delegate(object sender, EventArgs e) {
				_thread_priority = (ThreadPriority)((Setting)sender).Value;
			};

            Setting interfaceip = new Setting(

                typeof(String),
                "Interface IP",
                IPAddress.Parse(dip).ToString(),
                "This the ip address of the network interface that you would like the server to listen on",
                "General");

			interfaceip.OnSettingChanged += delegate(object sender, EventArgs e) {
				String ip = (String)((Setting)sender).Value;
				if(!IPAddress.TryParse(ip, out _interface_ip))
				{
#if DEBUG
					Console.Error.WriteLine(ip + " does not seem to be a valid ip address?");
#endif
				}
			};

            /*Setting natt = new Setting(

                typeof(Boolean),
                "Network Traversal",
                true,
                "Turn this on if you would like to automatically set up a route from the internet to this server." +
                "Caution: Security is your responsiblity!",
                "General");

			natt.OnSettingChanged += delegate(object sender, EventArgs e) {
				_natt = (Boolean)((Setting)sender).Value;
			};*/

			Setting idle_timeout = new Setting(
				typeof(int),
				"Client Connection idle timeout",
				_idle_timeount,
				"If a client connection is inactive for this number of seconds, it will be disconnected.",
				"General");

			idle_timeout.OnSettingChanged += delegate(object sender, EventArgs e) {
				_idle_timeount = (int)((Setting)sender).Value;
			};

            _settings.AddRange(new Setting[] { 
               
                threadpriority,
                /*natt,*/ 
                port, 
                interfaceip,
				idle_timeout
            });
        }
예제 #20
0
		public open_ssl_cert_store ()
		{
			if(Environment.OSVersion.Platform == PlatformID.Win32NT) {

				_dep_res_notes = "List of sites that have openssl for windows from https://wiki.openssl.org/index.php/Binaries\n";
				openssl_binary_path = @"C:\openssl\openssl.exe";
				keysize = 1024;
			}
#if DEBUG
			_common_name = _common_name +"_debug";
#endif
			#region settings

			Setting pathtoopenssl = new Setting(
				typeof(String),
				"Path to Openssl Binary",
				openssl_binary_path,
				"If you need to specify the location of the OpenSSL Binary you can do it here!",
				"General");
			pathtoopenssl.OnSettingChanged += delegate(object sender, EventArgs e) {
				openssl_binary_path = (String)((Setting)sender).Value;
			};

			Setting ca_country_name = new Setting (
				typeof(string),
				"Country",
				_country_name,
				"Exactly 2 letters that represent a country",
				"General");
			ca_country_name.OnSettingChanged += delegate(object sender, EventArgs e) {
				string newvalue = (String)((Setting)sender).Value;
				if(newvalue.Length == 2)
					_country_name = newvalue;
			};

			Setting ca_province = new Setting (
				typeof(string),
				"State or Provice",
				_province,
				"",
				"General");
			ca_province.OnSettingChanged += delegate(object sender, EventArgs e) {
				_province = (String)((Setting)sender).Value;
			};

			Setting ca_locality = new Setting (
				typeof(string),
				"Locality",
				_locality,
				"",
				"General");
			ca_locality.OnSettingChanged += delegate(object sender, EventArgs e) {
				_locality = (String)((Setting)sender).Value;
			};

			Setting ca_org_name = new Setting (
				typeof(string),
				"Orgainization Name",
				_org_name,
				"",
				"General");
			ca_org_name.OnSettingChanged += delegate(object sender, EventArgs e) {
				_org_name = (String)((Setting)sender).Value;
			};
			Setting ca_org_unit_name = new Setting (
				typeof(string),
				"Orgainization Unit Name",
				_org_unit_name,
				"",
				"General");
			ca_org_unit_name.OnSettingChanged += delegate(object sender, EventArgs e) {
				_org_unit_name = (String)((Setting)sender).Value;
			};

			Setting ca_common_name = new Setting (
				typeof(string),
				"Common Name",
				_common_name,
				"",
				"General");
			ca_common_name.OnSettingChanged += delegate(object sender, EventArgs e) {
				_common_name = (String)((Setting)sender).Value;
			};

			Setting ca_email = new Setting (
				typeof(string),
				"Email",
				_email,
				"",
				"General");
			ca_email.OnSettingChanged += delegate(object sender, EventArgs e) {
				_email = (String)((Setting)sender).Value;
			};

			_settings.AddRange(new Setting[]{ca_email,ca_common_name,ca_org_unit_name,ca_org_name,ca_locality,ca_province,ca_country_name,pathtoopenssl});

			#endregion
		}
예제 #21
0
 public static Setting GetSetting(Setting[] settings, String key)
 {
     Setting retval = null;
     foreach(Setting setting in settings)
     {
         if(setting.Name.ToLower() == key.ToLower())
         {
             retval = setting;
             break;
         }
         
     }
     return retval;
 }
예제 #22
0
 public SettingCollection(string heading, Setting[] settings)
 {
     _Heading = heading;
     _settings = settings;
 }
예제 #23
0
		private void init_settings()
        {
            Setting enable = new Setting(
                
                typeof(Boolean),
                "Enable",
                true,
                String.Format("Allow {0} plugins group to execute",_tag),
                "General");
            enable.OnSettingChanged += new EventHandler(enable_OnSettingChanged);

            _settings.Add(enable);
        }