comment
IRC Chat
play_arrow
Este sitio utiliza cookies propias y de terceros. Si continúa navegando consideramos que acepta el uso de cookies. OK Más Información.

[VB.NET] WindowsSecurityCenter by fudmario

  • 0 Respuestas
  • 1820 Vistas

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado fudmario

  • *
  • Cramel
  • *
  • Mensajes: 194
  • Actividad:
    1.67%
  • Reputación 11
    • Ver Perfil
    • fudmario - GitHub
  • Skype: fudmario
« en: Diciembre 22, 2016, 02:19:20 pm »


Implementacion de Windows Security Center (WSC) en vb.net, cualquier error o sugerencia enviarlo por MP o Skype...


Ejemplo de Uso:
Código: vb.net
  1.         Dim avsStatus As WindowsSecurityCenter.WscSecurityProviderHealth = WindowsSecurityCenter.GetStatusOfSecurityProvider(WindowsSecurityCenter.WscSecurityProvider.WscSecurityProviderAntivirus)
  2.         Select Case avsStatus
  3.             Case WindowsSecurityCenter.WscSecurityProviderHealth.WscSecurityProviderHealthGood
  4.                 MessageBox.Show("El estado del proveedor de seguridad es bueno y no necesita atención del usuario.")
  5.             Case WindowsSecurityCenter.WscSecurityProviderHealth.WscSecurityProviderHealthPoor
  6.                 MessageBox.Show("El estado del proveedor de seguridad es deficiente y el equipo puede estar en riesgo.")
  7.             Case WindowsSecurityCenter.WscSecurityProviderHealth.WscSecurityProviderHealthSnooze
  8.                 MessageBox.Show("El proveedor de seguridad está en estado suspendido. Snooze indica que WSC no está protegiendo activamente la computadora.")
  9.         End Select
  10.         Dim uacStatus As WindowsSecurityCenter.WscSecurityProviderHealth = WindowsSecurityCenter.GetStatusOfSecurityProvider(WindowsSecurityCenter.WscSecurityProvider.WscSecurityProviderUserAccountControl)
  11.         If uacStatus = WindowsSecurityCenter.WscSecurityProviderHealth.WscSecurityProviderHealthPoor Then
  12.             MessageBox.Show("El UAC se encuentra desactivado....")
  13.         End If
  14.  


Código: vb.net
  1. ' ***********************************************************************
  2. ' Assembly         : WinControl
  3. ' Author           : fudmario
  4. ' Created          : 12-21-2016
  5. '
  6. ' Last Modified By : fudmario
  7. ' Last Modified On : 12-21-2016
  8. ' ***********************************************************************
  9. ' <copyright file="WindowsSecurityCenter.vb" company="DeveloperTeam">
  10. '     Copyright ©  2016
  11. ' </copyright>
  12. ' <summary></summary>
  13. ' ***********************************************************************
  14. Imports System.Runtime.InteropServices
  15. Public NotInheritable Class WindowsSecurityCenter
  16.     <DebuggerNonUserCode>
  17.     Private Sub New()
  18.     End Sub
  19.     ''' <summary>
  20.     ''' Defines all the services that are monitored by Windows Security Center (WSC).
  21.     ''' </summary>
  22.     ''' <remarks>
  23.     ''' <see href="https://msdn.microsoft.com/en-us/library/bb432509(v=vs.85).aspx"/>
  24.     ''' </remarks>
  25.     <Flags>
  26.     Public Enum WscSecurityProvider As Integer
  27.         ''' <summary>
  28.         ''' The aggregation of all firewalls for this computer.
  29.         ''' </summary>
  30.         WscSecurityProviderFirewall = 1
  31.         ''' <summary>
  32.         ''' The automatic update settings for this computer.
  33.         ''' </summary>
  34.         WscSecurityProviderAutoupdateSettings = 2
  35.         ''' <summary>
  36.         ''' The aggregation of all antivirus products for this computer.
  37.         ''' </summary>
  38.         WscSecurityProviderAntivirus = 4
  39.         ''' <summary>
  40.         ''' The aggregation of all anti-spyware products for this computer.
  41.         ''' </summary>
  42.         WscSecurityProviderAntispyware = 8
  43.         ''' <summary>
  44.         ''' The settings that restrict the access of web sites in each of the Internet zones for this computer.
  45.         ''' </summary>
  46.         WscSecurityProviderInternetSettings = 16
  47.         ''' <summary>
  48.         ''' The User Account Control (UAC) settings for this computer.
  49.         ''' </summary>
  50.         WscSecurityProviderUserAccountControl = 32
  51.         ''' <summary>
  52.         ''' The running state of the WSC service on this computer.
  53.         ''' </summary>
  54.         WscSecurityProviderService = 64
  55.         ''' <summary>
  56.         ''' None of the items that WSC monitors.
  57.         ''' </summary>
  58.         WscSecurityProviderNone = 0
  59.         ''' <summary>
  60.         ''' All of the items that the WSC monitors.
  61.         ''' </summary>
  62.         WscSecurityProviderAll =
  63.             WscSecurityProviderFirewall Or WscSecurityProviderAutoupdateSettings Or WscSecurityProviderAntivirus Or
  64.             WscSecurityProviderAntispyware Or WscSecurityProviderInternetSettings Or
  65.             WscSecurityProviderUserAccountControl Or
  66.             WscSecurityProviderService Or WscSecurityProviderNone
  67.     End Enum
  68.  
  69.     ''' <summary>
  70.     ''' Defines the possible states for any service monitored by Windows Security Center (WSC).
  71.     ''' </summary>
  72.     ''' <remarks>
  73.     ''' <see href="https://msdn.microsoft.com/en-us/library/bb432510(v=vs.85).aspx"/>
  74.     ''' </remarks>
  75.     <Flags>
  76.     Public Enum WscSecurityProviderHealth As Integer
  77.         ''' <summary>
  78.         ''' The status of the security provider category is good and does not need user attention.
  79.         ''' </summary>
  80.         WscSecurityProviderHealthGood
  81.         ''' <summary>
  82.         ''' The status of the security provider category is not monitored by WSC.
  83.         ''' </summary>
  84.         WscSecurityProviderHealthNotmonitored
  85.         ''' <summary>
  86.         ''' The status of the security provider category is poor and the computer may be at risk.
  87.         ''' </summary>
  88.         WscSecurityProviderHealthPoor
  89.         ''' <summary>
  90.         ''' The security provider category is in snooze state. Snooze indicates that WSC is not actively protecting the computer.
  91.         ''' </summary>
  92.         WscSecurityProviderHealthSnooze
  93.         ''' <summary>
  94.         ''' The status of the security provider category is unknown
  95.         ''' </summary>
  96.         WscSecurityProviderHealthUnknown
  97.     End Enum
  98.  
  99.     ''' <summary>
  100.     ''' Gets the aggregate health state of the security provider categories represented by the specified <see cref="WscSecurityProvider"/> enumeration values.
  101.     ''' </summary>
  102.     ''' <param name="providers ">One or more of the values in the <see cref="WscSecurityProvider"/> enumeration. To specify more than one value, combine the individual values by performing a bitwise OR operation.</param>
  103.     ''' <param name="pHealth ">A pointer to a variable that takes the value of one of the members of the <see cref="WscSecurityProviderHealth"/> enumeration. If more than one provider is specified in the Providers parameter, the value of this parameter is the health of the least healthy of the specified provider categories.</param>
  104.     ''' <returns>Returns S_OK if the function succeeds, otherwise returns an error code. If the WSC service is not running, the return value is always S_FALSE and the pHealth out parameter is always set to WSC_SECURITY_PROVIDER_HEALTH_POOR.</returns>
  105.     ''' <remarks>
  106.     ''' <see href="https://msdn.microsoft.com/en-us/library/bb432506(v=vs.85).aspx"/>
  107.     ''' </remarks>
  108.     <DllImport("wscapi.dll")>
  109.     Private Shared Function WscGetSecurityProviderHealth(<[In]> providers As WscSecurityProvider,
  110.                                                          <Out> ByRef pHealth As WscSecurityProviderHealth) _
  111.         As Integer
  112.     End Function
  113.  
  114.     ''' <summary>
  115.     ''' Gets the status of security provider.
  116.     ''' </summary>
  117.     ''' <param name="provider">provider.</param>
  118.     ''' <returns>The possible states for service monitored by Windows Security Center (WSC).</returns>
  119.     Public Shared Function GetStatusOfSecurityProvider(provider As WscSecurityProvider) As WscSecurityProviderHealth
  120.         Dim outValue As WscSecurityProviderHealth = WscSecurityProviderHealth.WscSecurityProviderHealthUnknown
  121.         Dim ret As Integer = WscGetSecurityProviderHealth(provider, outValue)
  122.         Return If(ret <> &H0, WscSecurityProviderHealth.WscSecurityProviderHealthUnknown, outValue)
  123.     End Function
  124. End Class
  125.  
  126.  


 

¿Te gustó el post? COMPARTILO!



GhostDoc Enterprise - Build 5.2.16200 | Patcher by fudmario

Iniciado por fudmario

Respuestas: 3
Vistas: 2811
Último mensaje Octubre 09, 2016, 07:27:04 pm
por atheros14
[VB.NET] WifiHelper(Password Dumper) By fudmario

Iniciado por fudmario

Respuestas: 3
Vistas: 2555
Último mensaje Marzo 29, 2017, 05:07:36 pm
por s1sm0x0
[VB.Net] Offset Locator Function's by fudmario

Iniciado por fudmario

Respuestas: 1
Vistas: 2474
Último mensaje Julio 21, 2018, 04:19:31 pm
por Pjoao1578
[Function] Adf.ly Decode by fudmario[vb.net]

Iniciado por fudmario

Respuestas: 5
Vistas: 3517
Último mensaje Junio 22, 2016, 05:07:37 pm
por Kr3L
[VB.NET] Sendspace Uploader by fudmario

Iniciado por fudmario

Respuestas: 0
Vistas: 1189
Último mensaje Julio 14, 2017, 11:05:51 pm
por fudmario