Example #1
0
 public TaskFacade(ProxyConfig pProxyConfig, IPlugin pPlugin)
 {
     cPlugin = pPlugin;
     cDomain = DomainFacade.getInstance(pProxyConfig, pPlugin);
 }
Example #2
0
 /// <summary>
 /// Create single instance
 /// </summary>
 public static DomainFacade getInstance(ProxyConfig pProxyConfig, IPlugin pPlugin)
 {
     return(cInstance ?? (cInstance = new DomainFacade(pProxyConfig, pPlugin)));
 }
Example #3
0
 public TaskFacade(ProxyConfig pProxyConfig, IPlugin pPlugin)
 {
     cPlugin = pPlugin;
       cDomain = DomainFacade.getInstance(pProxyConfig, pPlugin);
 }
Example #4
0
 /// <summary>
 /// Create single instance
 /// </summary>
 public static DomainFacade getInstance(ProxyConfig pProxyConfig, IPlugin pPlugin)
 {
     return cInstance ?? (cInstance = new DomainFacade(pProxyConfig, pPlugin));
 }
Example #5
0
        /// <summary>
        /// 
        /// </summary>
        public PluginIMAP4ProxyUC(PluginParameters pPluginParams)
        {
            InitializeComponent();

              #region DATAGRID HEADER

              DGV_Accounts.AutoGenerateColumns = false;

              DataGridViewTextBoxColumn cMACCol = new DataGridViewTextBoxColumn();
              cMACCol.DataPropertyName = "SrcMAC";
              cMACCol.Name = "SrcMAC";
              cMACCol.HeaderText = "MAC address";
              cMACCol.ReadOnly = true;
              cMACCol.Width = 120;
              //cMACCol.Visible = false;
              DGV_Accounts.Columns.Add(cMACCol);

              DataGridViewTextBoxColumn cSrcIPCol = new DataGridViewTextBoxColumn();
              cSrcIPCol.DataPropertyName = "SrcIP";
              cSrcIPCol.Name = "SrcIP";
              cSrcIPCol.HeaderText = "Source IP";
              cSrcIPCol.Visible = false;
              cSrcIPCol.ReadOnly = true;
              cSrcIPCol.Width = 120;
              DGV_Accounts.Columns.Add(cSrcIPCol);

              DataGridViewTextBoxColumn cDstIPCol = new DataGridViewTextBoxColumn();
              cDstIPCol.DataPropertyName = "DstIP";
              cDstIPCol.Name = "DstIP";
              cDstIPCol.HeaderText = "Destination";
              cDstIPCol.ReadOnly = true;
              cDstIPCol.Width = 200;
              DGV_Accounts.Columns.Add(cDstIPCol);

              DataGridViewTextBoxColumn cDestPortCol = new DataGridViewTextBoxColumn();
              cDestPortCol.DataPropertyName = "DstPort";
              cDestPortCol.Name = "DstPort";
              cDestPortCol.HeaderText = "Service";
              cDestPortCol.ReadOnly = true;
              cDestPortCol.Width = 60;
              DGV_Accounts.Columns.Add(cDestPortCol);

              DataGridViewTextBoxColumn cUserCol = new DataGridViewTextBoxColumn();
              cUserCol.DataPropertyName = "Username";
              cUserCol.Name = "Username";
              cUserCol.HeaderText = "Username";
              cUserCol.ReadOnly = true;
              cUserCol.Width = 150;
              DGV_Accounts.Columns.Add(cUserCol);

              DataGridViewTextBoxColumn cPassCol = new DataGridViewTextBoxColumn();
              cPassCol.DataPropertyName = "Password";
              cPassCol.Name = "Password";
              cPassCol.HeaderText = "Password";
              cPassCol.ReadOnly = true;
              //cPassCol.Width = 120;
              cPassCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
              DGV_Accounts.Columns.Add(cPassCol);

              DataGridViewTextBoxColumn cServerCol = new DataGridViewTextBoxColumn();
              cServerCol.DataPropertyName = "Server";
              cServerCol.Name = "Server";
              cServerCol.HeaderText = "Server";
              cServerCol.ReadOnly = true;
              //cServerCol.Width = 120;
              cServerCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
              DGV_Accounts.Columns.Add(cServerCol);

              cAccounts = new BindingList<IMAP4Account>();
              DGV_Accounts.DataSource = cAccounts;
              #endregion

              /*
               * Plugin configuration
               */
              T_GUIUpdate.Interval = 1000;
              PluginParameters = pPluginParams;
              String lBaseDir = String.Format(@"{0}\", (pPluginParams!=null) ? pPluginParams.PluginDirectoryFullPath : Directory.GetCurrentDirectory());
              String lSessionDir = (pPluginParams!=null) ? pPluginParams.SessionDirectoryFullPath :  String.Format("{0}sessions", lBaseDir);

              Config = new PluginProperties()
              {
            BaseDir = lBaseDir,
            SessionDir = lSessionDir,
            PluginName = "IMAP4(S) proxy",
            PluginDescription = "IMAP4(S) reverse proxy server to intercept account data.",
            PluginVersion = "0.4",
            Ports = "TCP:993;TCP:143;",
            IsActive = true
              };

              cDataBatch = new List<String>();

              // Make it double buffered.
              typeof(DataGridView).InvokeMember("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, DGV_Accounts, new object[] { true });
              T_GUIUpdate.Start();

              /*
               * Proxy server configuration
               */
              ProxyConfig lProxyConfig = new ProxyConfig()
                  {
                    BasisDirectory = Config.BaseDir,
                    SessionDirectory = Config.SessionDir,
                    //RemoteHostName = String.Empty,
                    isDebuggingOn = (PluginParameters.HostApplication != null) ? PluginParameters.HostApplication.IsDebuggingOn() : false,
                    onProxyExit = onIMAP4ProxyExited
                  };
              cTask = TaskFacade.getInstance(lProxyConfig, this);
              cDomain = DomainFacade.getInstance(lProxyConfig, this);
              cDomain.addObserver(this);
        }