Beispiel #1
0
        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to minimize the program instead of closing it?", "Exit or minified", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Yes)
            {
                this.WindowState = FormWindowState.Minimized;
                hideToolStripMenuItemNotifyIcon.Text = "Show";
                this.ShowInTaskbar         = false;
                notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
                notifyIcon.BalloonTipTitle = "CinaRAT is now minified";
                notifyIcon.BalloonTipText  = "CinaRAT still running in background." +
                                             Environment.NewLine +
                                             "If you want to close the program, right click the icon and choose close.";
                notifyIcon.ShowBalloonTip(5000);
                e.Cancel = true;
            }
            else if (dr == DialogResult.No)
            {
                ListenServer.Disconnect();
                UPnP.DeletePortMap(Settings.ListenPort);
                notifyIcon.Visible = false;
                notifyIcon.Dispose();
                Instance = null;
            }
            else if (dr == DialogResult.Cancel)
            {
                e.Cancel = true;
            }
        }
Beispiel #2
0
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     ConServer.Disconnect();
     UPnP.DeletePortMap(XMLSettings.ListenPort);
     nIcon.Visible = false;
     nIcon.Dispose();
     Instance = null;
 }
Beispiel #3
0
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     ListenServer.Disconnect();
     UPnP.DeletePortMap(Ayarlar.ListenPort);
     notifyIcon.Visible = false;
     notifyIcon.Dispose();
     Instance = null;
 }
Beispiel #4
0
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     ListenServer.Disconnect();
     UPnP.DeletePortMap(Settings.ListenPort);
     UnregisterMessageHandler();
     _clientStatusHandler.Dispose();
     notifyIcon.Visible = false;
     notifyIcon.Dispose();
 }
Beispiel #5
0
        private void btnListen_Click(object sender, EventArgs e)
        {
            ushort port     = GetPortSafe();
            string password = txtPassword.Text;

            if (port == 0)
            {
                MessageBox.Show("Lütfen 0'dan büyük geçerli bir port giriniz..", "Lütfen geçerli bir port giriniz.", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            if (password.Length < 3)
            {
                MessageBox.Show("Lütfen en az 3 karakterden oluşan geçerli ve güvenilir bir şifre kullanınız.",
                                "Güvenli bir şifre giriniz.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (btnListen.Text == "Dinlemeye Başla" && !_listenServer.Listening)
            {
                try
                {
                    AES.SetDefaultKey(password);

                    if (chkUseUpnp.Checked)
                    {
                        if (!UPnP.IsDeviceFound)
                        {
                            MessageBox.Show("Kullanılabilir hiçbir UPnP Cihazı Tespit Edilemedi!", "UPnP Cihazı Tespit Edilemedi", MessageBoxButtons.OK,
                                            MessageBoxIcon.Information);
                        }
                        else
                        {
                            int outPort;
                            UPnP.CreatePortMap(port, out outPort);
                            if (port != outPort)
                            {
                                MessageBox.Show("UPnP Cihazıyla Bir Port Map Oluşturma Başarısız.!\nLütfen cihazınızın UPnP Port Map desteği olup olmadığına bakınız.", "Port map oluşturumu başarısız", MessageBoxButtons.OK,
                                                MessageBoxIcon.Warning);
                            }
                        }
                    }
                    if (chkNoIPIntegration.Checked)
                    {
                        NoIpUpdater.Start();
                    }
                    _listenServer.Listen(port);
                }
                finally
                {
                    btnListen.Text      = "Dinlemeyi Durdur";
                    ncPort.Enabled      = false;
                    txtPassword.Enabled = false;
                }
            }
            else if (btnListen.Text == "Dinlemeyi Durdur" && _listenServer.Listening)
            {
                try
                {
                    _listenServer.Disconnect();
                    UPnP.DeletePortMap(port);
                }
                finally
                {
                    btnListen.Text      = "Dinlemeye Başla";
                    ncPort.Enabled      = true;
                    txtPassword.Enabled = true;
                }
            }
        }
Beispiel #6
0
        private void btnListen_Click(object sender, EventArgs e)
        {
            ushort port     = GetPortSafe();
            string password = txtPassword.Text;

            if (port == 0)
            {
                MessageBox.Show("Please enter a valid port > 0.", "Please enter a valid port", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            if (password.Length < 3)
            {
                MessageBox.Show("Please enter a secure password with more than 3 characters.",
                                "Please enter a secure password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (btnListen.Text == "Start listening" && !_listenServer.Listening)
            {
                try
                {
                    AES.PreHashKey(password);

                    if (chkUseUpnp.Checked)
                    {
                        if (!UPnP.IsDeviceFound)
                        {
                            MessageBox.Show("No available UPnP device found!", "No UPnP device", MessageBoxButtons.OK,
                                            MessageBoxIcon.Information);
                        }
                        else
                        {
                            int outPort;
                            UPnP.CreatePortMap(port, out outPort);
                            if (port != outPort)
                            {
                                MessageBox.Show("Creating a port map with the UPnP device failed!\nPlease check if your device allows to create new port maps.", "Creating port map failed", MessageBoxButtons.OK,
                                                MessageBoxIcon.Warning);
                            }
                        }
                    }
                    if (chkNoIPIntegration.Checked)
                    {
                        NoIpUpdater.Start();
                    }
                    _listenServer.Listen(port);
                }
                finally
                {
                    btnListen.Text      = "Stop listening";
                    ncPort.Enabled      = false;
                    txtPassword.Enabled = false;
                }
            }
            else if (btnListen.Text == "Stop listening" && _listenServer.Listening)
            {
                try
                {
                    _listenServer.Disconnect();
                    UPnP.DeletePortMap(port);
                }
                finally
                {
                    btnListen.Text      = "Start listening";
                    ncPort.Enabled      = true;
                    txtPassword.Enabled = true;
                }
            }
        }
Beispiel #7
0
        private void btnListen_Click(object sender, EventArgs e)
        {
            ushort port = GetPortSafe();

            if (port == 0)
            {
                MessageBox.Show("Please enter a valid port > 0.", "Please enter a valid port", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            if (btnListen.Text == "Start listening" && !_listenServer.Listening)
            {
                try
                {
                    if (chkUseUpnp.Checked)
                    {
                        if (!UPnP.IsDeviceFound)
                        {
                            MessageBox.Show(this, "No available UPnP device found!", "No UPnP device", MessageBoxButtons.OK,
                                            MessageBoxIcon.Information);
                        }
                        else
                        {
                            int outPort;
                            UPnP.CreatePortMap(port, out outPort);
                            if (port != outPort)
                            {
                                MessageBox.Show(this, "Creating a port map with the UPnP device failed!\nPlease check if your device allows to create new port maps.", "Creating port map failed", MessageBoxButtons.OK,
                                                MessageBoxIcon.Warning);
                            }
                        }
                    }
                    if (chkNoIPIntegration.Checked)
                    {
                        NoIpUpdater.Start();
                    }
                    _listenServer.Listen(port, chkIPv6Support.Checked);
                }
                catch (SocketException ex)
                {
                    if (ex.ErrorCode == 10048)
                    {
                        MessageBox.Show(this, "The port is already in use.", "Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(this, $"An unexpected socket error occurred: {ex.Message}\n\nError Code: {ex.ErrorCode}\n\n", "Unexpected Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    _listenServer.Disconnect();
                }
                catch (Exception)
                {
                    _listenServer.Disconnect();
                }
                finally
                {
                    btnListen.Text         = "Stop listening";
                    ncPort.Enabled         = false;
                    chkIPv6Support.Enabled = false;
                }
            }
            else if (btnListen.Text == "Stop listening" && _listenServer.Listening)
            {
                try
                {
                    _listenServer.Disconnect();
                    UPnP.DeletePortMap(port);
                }
                finally
                {
                    btnListen.Text         = "Start listening";
                    ncPort.Enabled         = true;
                    chkIPv6Support.Enabled = true;
                }
            }
        }