示例#1
0
文件: cmp.cs 项目: rlaneyjr/cheaters
        static void Main(string[] args)
        {
            if (args.Length < 3)
            {
                Console.WriteLine("Usage: getConfig <NS IP> username password");
                return;
            }
            string serverip = args[0];
            string username = args[1];
            string password = args[2];

            try {
                Console.WriteLine("\nConnecting to server " + serverip + " ............\n");
                client = new ClientService(serverip);

                client.CookieContainer = new System.Net.CookieContainer();
                simpleResult result = client.login(username, password);
                Console.WriteLine("login : "******"enablensfeature	CMP : "+ result.message);

                result = client.addserver("s1", "10.102.3.91", null, enabledisabledEnum.VALNOTSET);
                Console.WriteLine("addserver	s1 : "+ result.message);

                result = client.addserver("s2", "10.102.3.92", null, enabledisabledEnum.VALNOTSET);
                Console.WriteLine("addserver	s2 : "+ result.message);

                result = client.addservice("srv1", null, "s1", servicetypeEnum.HTTP, 80, 0xFFFFFFFF, cachtypeEnum.VALNOTSET, enabledisabledEnum.VALNOTSET);
                Console.WriteLine("addservice	srv1 : "+ result.message);

                result = client.addservice("srv2", null, "s2", servicetypeEnum.HTTP, 80, 0xFFFFFFFF, cachtypeEnum.VALNOTSET, enabledisabledEnum.VALNOTSET);
                Console.WriteLine("addservice	srv2 : "+ result.message);


                result = client.addlbvserver("lbvip1", vservicetypeEnum.HTTP, null, 0xFFFFFFFF, 0xFFFFFFFF, enabledisabledEnum.VALNOTSET, null);
                Console.WriteLine("addlbvserver	lbvip1 : " + result.message);

                result = client.addlbvserver("lbvip2", vservicetypeEnum.HTTP, null, 0xFFFFFFFF, 0xFFFFFFFF, enabledisabledEnum.VALNOTSET, null);
                Console.WriteLine("addlbvserver	lbvip2 : " + result.message);


                result = client.bindlbvserver_service("lbvip1", "srv1", 0xFFFFFFFF);
                Console.WriteLine("bindlbvserver_service	lbvip1 : "+ result.message);

                result = client.bindlbvserver_service("lbvip2", "srv2", 0xFFFFFFFF);
                Console.WriteLine("bindlbvserver_service	lbvip2 : "+ result.message);


                result = client.setservice_cmp("srv1", yesnoEnum.YES);
                Console.WriteLine("setservice_cmp	srv1 : "+ result.message);

                result = client.setservice_cmp("srv2", yesnoEnum.NO);
                Console.WriteLine("setservice_cmp	srv2 : "+ result.message);

                result = client.addcmppolicy("cmp1", "url == /testsite/file5.html", "nocompress");
                Console.WriteLine("addcmppolicy	cmp1 : " + result.message);

                result = client.bindcmpglobal_policy("cmp1", 0xFFFFFFFF, enabledisabledEnum.VALNOTSET);
                Console.WriteLine("bindcmpglobal_policy	cmp1 : " + result.message);

                result = client.addpolicyexpression("ex1", "RES.HTTP.HEADER Content-Type CONTAINS application/msword");
                Console.WriteLine("addpolicyexpression	ex1 : "+ result.message);

                result = client.addcmppolicy("cmp2", "ex1", "deflate");
                Console.WriteLine("addcmppolicy	cmp2 : " + result.message);

                result = client.bindcmpglobal_policy("cmp2", 0xFFFFFFFF, enabledisabledEnum.VALNOTSET);
                Console.WriteLine("bindcmpglobal_policy	cmp2 : " + result.message);

                result = client.addcmppolicy("cmp3", "url contains file50 || RES.HTTP.HEADER Content-Type CONTAINS text/css", "deflate");
                Console.WriteLine("addcmppolicy	cmp3 : " + result.message);

                result = client.addpolicyexpression("ex2", "HEADER User-Agent CONTAINS MSIE");
                Console.WriteLine("addpolicyexpression	ex2 : "+ result.message);

                result = client.addpolicyexpression("ex3", "RES.HTTP.HEADER Content-Type CONTAINS application/vnd.ms-excel");
                Console.WriteLine("addpolicyexpression	ex3 : "+ result.message);

                result = client.addcmppolicy("cmp4", "ex2&&ex3", "gzip");
                Console.WriteLine("addcmppolicy	cmp4 : " + result.message);

                result = client.logout();
                Console.WriteLine("logout : " + result.message);
            }
            catch (Exception ex) {
                Console.WriteLine("Exception: " + ex.ToString());
            }
        }
示例#2
0
文件: cmp.cs 项目: rlaneyjr/cheaters
        static void Main(string[] args)
        {
            if ( args.Length < 3)
            {
                Console.WriteLine("Usage: getConfig <NS IP> username password");
                return;
            }
            string serverip = args[0];
            string username = args[1];
            string password = args[2];
            try {
              			Console.WriteLine("\nConnecting to server "+serverip+" ............\n");
                client = new ClientService(serverip);

                client.CookieContainer = new System.Net.CookieContainer();
                simpleResult result = client.login(username,password) ;
                Console.WriteLine("login : "******"enablensfeature	CMP : " + result.message);

                        result = client.addserver("s1", "10.102.3.91", null, enabledisabledEnum.VALNOTSET);
                        Console.WriteLine("addserver	s1 : " + result.message);

                        result = client.addserver("s2", "10.102.3.92", null, enabledisabledEnum.VALNOTSET);
                        Console.WriteLine("addserver	s2 : " + result.message);

                        result = client.addservice("srv1", null, "s1", servicetypeEnum.HTTP, 80, 0xFFFFFFFF, cachtypeEnum.VALNOTSET, enabledisabledEnum.VALNOTSET);
                        Console.WriteLine("addservice	srv1 : " + result.message);

                        result = client.addservice("srv2", null, "s2", servicetypeEnum.HTTP, 80, 0xFFFFFFFF, cachtypeEnum.VALNOTSET, enabledisabledEnum.VALNOTSET);
                        Console.WriteLine("addservice	srv2 : " + result.message);

                        result = client.addlbvserver("lbvip1", vservicetypeEnum.HTTP, null, 0xFFFFFFFF, 0xFFFFFFFF, enabledisabledEnum.VALNOTSET, null);
                        Console.WriteLine("addlbvserver	lbvip1 : " + result.message);

                        result = client.addlbvserver("lbvip2", vservicetypeEnum.HTTP, null, 0xFFFFFFFF, 0xFFFFFFFF, enabledisabledEnum.VALNOTSET, null);
                        Console.WriteLine("addlbvserver	lbvip2 : " + result.message);

                        result = client.bindlbvserver_service("lbvip1", "srv1", 0xFFFFFFFF);
                        Console.WriteLine("bindlbvserver_service	lbvip1 : " + result.message);

                        result = client.bindlbvserver_service("lbvip2", "srv2", 0xFFFFFFFF);
                        Console.WriteLine("bindlbvserver_service	lbvip2 : " + result.message);

                result = client.setservice_cmp("srv1",yesnoEnum.YES);
                Console.WriteLine("setservice_cmp	srv1 : " + result.message);

                result = client.setservice_cmp("srv2",yesnoEnum.NO);
                Console.WriteLine("setservice_cmp	srv2 : " + result.message);

                result = client.addcmppolicy("cmp1","url == /testsite/file5.html","nocompress");
                Console.WriteLine("addcmppolicy	cmp1 : " + result.message);

                result = client.bindcmpglobal_policy("cmp1",0xFFFFFFFF,enabledisabledEnum.VALNOTSET);
                Console.WriteLine("bindcmpglobal_policy	cmp1 : " + result.message);

                result = client.addpolicyexpression("ex1","RES.HTTP.HEADER Content-Type CONTAINS application/msword");
                Console.WriteLine("addpolicyexpression	ex1 : " + result.message);

                result = client.addcmppolicy("cmp2","ex1","deflate");
                Console.WriteLine("addcmppolicy	cmp2 : " + result.message);

                result = client.bindcmpglobal_policy("cmp2",0xFFFFFFFF,enabledisabledEnum.VALNOTSET);
                Console.WriteLine("bindcmpglobal_policy	cmp2 : " + result.message);

                result = client.addcmppolicy("cmp3","url contains file50 || RES.HTTP.HEADER Content-Type CONTAINS text/css","deflate");
                Console.WriteLine("addcmppolicy	cmp3 : " + result.message);

                result = client.addpolicyexpression("ex2","HEADER User-Agent CONTAINS MSIE");
                Console.WriteLine("addpolicyexpression	ex2 : " + result.message);

                result = client.addpolicyexpression("ex3","RES.HTTP.HEADER Content-Type CONTAINS application/vnd.ms-excel");
                Console.WriteLine("addpolicyexpression	ex3 : " + result.message);

                result = client.addcmppolicy("cmp4","ex2&&ex3","gzip");
                Console.WriteLine("addcmppolicy	cmp4 : " + result.message);

                result = client.logout();
                Console.WriteLine("logout : " + result.message);
            }
            catch (Exception ex) {
                  Console.WriteLine( "Exception: "+ex.ToString());
            }
        }