Exemplo n.º 1
0
        public static string GetResultRequest(ProgRecord pr)
        {
            string       url       = "http://intranet.cervello.pl/endpointstate.php?ids=" + pr.pAlias + "&ipaddress=" + pr.pIP + "&state=" + pr.pActive;
            MyWebRequest myRequest = new MyWebRequest(url, "POST", "ids=" + pr.pAlias + "&ipaddress=" + pr.pIP + "&state=" + pr.pActive);

            return(myRequest.GetResponse());
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string endpointUrl = "http://intranet.cervello.pl/endpointstate.php?";
            string karolinMS   = "ids=KarolinSrvWin&ipaddress=192.168.1.10&state=1";

            Console.WriteLine("Sen EHLO from server");
            MyWebRequest myRequest2 = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?" + karolinMS, "POST", karolinMS);

            //show the response string on the console screen.
            Console.WriteLine(myRequest2.GetResponse());
            Process[] processlist = Process.GetProcesses();
            string    camE        = @"E:\ufo4\UFO2.exe";
            int       cE          = 0;
            string    camW        = @"E:\ufo3\UFO2.exe";
            int       cW          = 0;
            string    camN        = @"E:\ufo5\UFO2.exe";
            int       cN          = 0;
            string    camS        = @"E:\ufo\UFO2.exe";
            int       cS          = 0;
            string    camZ        = @"E:\ufo6\UFO2.exe";
            int       cZ          = 0;
            string    spyi        = @"C:\program files\ispy\ispy.exe";
            int       cI          = 0;

            List <ProgRecord> cams      = new List <ProgRecord>();
            List <ProgRecord> progs     = new List <ProgRecord>();
            ProgRecord        camBramaW = new ProgRecord("CamBramaW", "/", "CamBramaW", 0, "192.168.1.15", ProgRecord.objType.Camera);
            ProgRecord        camBramaN = new ProgRecord("CamBramaN", "/", "CamBramaN", 0, "192.168.1.23", ProgRecord.objType.Camera);
            ProgRecord        camMN     = new ProgRecord("MetcamNorth", "/", "MetcamNorth", 0, "192.168.1.16", ProgRecord.objType.Camera);
            ProgRecord        camMS     = new ProgRecord("MetcamSouth", "/", "MetcamSouth", 0, "192.168.1.14", ProgRecord.objType.Camera);
            ProgRecord        camME     = new ProgRecord("MetcamEast", "/", "MetcamEast", 0, "192.168.1.17", ProgRecord.objType.Camera);
            ProgRecord        camMW     = new ProgRecord("MetcamWest", "/", "MetcamWest", 0, "192.168.1.18", ProgRecord.objType.Camera);
            ProgRecord        camMZ     = new ProgRecord("MetcamZenith", "/", "MetcamZenith", 0, "192.168.1.19", ProgRecord.objType.Camera);

            cams.Add(camMN);
            cams.Add(camMZ);
            cams.Add(camME);
            cams.Add(camMS);
            cams.Add(camMW);
            camBramaW.pActive = isHostAlive(camBramaW);
            camBramaN.pActive = isHostAlive(camBramaN);
            camMN.pActive     = isHostAlive(camMN);
            camMS.pActive     = isHostAlive(camMS);
            camME.pActive     = isHostAlive(camME);
            camMW.pActive     = isHostAlive(camMW);
            camMZ.pActive     = isHostAlive(camMZ);
            Console.WriteLine(GetResultRequest(camBramaN));
            Console.WriteLine(GetResultRequest(camBramaW));
            Console.WriteLine(GetResultRequest(camMN));
            Console.WriteLine(GetResultRequest(camMS));
            Console.WriteLine(GetResultRequest(camMW));
            Console.WriteLine(GetResultRequest(camME));
            Console.WriteLine(GetResultRequest(camMZ));


            foreach (Process theprocess in processlist)
            {
                //Console.WriteLine("MM:" + theprocess.StartInfo.FileName);
                //Console.WriteLine("MM:" + theprocess.StartInfo.WorkingDirectory);
                string id = GetMainModuleFilepath(theprocess.Id);
                //Console.WriteLine("Process: " + id);
                if (id == camE)
                {
                    Console.WriteLine("UFO2 for cam E runing");
                    //http://intranet.cervello.pl/endpointstate.php?ids=MetcamEast&ipaddress=10&state=1
                    MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoECam&ipaddress=10&state=1", "POST", "ids=UfoECam&ipaddress=10&state=1");
                    //show the response string on the console screen.
                    Console.WriteLine(myRequest.GetResponse());
                    cE = 1;
                }
                else if (id == camN)
                {
                    MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoNCam&ipaddress=10&state=1", "POST", "ids=UfoNCam&ipaddress=10&state=1");
                    //show the response string on the console screen.
                    Console.WriteLine(myRequest.GetResponse());
                    Console.WriteLine("UFO2 for cam N runing");
                    cN = 1;
                }
                else if (id == camS)
                {
                    MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoSCam&ipaddress=10&state=1", "POST", "ids=UfoSCam&ipaddress=10&state=1");
                    //show the response string on the console screen.
                    Console.WriteLine(myRequest.GetResponse());
                    Console.WriteLine("UFO2 for cam S runing");
                    cS = 1;
                }
                else if (id == camW)
                {
                    MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=MetcamWest&ipaddress=10&state=1", "POST", "ids=MetcamWest&ipaddress=10&state=1");
                    //show the response string on the console screen.
                    Console.WriteLine(myRequest.GetResponse());
                    cW = 1;
                    Console.WriteLine("UFO2 for cam W runing");
                }
                else if (id == camZ)
                {
                    MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=MetcamZenith&ipaddress=10&state=1", "POST", "ids=MetcamZenith&ipaddress=10&state=1");
                    //show the response string on the console screen.
                    Console.WriteLine(myRequest.GetResponse());
                    cZ = 1;
                    Console.WriteLine("UFO2 for cam Z runing");
                }
                else if (id == spyi)
                {
                    MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=iSpyKarolin&ipaddress=10&state=1", "POST", "ids=iSpyKarolin&ipaddress=10&state=1");
                    //show the response string on the console screen.
                    Console.WriteLine(myRequest.GetResponse());
                    Console.WriteLine("iSpy runing");
                    cI = 1;
                }
                else
                {
                    // Console.WriteLine("Not ufoprocess");
                }
                //Console.WriteLine("MM:" + id);
            }
            if (cI == 0)
            {
                MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=iSpyKarolin&ipaddress=10&state=0", "POST", "ids=iSpyKarolin&ipaddress=10&state=0");
                //show the response string on the console screen.
                Console.WriteLine(myRequest.GetResponse());
            }
            if (cE == 0)
            {
                MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoECam&ipaddress=10&state=0", "POST", "ids=UfoECam&ipaddress=10&state=0");
                //show the response string on the console screen.
                Console.WriteLine(myRequest.GetResponse());
            }
            if (cN == 0)
            {
                MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoNCam&ipaddress=10&state=0", "POST", "ids=UfoNCam&ipaddress=10&state=0");
                //show the response string on the console screen.
                Console.WriteLine(myRequest.GetResponse());
            }
            if (cS == 0)
            {
                MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoSCam&ipaddress=10&state=0", "POST", "ids=UfoSCam&ipaddress=10&state=0");
                //show the response string on the console screen.
                Console.WriteLine(myRequest.GetResponse());
            }
            if (cW == 0)
            {
                MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoWCam&ipaddress=10&state=0", "POST", "ids=UfoWCam&ipaddress=10&state=0");
                //show the response string on the console screen.
                Console.WriteLine(myRequest.GetResponse());
            }
            if (cZ == 0)
            {
                MyWebRequest myRequest = new MyWebRequest("http://intranet.cervello.pl/endpointstate.php?ids=UfoZCam&ipaddress=10&state=0", "POST", "ids=UfoZCam&ipaddress=10&state=0");
                //show the response string on the console screen.
                Console.WriteLine(myRequest.GetResponse());
            }
        }