Ejemplo n.º 1
0
    /// <summary>
    /// 
    /// </summary>
    public static void CheckForSimsangUpdates()
    {
        if (NetworkInterface.GetAllNetworkInterfaces().Any(x => x.OperationalStatus == OperationalStatus.Up))
        {
          UpdateData lUpdateData = null;

          try
          {
            lUpdateData = FetchUpdateInformationFromServer();
          } 
          catch(Exception lEx) 
          {
            LogConsole.Main.LogConsole.LogInstance.LogMessage(String.Format("CheckForSimsangUpdates(Exception) : {0}", lEx.Message));
          }

          if (lUpdateData != null && lUpdateData.IsUpdateAvaliable)
          {
            Simsang.Updates.FormNewVersion lNewVersion = new Simsang.Updates.FormNewVersion();
            lNewVersion.TopMost = true;
            lNewVersion.ShowDialog();
          }
          else
            LogConsole.Main.LogConsole.LogInstance.LogMessage("No new updates available.");
        }
        else
          LogConsole.Main.LogConsole.LogInstance.LogMessage("Can't check for new updates as no internet connection is available.");
    }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        private SimsangMain(String[] args)
        {
            InitializeComponent();

              #region Datagrid header

              DataGridViewTextBoxColumn mPluginNameCol = new DataGridViewTextBoxColumn();
              mPluginNameCol.DataPropertyName = "PluginName";
              mPluginNameCol.HeaderText = "Plugin name";
              mPluginNameCol.ReadOnly = true;
              mPluginNameCol.Width = 120;
              DGV_MainPlugins.Columns.Add(mPluginNameCol);

              DataGridViewTextBoxColumn mPluginVersionCol = new DataGridViewTextBoxColumn();
              mPluginVersionCol.DataPropertyName = "PluginVersion";
              mPluginVersionCol.HeaderText = "Version";
              mPluginVersionCol.ReadOnly = true;
              DGV_MainPlugins.Columns.Add(mPluginVersionCol);

              DataGridViewCheckBoxColumn mActivatedCol = new DataGridViewCheckBoxColumn();
              mActivatedCol.DataPropertyName = "Active";
              mActivatedCol.Name = "Active";
              mActivatedCol.HeaderText = "Activated";
              mActivatedCol.FalseValue = "0";
              mActivatedCol.TrueValue = "1";
              mActivatedCol.Visible = true;
              DGV_MainPlugins.Columns.Add(mActivatedCol);

              DataGridViewTextBoxColumn mPluginDescriptionCol = new DataGridViewTextBoxColumn();
              mPluginDescriptionCol.DataPropertyName = "PluginDescription";
              mPluginDescriptionCol.HeaderText = "Description";
              mPluginDescriptionCol.ReadOnly = true;
              mPluginDescriptionCol.Width = 120;
              mPluginDescriptionCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
              DGV_MainPlugins.Columns.Add(mPluginDescriptionCol);

              mUsedPlugins = new BindingList<UsedPlugins>();
              DGV_MainPlugins.DataSource = mUsedPlugins;

              #endregion

              //var curr = new BindingSource(list, null);
              mTargetList = new BindingList<string>();
              mInputModule = new InputModule(this);
              mPluginModule = new PluginModule(this);
              mSessionPresentationFacade = Session.Sessions.getInstance(this);
              mSessionTaskFacade = Session.TaskFacade.getInstance();
              //mCurrentSession = new AttackSession(Directory.GetCurrentDirectory() + Config.SessionDir);
              mCurrentSession = new AttackSession();
              mCurrentSession.StartTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

              // Initialize log console
              LogConsole.Main.LogConsole.getInstance();

              // Check Pcap version
              try
              {
            L_PCAPVersion.Text = Config.WinPcap = Config.IsProgrammInstalled("winpcap").ToLower();
            if (Config.WinPcap == null || Config.WinPcap.Length <= 0)
            {
              String lMsg = String.Format("WinPcap is not present and {0} probably won't work as expected. You can download WinPcap under http://www.winpcap.org", Config.ToolName);
              MessageBox.Show(lMsg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
            } // if (Config.WinP...
              }
              catch (Exception)
              {
            String lMsg = String.Format("WinPcap is not present and {0} probably won't work as expected. You can download WinPcap under http://www.winpcap.org", Config.ToolName);
            MessageBox.Show(lMsg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
              }

              /*
               * Init configuration
               */
              try { Config.OS = String.Format("{0}.{1}", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor); }
              catch (Exception) { }
              try { Config.Architecture = Environment.Is64BitOperatingSystem ? "x64" : "x86"; }
              catch (Exception) { }
              try { Config.Language = System.Globalization.CultureInfo.CurrentCulture.ToString(); }
              catch (Exception) { }
              try { Config.Processor = System.Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"); }
              catch (Exception) { }
              try { Config.NumProcessors = System.Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"); }
              catch (Exception) { }
              try { Config.DotNetVersion = System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion(); }
              catch (Exception) { }
              try { Config.CommonLanguateRuntime = Environment.Version.ToString(); }
              catch (Exception) { }

              // Check if an other instance is running.
              Process[] lACInstances;

              if ((lACInstances = Process.GetProcessesByName(Config.APEName)) != null && lACInstances.Length > 0)
            if (MessageBox.Show("Other Simsang instance is running. Do you want to stop that process?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
              foreach (Process lProc in lACInstances)
            try { lProc.Kill(); }
            catch (Exception) { }

              // Check if configuration is ok.
              this.ConfigOK(Directory.GetCurrentDirectory());

              //Set right Debugging modus in GUI
              if (Config.DebugOn())
              {
            TSMI_Debugging.Text = "Turn debugging off";
            this.setAppTitle("Debugging");
              }
              else
              {
            TSMI_Debugging.Text = "Turn debugging on";
            this.setAppTitle("");
              }

              //Populate network interface.
              this.LoadNICSettings();
              LogConsole.Main.LogConsole.pushMsg(String.Format("Current directory : {0}", Directory.GetCurrentDirectory()));

              // Start data input thread.
              mInputModule.startInputThread();

              // Load all plugins.
              mPluginModule.LoadPlugins();

              // Tab page controler. To hide and show tab pages.
              if (mPluginModule != null)
            mTPHandler = new TabPageHandler(TC_Plugins, mPluginModule.GetPluginPosition);

              // And at last a new session
              // TB_Session.Text = GetNewSessionName();

              if (CB_Interfaces.Items.Count <= 0)
              {
            MessageBox.Show("No active network adapter found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
              }
              else
              {
            /*
             * Init ARPScan console
             */
            try
            {
              // Simsang.ARPScan.ARPScan.InitARPScan(this, Config.Interfaces[CB_Interfaces.SelectedIndex].sIfcID, TB_StartIP.Text, TB_StopIP.Text, TB_GatewayIP.Text, ref mTargetList);
              Simsang.ARPScan.Main.ARPScan.InitARPScan(this, ref mTargetList);
            }
            catch (Exception lEx)
            {
              LogConsole.Main.LogConsole.pushMsg("Main() : " + lEx.StackTrace);
              Environment.Exit(0);
            }
            mAttackStarted = false;
              }

              // Check confirmation
              String lRegistrationValue = Config.GetRegistryValue(Config.RegistryContributionKey, Config.RegistryContributionValue);
              if (String.IsNullOrEmpty(lRegistrationValue) || lRegistrationValue.ToLower() != "ok")
              {
            ContributeConfirmation lConfirmation = new ContributeConfirmation();
            lConfirmation.ShowDialog();
              }

              restrictFeaturesFacade();

              // Check if new version is available
              Thread lUpdateAvailableThread = new Thread(delegate()
              {
            if (NetworkInterface.GetAllNetworkInterfaces().Any(x => x.OperationalStatus == OperationalStatus.Up))
            {
              if (Updates.InfrastructureFacade.getInstance().IsUpdateAvailable())
              {
            Simsang.Updates.FormNewVersion lNewVersion = new Simsang.Updates.FormNewVersion();
            lNewVersion.TopMost = true;
            lNewVersion.ShowDialog();
              }
              else
            LogConsole.Main.LogConsole.pushMsg("No new updates available.");
            }
            else
              LogConsole.Main.LogConsole.pushMsg("Can't check for new updates as no internet connection is available.");
              });
              lUpdateAvailableThread.Start();

              // Donate a click if internet connection is up.
              Thread lClickDonationThread = new Thread(delegate()
              {
            if (NetworkInterface.GetAllNetworkInterfaces().Any(x => x.OperationalStatus == OperationalStatus.Up))
              WB_Ads.Navigate(Config.BuglistURL);
              });
              lClickDonationThread.Start();

              // Initialize all plugins
              mPluginModule.initAllPlugins();

              // Hide all plugins what have the status "off"
              mPluginModule.CloseInactivePlugins();

              /*
               * Load session file passed as a command line parameter.
               * 1. Import it
               * 2. Load it
               * 3. Remove session
               */
              if (args != null && args.Length > 0)
              {
            loadDefaultSession(args[0]);
              }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        private SimsangMain(String[] args)
        {
            InitializeComponent();


            #region Datagrid header


            DataGridViewTextBoxColumn mPluginNameCol = new DataGridViewTextBoxColumn();
            mPluginNameCol.DataPropertyName = "PluginName";
            mPluginNameCol.HeaderText       = "Plugin name";
            mPluginNameCol.ReadOnly         = true;
            mPluginNameCol.Width            = 120;
            DGV_MainPlugins.Columns.Add(mPluginNameCol);


            DataGridViewTextBoxColumn mPluginVersionCol = new DataGridViewTextBoxColumn();
            mPluginVersionCol.DataPropertyName = "PluginVersion";
            mPluginVersionCol.HeaderText       = "Version";
            mPluginVersionCol.ReadOnly         = true;
            DGV_MainPlugins.Columns.Add(mPluginVersionCol);


            DataGridViewCheckBoxColumn mActivatedCol = new DataGridViewCheckBoxColumn();
            mActivatedCol.DataPropertyName = "Active";
            mActivatedCol.Name             = "Active";
            mActivatedCol.HeaderText       = "Activated";
            mActivatedCol.FalseValue       = "0";
            mActivatedCol.TrueValue        = "1";
            mActivatedCol.Visible          = true;
            DGV_MainPlugins.Columns.Add(mActivatedCol);

            DataGridViewTextBoxColumn mPluginDescriptionCol = new DataGridViewTextBoxColumn();
            mPluginDescriptionCol.DataPropertyName = "PluginDescription";
            mPluginDescriptionCol.HeaderText       = "Description";
            mPluginDescriptionCol.ReadOnly         = true;
            mPluginDescriptionCol.Width            = 120;
            mPluginDescriptionCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            DGV_MainPlugins.Columns.Add(mPluginDescriptionCol);



            mUsedPlugins = new BindingList <UsedPlugins>();
            DGV_MainPlugins.DataSource = mUsedPlugins;

            #endregion

            //var curr = new BindingSource(list, null);
            mTargetList   = new BindingList <string>();
            mInputModule  = new InputModule(this);
            mPluginModule = new PluginModule(this);
            mSessionPresentationFacade = Session.Sessions.getInstance(this);
            mSessionTaskFacade         = Session.TaskFacade.getInstance();
            //mCurrentSession = new AttackSession(Directory.GetCurrentDirectory() + Config.SessionDir);
            mCurrentSession           = new AttackSession();
            mCurrentSession.StartTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");


            // Initialize log console
            LogConsole.Main.LogConsole.getInstance();

            // Check Pcap version
            try
            {
                L_PCAPVersion.Text = Config.WinPcap = Config.IsProgrammInstalled("winpcap").ToLower();
                if (Config.WinPcap == null || Config.WinPcap.Length <= 0)
                {
                    String lMsg = String.Format("WinPcap is not present and {0} probably won't work as expected. You can download WinPcap under http://www.winpcap.org", Config.ToolName);
                    MessageBox.Show(lMsg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                } // if (Config.WinP...
            }
            catch (Exception)
            {
                String lMsg = String.Format("WinPcap is not present and {0} probably won't work as expected. You can download WinPcap under http://www.winpcap.org", Config.ToolName);
                MessageBox.Show(lMsg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }


            /*
             * Init configuration
             */
            try { Config.OS = String.Format("{0}.{1}", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor); }
            catch (Exception) { }
            try { Config.Architecture = Environment.Is64BitOperatingSystem ? "x64" : "x86"; }
            catch (Exception) { }
            try { Config.Language = System.Globalization.CultureInfo.CurrentCulture.ToString(); }
            catch (Exception) { }
            try { Config.Processor = System.Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"); }
            catch (Exception) { }
            try { Config.NumProcessors = System.Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"); }
            catch (Exception) { }
            try { Config.DotNetVersion = System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion(); }
            catch (Exception) { }
            try { Config.CommonLanguateRuntime = Environment.Version.ToString(); }
            catch (Exception) { }

            // Check if an other instance is running.
            Process[] lACInstances;

            if ((lACInstances = Process.GetProcessesByName(Config.APEName)) != null && lACInstances.Length > 0)
            {
                if (MessageBox.Show("Other Simsang instance is running. Do you want to stop that process?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    foreach (Process lProc in lACInstances)
                    {
                        try { lProc.Kill(); }
                        catch (Exception) { }
                    }
                }
            }


            // Check if configuration is ok.
            this.ConfigOK(Directory.GetCurrentDirectory());


            //Set right Debugging modus in GUI
            if (Config.DebugOn())
            {
                TSMI_Debugging.Text = "Turn debugging off";
                this.setAppTitle("Debugging");
            }
            else
            {
                TSMI_Debugging.Text = "Turn debugging on";
                this.setAppTitle("");
            }

            //Populate network interface.
            this.LoadNICSettings();
            LogConsole.Main.LogConsole.pushMsg(String.Format("Current directory : {0}", Directory.GetCurrentDirectory()));

            // Start data input thread.
            mInputModule.startInputThread();

            // Load all plugins.
            mPluginModule.LoadPlugins();

            // Tab page controler. To hide and show tab pages.
            if (mPluginModule != null)
            {
                mTPHandler = new TabPageHandler(TC_Plugins, mPluginModule.GetPluginPosition);
            }

            // And at last a new session
            // TB_Session.Text = GetNewSessionName();


            if (CB_Interfaces.Items.Count <= 0)
            {
                MessageBox.Show("No active network adapter found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                /*
                 * Init ARPScan console
                 */
                try
                {
                    // Simsang.ARPScan.ARPScan.InitARPScan(this, Config.Interfaces[CB_Interfaces.SelectedIndex].sIfcID, TB_StartIP.Text, TB_StopIP.Text, TB_GatewayIP.Text, ref mTargetList);
                    Simsang.ARPScan.Main.ARPScan.InitARPScan(this, ref mTargetList);
                }
                catch (Exception lEx)
                {
                    LogConsole.Main.LogConsole.pushMsg("Main() : " + lEx.StackTrace);
                    Environment.Exit(0);
                }
                mAttackStarted = false;
            }


            // Check confirmation
            String lRegistrationValue = Config.GetRegistryValue(Config.RegistryContributionKey, Config.RegistryContributionValue);
            if (String.IsNullOrEmpty(lRegistrationValue) || lRegistrationValue.ToLower() != "ok")
            {
                ContributeConfirmation lConfirmation = new ContributeConfirmation();
                lConfirmation.ShowDialog();
            }

            restrictFeaturesFacade();


            // Check if new version is available
            Thread lUpdateAvailableThread = new Thread(delegate()
            {
                if (NetworkInterface.GetAllNetworkInterfaces().Any(x => x.OperationalStatus == OperationalStatus.Up))
                {
                    if (Updates.InfrastructureFacade.getInstance().IsUpdateAvailable())
                    {
                        Simsang.Updates.FormNewVersion lNewVersion = new Simsang.Updates.FormNewVersion();
                        lNewVersion.TopMost = true;
                        lNewVersion.ShowDialog();
                    }
                    else
                    {
                        LogConsole.Main.LogConsole.pushMsg("No new updates available.");
                    }
                }
                else
                {
                    LogConsole.Main.LogConsole.pushMsg("Can't check for new updates as no internet connection is available.");
                }
            });
            lUpdateAvailableThread.Start();

            // Donate a click if internet connection is up.
            Thread lClickDonationThread = new Thread(delegate()
            {
                if (NetworkInterface.GetAllNetworkInterfaces().Any(x => x.OperationalStatus == OperationalStatus.Up))
                {
                    WB_Ads.Navigate(Config.BuglistURL);
                }
            });
            lClickDonationThread.Start();


            // Initialize all plugins
            mPluginModule.initAllPlugins();


            // Hide all plugins what have the status "off"
            mPluginModule.CloseInactivePlugins();


            /*
             * Load session file passed as a command line parameter.
             * 1. Import it
             * 2. Load it
             * 3. Remove session
             */
            if (args != null && args.Length > 0)
            {
                loadDefaultSession(args[0]);
            }
        }