Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CB_Interfaces_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Config.sInterfaces lIfcStruct = Config.GetIfcByID(Config.Interfaces[CB_Interfaces.SelectedIndex].sIfcID);

                if (lIfcStruct.sIfcName != null && lIfcStruct.sIfcName.Length > 0)
                {
                    String lIfcName = lIfcStruct.sIfcName.Length > 40 ? lIfcStruct.sIfcName.Substring(0, 40) + " ..." : lIfcStruct.sIfcName;
                    String lVendor  = MACVendor.getInstance().getVendorByMAC(lIfcStruct.sIfcGWMAC);

                    if (lVendor != null && lVendor.Length > 50)
                    {
                        lVendor = String.Format("{0} ...", lVendor.Substring(0, 50));
                    }

                    TB_GatewayIP.Text  = lIfcStruct.sIfcDefaultGW;
                    TB_GatewayMAC.Text = lIfcStruct.sIfcGWMAC;
                    TB_Vendor.Text     = lVendor;
                    TB_StartIP.Text    = lIfcStruct.sIfcNetAddr;
                    TB_StopIP.Text     = lIfcStruct.sIfcBcastAddr;
                    GB_Interfaces.Text = String.Format("{0} / {1}", lIfcStruct.sIfcIPAddr, lIfcName);

                    mCurrentIPAddress = lIfcStruct.sIfcIPAddr;
                }
            }
            catch (Exception lEx)
            {
                LogConsole.Main.LogConsole.pushMsg(lEx.StackTrace);
            }
        }
Ejemplo n.º 2
0
        private void setPoisoningBTOnStopped()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new setPoisoningBTOnStoppedDelegate(setPoisoningBTOnStopped), new object[] { });
                return;
            }


            int    lIfcIndex = CB_Interfaces.SelectedIndex;
            String lIfcID    = Config.GetIDByIndex(CB_Interfaces.SelectedIndex);

            Config.sInterfaces lIfcSelected = Config.GetIfcByID(lIfcID);

            BT_Attack.BackgroundImage = Properties.Resources.Start;


            /*
             * Customize GUI elements.
             */
            if (!mAttackStarted)
            {
                CB_Interfaces.Enabled = true;
            }

            TSMI_ShowSessions.Enabled     = true;
            TSMI_ResetPlugins.Enabled     = true;
            TSMI_SaveSession.Enabled      = true;
            TSMI_GetUpdates.Enabled       = true;
            TSMI_Exit.Enabled             = true;
            TSMI_Contribute.Enabled       = true;
            TSMI_ResetAllPlugins.Enabled  = true;
            TSMI_SearchInterfaces.Enabled = true;
            TSMI_ImportSessions.Enabled   = true;
            TSMI_ExportSessions.Enabled   = true;
            TB_StartIP.Enabled            = true;
            TB_StopIP.Enabled             = true;
            TB_Session.Enabled            = true;
            DGV_MainPlugins.Enabled       = true;

            try
            {
                if (mPoisoningEngProc != null && !mPoisoningEngProc.HasExited && mPoisoningEngProc.Responding)
                {
                    // 1. kill process
                    mPoisoningEngProc.Kill();
                    mPoisoningEngProc.CloseMainWindow();
                }
            }
            catch (Exception lEx)
            {
                LogConsole.Main.LogConsole.pushMsg(lEx.StackTrace);
            }

            try
            {
                // 2. start depoisoning procedure...
                Process mDepoisoningProc = new Process();
                mDepoisoningProc.StartInfo.FileName         = Config.APEPath;
                mDepoisoningProc.StartInfo.Arguments        = "-d " + Config.GetIDByIndex(CB_Interfaces.SelectedIndex);
                mDepoisoningProc.StartInfo.WorkingDirectory = Config.LocalBinariesPath;
                mDepoisoningProc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
                mDepoisoningProc.StartInfo.CreateNoWindow   = true;
                mDepoisoningProc.EnableRaisingEvents        = true;

                mDepoisoningProc.Start();
            }
            catch (Exception lEx)
            {
                LogConsole.Main.LogConsole.pushMsg(lEx.StackTrace);
            }
        }
Ejemplo n.º 3
0
        private void SetPoisoningBTOnStarted()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new SetPoisoningBTOnStartedDelegate(SetPoisoningBTOnStarted), new object[] { });
                return;
            }

            String lTargetHosts = String.Empty;

            ARPScan.Main.ARPScan lARPScan;


            if ((lARPScan = ARPScan.Main.ARPScan.getInstance()) != null)
            {
                /*
                 * Write APE Target list fileAPETargetHosts
                 * APETargetHosts
                 */
                foreach (TargetRecord lTmp in lARPScan.TargetList())
                {
                    if (lTmp.Status)
                    {
                        lTargetHosts += String.Format("{0},{1}\r\n", lTmp.IP, lTmp.MAC);
                    }
                }

                lTargetHosts = lTargetHosts.Trim();

                if (lTargetHosts.Length > 0)
                {
                    String             lTimeStamp       = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    int                lIfcIndex        = CB_Interfaces.SelectedIndex;
                    String             lIfcID           = Config.GetIDByIndex(CB_Interfaces.SelectedIndex);
                    Config.sInterfaces lIfcSelected     = Config.GetIfcByID(lIfcID);
                    String             lTargetHostsPath = Config.APETargetHostsPath;

                    using (StreamWriter lOutFile = new StreamWriter(lTargetHostsPath))
                    {
                        lOutFile.Write(lTargetHosts);
                    }



                    /*
                     * Customize GUI elements
                     */
                    TSMI_ShowSessions.Enabled     = false;
                    TSMI_ResetPlugins.Enabled     = false;
                    TSMI_SaveSession.Enabled      = false;
                    TSMI_GetUpdates.Enabled       = false;
                    TSMI_Exit.Enabled             = false;
                    TSMI_Contribute.Enabled       = false;
                    TSMI_ResetAllPlugins.Enabled  = false;
                    TSMI_SearchInterfaces.Enabled = false;
                    TSMI_ImportSessions.Enabled   = false;
                    TSMI_ExportSessions.Enabled   = false;
                    CB_Interfaces.Enabled         = false;
                    TB_StartIP.Enabled            = false;
                    TB_StopIP.Enabled             = false;
                    TB_Session.Enabled            = false;
                    DGV_MainPlugins.Enabled       = false;


                    /*
                     * onAttackStart()
                     */
                    foreach (IPlugin lPlugin in mPluginModule.PluginList)
                    {
                        if (lPlugin != null)
                        {
                            lPlugin.onStartAttack();
                        }
                    }



                    /*
                     * Start process
                     */
                    String lPoisonPath = String.Format(@"{0}\{1}\{2}", Directory.GetCurrentDirectory(), Config.BinaryDir, Config.APEBinary);

                    mPoisoningEngProc = new Process();
                    mPoisoningEngProc.StartInfo.WorkingDirectory = String.Format(@"{0}{1}", Directory.GetCurrentDirectory(), Config.BinaryDir);
                    mPoisoningEngProc.StartInfo.FileName         = lPoisonPath;
                    mPoisoningEngProc.StartInfo.Arguments        = String.Format("-x {0}", lIfcID);
                    mPoisoningEngProc.StartInfo.WindowStyle      = Config.DebugOn() ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden;
                    mPoisoningEngProc.StartInfo.CreateNoWindow   = Config.DebugOn() ? true : false;
                    mPoisoningEngProc.EnableRaisingEvents        = true;
                    mPoisoningEngProc.Exited += onPoisoningExited;

                    try
                    {
                        mCurrentSession.StartTime   = lTimeStamp;
                        mCurrentSession.Name        = TB_Session.Text;
                        mCurrentSession.Description = "Session startet on " + lTimeStamp;

                        BT_Attack.BackgroundImage = Properties.Resources.Stop;
                        mPoisoningEngProc.Start();
                    }
                    catch (Exception lEx)
                    {
                        MessageBox.Show("Can't start poisoning engine!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        LogConsole.Main.LogConsole.pushMsg("Can't start poisoning engine! - " + lEx.StackTrace + "\n" + lEx.ToString());
                    }
                }
            }
        }