Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 public DomainFacade(ProxyConfig pProxyConfig, IPlugin pPlugin)
 {
     cPlugin = pPlugin;
       cRecordList = new List<IMAP4Account>();
       cObserverList = new List<IObserver>();
       cInfrastructure = InfrastructureFacade.getInstance(pProxyConfig, pPlugin);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create single instance
 /// </summary>
 public static DomainFacade getInstance(ProxyConfig pProxyConfig, IPlugin pPlugin)
 {
     return cInstance ?? (cInstance = new DomainFacade(pProxyConfig, pPlugin));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 
 /// </summary>
 public void onStart(ProxyConfig pProxyConfig)
 {
     cInfrastructure.onStart(pProxyConfig);
 }
Ejemplo n.º 4
0
 public TaskFacade(ProxyConfig pProxyConfig, IPlugin pPlugin)
 {
     cPlugin = pPlugin;
       cDomain = DomainFacade.getInstance(pProxyConfig, pPlugin);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pProxyConfig"></param>
 public void onStart(ProxyConfig pProxyConfig)
 {
     cDomain.onStart(pProxyConfig);
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public void onStartAttack()
        {
            if (Config.IsActive)
              {
            if (InvokeRequired)
            {
              BeginInvoke(new onStartAttackDelegate(onStartAttack), new object[] { });
              return;
            } // if (InvokeRequired)

            try
            {
              ProxyConfig lProxyConfig = new ProxyConfig
              {
            BasisDirectory = PluginParameters.HostApplication.GetWorkingDirectory(),
            isDebuggingOn = PluginParameters.HostApplication.IsDebuggingOn(),
            onProxyExit = onIMAP4ProxyExited,
            RemoteHostName = TB_ForwardHost.Text
              };

              setGUIInactive();
              cTask.onStart(lProxyConfig);
              PluginParameters.HostApplication.PluginSetStatus(this, "green");
            }
            catch (ExceptionWarning lEx)
            {
              PluginParameters.HostApplication.PluginSetStatus(this, "grey");
              setGUIActive();
              cTask.onStop();

              PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
            }
            catch (Exception lEx)
            {
              PluginParameters.HostApplication.PluginSetStatus(this, "red");
              setGUIActive();
              cTask.onStop();

              String lMsg = String.Format("{0}: {1}", Config.PluginName, lEx.Message);
              PluginParameters.HostApplication.LogMessage(lMsg);
              MessageBox.Show(lMsg, "Can't start proxy server", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
              } // if (cIsActi...
        }