Ejemplo n.º 1
0
        private void dataWipeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure, you want to delete all the data in the device?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                CodeproofServiceClient cpservice = new CodeproofServiceClient();

                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    Authenticate authObj        = (Authenticate)((object[])item.Tag)[0];
                    CPID         selectedDevice = (CPID)((object[])item.Tag)[1];

                    CommandRecord cmd = new CommandRecord();

                    cmd.Command = "datawipe";//do not change this

                    cmd.CommandName = "SDK data wipe cmd test";
                    cmd.Notes       = "SDK sample test command";

                    CommandRecord cmdupdated = cpservice.ExecuteCommand(authObj, selectedDevice, cmd);
                    MessageBox.Show(cmdupdated.Status);

                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0)
            {
                MessageBox.Show("Pleas enter a message");
                textBox1.Focus();
                return;
            }

            button1.Enabled = false;

            //send push message command

            CodeproofServiceClient cpservice = new CodeproofServiceClient();

            CommandRecord cmd = new CommandRecord();

            cmd.Command = "sendmessage";//do not change this

            cmd.CommandName = "SDK send message test";
            cmd.Param1      = textBox1.Text;
            cmd.Notes       = "SDK sample test command";

            CommandRecord cmdupdated = cpservice.ExecuteCommand(authObj, selectedDevice, cmd);

            MessageBox.Show(cmdupdated.Status);

            button1.Enabled = true;
            this.Close();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            //
            // The following sample C# code shows how to enable restriction policies programmatically. Also demonstrates time-based restrictions.
            //


            Authenticate AuthObj = new Authenticate();

            AuthObj.userid = "--your account login email goes here--";
            AuthObj.apikey = "--your API key goes here--"; //API key is available here at "https://www.codeproof.com/console/Account/Login?ReturnUrl=/console/MyAccount/Index"

            CodeproofServiceClient cpservice = new CodeproofServiceClient();

            //
            //Enable Restriction Policies
            //
            //
            // Below "SDK-Test-group" is a group name or individual node name(device name) in the Codeproof console (Mobile Policy Manager).
            //

            string result;

            //
            // Disables camera from the device(s)
            //
            result = cpservice.AddPolicy(AuthObj, managedGroup, productId, "iOS General Policy", "allowCamera", "false");

            result = cpservice.AddPolicy(AuthObj, managedGroup, productId, "iOS Group Policy", "Deploy", "true");
            result = cpservice.AddPolicy(AuthObj, managedGroup, productId, "iOS Group Policy", "Inherit", "0");

            //
            //Turn-off camera for 60 secs only (Time based restriction policies).
            //
            //result = cpservice.AddPolicy(AuthObj, managedGroup, productId, "iOS Group Policy", "DurationUntilRemoval", "60");
            //


            //send policy to device
            result = cpservice.PingDevice(AuthObj, managedGroup);



            //Remove all restrictions - forcefully

            cpservice.AddPolicy(AuthObj, managedGroup, productId, "iOS Group Policy", "Deploy", "false");
            cpservice.PingDevice(AuthObj, managedGroup);
        }
Ejemplo n.º 4
0
        private void lockToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CodeproofServiceClient cpservice = new CodeproofServiceClient();

            foreach (ListViewItem item in listView1.SelectedItems)
            {
                Authenticate authObj        = (Authenticate)((object[])item.Tag)[0];
                CPID         selectedDevice = (CPID)((object[])item.Tag)[1];

                CommandRecord cmd = new CommandRecord();

                cmd.Command = "screenlock";//do not change this

                cmd.CommandName = "SDK screen lock cmd test";
                cmd.Notes       = "SDK sample test command";

                CommandRecord cmdupdated = cpservice.ExecuteCommand(authObj, selectedDevice, cmd);
                MessageBox.Show(cmdupdated.Status);
                break;
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            //
            // The following sample C# code shows how to enable "Single App Mode(App Lock)" programmatically in iOS devices.
            //


            Authenticate AuthObj = new Authenticate();

            AuthObj.userid = "--your account login email goes here--";
            AuthObj.apikey = "--your API key goes here--"; //API key is available here at https://www.codeproof.com/console/Account/Login?ReturnUrl=/console/MyAccount/Index

            CodeproofServiceClient cpservice = new CodeproofServiceClient();

            //
            //Enable Single App Mode (App Lock) programatically
            //
            // NOTE:In order to enable Single App Mode, iOS devices must be configured as "Supervised" Devices.
            //


            Console.WriteLine("Enabling single app mode for: Safari browser app (com.apple.safari)");

            //
            // Enable single app mode
            //
            EnableKiosk("com.apple.safari");

            System.Threading.Thread.Sleep(60000); //60 secs

            Console.WriteLine("Removing Kiosk mode...");

            //Remove Single App Mode (App Lock) - forcefully

            RemoveKiosk();

            Console.WriteLine("Done!");
        }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0)
            {
                MessageBox.Show("Please enter valid Codeproof Account email-id");
                textBox1.Focus();
                return;
            }
            else
            if (textBox2.Text.Length == 0)
            {
                MessageBox.Show("Please enter valid Codeproof API Key");
                textBox2.Focus();
                return;
            }

            button1.Enabled = false;
            listView1.Items.Clear();

            Authenticate authObj = new Authenticate();

            authObj.userid = textBox1.Text;
            authObj.apikey = textBox2.Text;

            CodeproofServiceClient cpservice = new CodeproofServiceClient();

            //get Codeproof device identifiers
            CPID[] cpids = cpservice.GetCPIDs(authObj);

            foreach (CPID deviceRecord in cpids)
            {
                DeviceProperty dp = cpservice.GetDeviceProperty(authObj, deviceRecord);

                List <string> items = new List <string>();

                items.Add(GetPropValue(dp.DeviceInformations, "DeviceName"));
                items.Add(GetPropValue(dp.DeviceInformations, "PhoneNumber"));

                string id = GetPropValue(dp.DeviceInformations, "UDID");
                if (id == null)
                {
                    items.Add(GetPropValue(dp.DeviceInformations, "SecureAndroidId"));
                }
                else
                {
                    items.Add(id);
                }

                items.Add(GetPropValue(dp.DeviceInformations, "Manufacturer"));

                items.Add(GetPropValue(dp.DeviceInformations, "ModelName"));

                items.Add(GetPropValue(dp.DeviceInformations, "OSName"));

                items.Add(GetPropValue(dp.DeviceInformations, "OSVersion"));

                items.Add(dp.LastCheckinTime);

                ListViewItem listViewItem1 = new ListViewItem(items.ToArray());

                listViewItem1.Tag = new object[] { authObj, deviceRecord, dp.DeviceInformations }; //pass object array

                listView1.Items.AddRange(new ListViewItem[] { listViewItem1 });
            }

            button1.Enabled = true;
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Authenticate AuthObj = new Authenticate();

            AuthObj.userid = "--your account login email goes here--";
            AuthObj.apikey = "--your API key goes here--"; //API key is available here at "https://www.codeproof.com/console/Account/Login?ReturnUrl=/console/MyAccount/Index"

            CodeproofServiceClient cpservice = new CodeproofServiceClient();

            //get CPIDs

            CPID[] cpids = cpservice.GetCPIDs(AuthObj);

            foreach (CPID record in cpids)
            {
                //Query each device properties from Codeproof Cloud.

                DeviceProperty dp = cpservice.GetDeviceProperty(AuthObj, record);


                Console.WriteLine("\n\n");
                Console.WriteLine("=== Device [ " + dp.DeviceName + "] Data ===");
                Console.WriteLine("\n\n");

                //Show Device Ids
                Console.WriteLine("cpid=" + record.cpid);
                Console.WriteLine("devicetype=" + record.devicetype);
                Console.WriteLine("deviceid=" + record.deviceid);

                //Show Device Properties
                Console.WriteLine("\n");
                Console.WriteLine("---Device Properties -->");
                Console.WriteLine("\n");
                foreach (NameValue prop in dp.DeviceInformations)
                {
                    Console.WriteLine(prop.Name + " = " + prop.Value);
                }

                //Show Installed Apps
                Console.WriteLine("\n");
                Console.WriteLine("---Installed Applications -->");
                Console.WriteLine("\n");
                foreach (App app in dp.InstalledApplications)
                {
                    Console.WriteLine("App Name = " + app.AppName);
                    Console.WriteLine("App Version = " + app.Version);
                    Console.WriteLine("App Package = " + app.PackageName);
                    Console.WriteLine("");
                }

                //Show iOS running programs
                Console.WriteLine("\n");
                Console.WriteLine("---iOS Running Programs -->");
                Console.WriteLine("\n");
                foreach (Process process in dp.RunningProcess)
                {
                    Console.WriteLine("Process Name = " + process.Name);
                    Console.WriteLine("Process Id = " + process.Pid);
                    Console.WriteLine("Process Started At = " + process.ProcessStartedAt);
                    Console.WriteLine("");
                }

                //Show Android Running Apps
                Console.WriteLine("\n");
                Console.WriteLine("---Android Running Applications -->");
                Console.WriteLine("\n");
                foreach (App app in dp.RunningApplications)
                {
                    Console.WriteLine("App Name = " + app.AppName);
                    Console.WriteLine("App Version = " + app.Version);
                    Console.WriteLine("App Package = " + app.PackageName);
                    Console.WriteLine("");
                }

                //Show Android Running Services
                Console.WriteLine("\n");
                Console.WriteLine("---Android Running Services -->");
                Console.WriteLine("\n");
                foreach (App app in dp.RunningServices)
                {
                    Console.WriteLine("App Name = " + app.AppName);
                    Console.WriteLine("App Version = " + app.Version);
                    Console.WriteLine("App Package = " + app.PackageName);
                    Console.WriteLine("");
                }
            }
        }