Ejemplo n.º 1
0
 public CreateNewGroup(ref List<Group> groups, Database db, ServerMain s)
 {
     InitializeComponent();
     this.groups = groups;
     this.db = db;
     this.p = s;
 }
Ejemplo n.º 2
0
        public DatabaseSettings(Database db)
        {
            InitializeComponent();

            this.db = db;

            try
            {
                if (this.db.GetUser() == "" || this.db.GetUser() == null)
                {
                    this.txtDBUserName.Text = "NOT SET";
                    this.txtDBPassword.Text = "NOT SET";
                    this.txtDBHost.Text = "NOT SET";
                }
                else
                {
                    this.txtDBUserName.Text = this.db.GetUser();
                    this.txtDBPassword.Text = this.db.GetPass();
                    this.txtDBHost.Text = this.db.GetHost();
                }

            }
            catch (System.Exception ex)
            {
                this.txtDBUserName.Text = "NOT SET";
                this.txtDBPassword.Text = "NOT SET";
                this.txtDBHost.Text = "NOT SET";
            }
        }
Ejemplo n.º 3
0
 public ChooseGroup(ref List<Group> groups,  object client,  ServerMain ad, Database db)
 {
     InitializeComponent();
     this.db = db;
     this.groups = groups;
     this.client = (ClientThread)client;
     this.ad = ad;
 }
Ejemplo n.º 4
0
        public ServerMain()
        {
            InitializeComponent();
            db = new Database();
            groups = new List<Group>();
            groups = db.GetGroups();
            offlineClients = new List<KnownClient>();
            ProcessDataTable = new DataTable("Processes");

            ProcessDataTable.Columns.Add("Process ID", typeof(int));
            ProcessDataTable.Columns.Add("Process Name", typeof(string));
            ProcessDataTable.Columns.Add("CPU %", typeof(int));
            ProcessDataTable.Columns.Add("Memory KB", typeof(int));
            ProcessDataTable.Columns.Add("Thread Count", typeof(int));

            ServiceDataTable = new DataTable("Services");
            ServiceDataTable.Columns.Add("Service Name", typeof(string));
            ServiceDataTable.Columns.Add("Service Type", typeof(string));
            ServiceDataTable.Columns.Add("Display Name", typeof(string));
            ServiceDataTable.Columns.Add("Current Status", typeof(string));
            ServiceDataTable.Columns.Add("Startup Type", typeof(string));

            TaskDataTable = new DataTable("Tasks");
            TaskDataTable.Columns.Add("Task Name", typeof(string));
            TaskDataTable.Columns.Add("Task Description", typeof(string));

            TaskTriggerDataTable = new DataTable("TasksTriggers");
            TaskTriggerDataTable.Columns.Add("Trigger", typeof(string));
            TaskTriggerDataTable.Columns.Add("Trigger Details", typeof(string));
            TaskTriggerDataTable.Columns.Add("Trigger Status", typeof(string));

            TaskActionDataTable = new DataTable("TasksActions");
            TaskActionDataTable.Columns.Add("Action", typeof(string));
            TaskActionDataTable.Columns.Add("File To Run", typeof(string));

            foreach (DataGridViewColumn column in  dataGridTask.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            foreach (DataGridViewColumn column in dataGridTaskTrigger.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            foreach (DataGridViewColumn column in dataGridTaskAction.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Form Constructor
        /// </summary>
        /// <param name="ProcList">Current Known Processes, Built from parent form data grid</param>
        /// <param name="client">Client for commands to be sent too</param>
        /// <param name="parent">parent form</param>
        public NewProcess(ClientThread client, ServerMain parent, Database db)
        {
            s = parent;
            List<string> ProcList = db.GetProcesses(client.GetCompID());
            ProcList.Sort();
            InitializeComponent();
            this.client = client;
            string clientName = client.GetComputerName().Split('\0')[0];
            lstBoxProcesses.Items.Clear();
            toolLblConnectedClient.Text += clientName;

            foreach(string procname in ProcList)
            {
                lstBoxProcesses.Items.Add(procname + ".exe");
            }
        }
Ejemplo n.º 6
0
 private void SaveDatabase(Database db)
 {
     Stream fs = File.Create("db.bin");
     BinaryFormatter serializer = new BinaryFormatter();
     serializer.Serialize(fs, db);
     fs.Close();
 }
Ejemplo n.º 7
0
        public void RunLocalServer()
        {
            mainDatabase = new Database();
            mainDatabase.ConnectToDatabase();

            unloggedClients = new List<Client>();
            Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            socket.Bind(new IPEndPoint(IPAddress.Loopback, 8888));
            socket.Listen(10);
            mainSocket = socket;
            Thread socketListening = new Thread(SocketListening);
            socketListening.Start();

            Console.WriteLine("Database test");
            List<string> users = mainDatabase.SelectUsers("Pepa", "1234");
            for (int i = 0; i < users.Count; i++)
            {
                Console.WriteLine(users[i]);
            }
        }