Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            //Connecting to Database for data storage
            int sleep_time = 6000;

            try
            {
            }
            catch (Exception e)
            {
                sleep_time = sleep_time + sleep_time;
                if (sleep_time < 0)
                {
                    sleep_time = 12000;
                }
            }


            string tokenx            = "15AS94D";
            InitialDataCollector idc = new InitialDataCollector();
            OpenPortScan         ops = new OpenPortScan();
            ProcessMonitor       pm  = new ProcessMonitor();
            ResourceMonitor      rm  = new ResourceMonitor();
            ServiceMonitor       sm  = new ServiceMonitor();
            string ops_data          = ops.GetJson();
            //string pm_data = pm.GetJson();
            //string sm_data = sm.GetJson();
            //string rm_data = rm.GetJson();
            string idc_data = idc.GetJson();

            nic_info = idc.GetInterfaceCardInfo();
            string mac  = nic_info[3];
            string ip   = nic_info[0];
            string mask = nic_info[2];
            Agent  tm   = new Agent();


            APIRequest api = new APIRequest();

            Console.WriteLine(ops_data);

            //api.sendAllDataPM(pm_data,mac,tokenx);
            //api.sendAllDataDI(idc_data, mac, tokenx);
            //api.sendAllDataSM(sm_data, mac, tokenx);
            api.sendAllDataOPS(ops_data, mac, tokenx);

            Console.ReadKey();

            /*
             *
             */

            //while (true) {
            //     tm.Executioner(mac);
            //    System.Threading.Thread.Sleep(sleepy);
            //}


            /*
             * This Function Returns an Array Contain IP,Gateway,Subnet and MAC Addresses of active
             * Network Interface Card
             * Index 0 = IP Address
             * Index 1 = Gateway Address
             * Index 2 = Subnet Mask
             * Index 3 = MAC Address
             * Index 4 = NIC Type
             * Index 5 = Speed MB's
             */


            //ProcessMonitor pm = new ProcessMonitor();
            //ServiceMonitor sm = new ServiceMonitor();
            //ResourceMonitor rm = new ResourceMonitor();
            //OpenPortScan ops = new OpenPortScan();


            //TaskKill tk = new TaskKill();
            //tk.KillProcess(15072);
            //ServiceController sc = new ServiceController();
            //sc.StopService("olevba");
            //sc.StartService("nonpe");
            //Console.WriteLine("Hello World" + dbc.IsConnect());
        }