Пример #1
0
        private async void ListViewDevices_DoubleClick(object sender, EventArgs e)
        {
            TamperProtection selectedEndpointTamperProtection = await GetSophosEndpointTamperProtection(AccessToken, ListViewDevices.SelectedItems[0].Tag.ToString(), PartnerTenants[ListBoxKunden.SelectedIndex].id, PartnerTenants[ListBoxKunden.SelectedIndex].apiHost);

            EndpointFenster EndpointDetail = new EndpointFenster();

            EndpointDetail.LabelHostname.Text     = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].hostname;
            EndpointDetail.LabelKundenName.Text   = PartnerTenants[ListBoxKunden.SelectedIndex].name;
            EndpointDetail.LabelEndpointType.Text = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].type;
            if (SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].health != null)
            {
                EndpointDetail.LabelGesamtStatus.Text     = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].health.overall;
                EndpointDetail.LabelDienstStatus.Text     = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].health.services.status;
                EndpointDetail.LabelBedrohungsStatus.Text = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].health.threats.status;
            }
            if (SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].associatedPerson != null)
            {
                EndpointDetail.LabelBenutzerLogin.Text = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].associatedPerson.viaLogin;
                EndpointDetail.LabelBenutzerName.Text  = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].associatedPerson.name;
            }
            EndpointDetail.LabelOSPlatform.Text  = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].os.platform;
            EndpointDetail.LabelOSName.Text      = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].os.name;
            EndpointDetail.LabelOSBuild.Text     = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].os.build.ToString();
            EndpointDetail.LabelIPv4Address.Text = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].ipv4Addresses[0];
            if (SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].ipv6Addresses != null)
            {
                EndpointDetail.LabelIPv6Address.Text = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].ipv6Addresses[0];
            }
            EndpointDetail.LabelTamperProtectionStatus.Text   = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].tamperProtectionEnabled.ToString();
            EndpointDetail.LabelTamperProtectionPassword.Text = selectedEndpointTamperProtection.password;
            EndpointDetail.LabelLastSeen.Text = SelectedTenantEndpoints[ListViewDevices.SelectedItems[0].Index].lastSeenAt;
            EndpointDetail.ShowDialog();
        }
Пример #2
0
        private async void MapulationsschutzkennwortAbrufenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TamperProtection selectedEndpointTamperProtection = await GetSophosEndpointTamperProtection(AccessToken, ListViewDevices.SelectedItems[0].Tag.ToString(), PartnerTenants[ListBoxKunden.SelectedIndex].id, PartnerTenants[ListBoxKunden.SelectedIndex].apiHost);

            Clipboard.SetText(selectedEndpointTamperProtection.password);
            MessageBox.Show("Manipulationsschutzkennwort: " + selectedEndpointTamperProtection.password + "\n\n(In Zwischenablage kopiert)");
        }
Пример #3
0
        private static async Task <TamperProtection> GetSophosEndpointTamperProtection(Token AccessToken, String EndpointID, String TenantID, String TenanantURI)
        {
            try {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(TenanantURI);
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer " + AccessToken.AccessToken);
                    client.DefaultRequestHeaders.Add("X-Tenant-ID", TenantID);
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                    var response = client.GetAsync("endpoint/v1/endpoints/" + EndpointID + "/tamper-protection").Result;
                    response.EnsureSuccessStatusCode();
                    var jsonContent = await response.Content.ReadAsStringAsync();

                    TamperProtection EndpointTamperProtection = JsonConvert.DeserializeObject <TamperProtection>(jsonContent);
                    return(EndpointTamperProtection);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Fehler beim Abruf des Manipulationsschutzes: \n" + e.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(new TamperProtection());
            }
        }