/// <summary>
 /// A firewall related vulnerability
 /// </summary>
 /// <param name="points">The number of points to award on completion</param>
 /// <param name="VulnType">The type of firewall vulnerability to check</param>
 /// <param name="ApplicationName">The name of the application</param>
 public FirewallVulnerability(int points, FirewallVulnerabilityType VulnType, string ApplicationName) : base(points)
 {
     RegressionEnabled    = true;
     this.ApplicationName = ApplicationName;
     this.VulnType        = VulnType;
     FirewallInterface    = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwMgr"));
     OnCompleted         += VulnCompleted;
 }
 /// <summary>
 /// A firewall related vulnerability
 /// </summary>
 /// <param name="points">The number of points to award on completion</param>
 /// <param name="VulnType">The type of firewall vulnerability to check</param>
 /// <param name="port">The port to check</param>
 public FirewallVulnerability(int points, FirewallVulnerabilityType VulnType, ushort port = 0) : base(points)
 {
     RegressionEnabled  = true;
     TargetPort         = port;
     this.VulnType      = VulnType;
     FirewallInterface  = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwMgr"));
     FirewallInterface2 = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
     OnCompleted       += VulnCompleted;
     if (VulnType == FirewallVulnerabilityType.PortAllowed || VulnType == FirewallVulnerabilityType.PortBlocked)
     {
         Enabled = false; //Cant support this just yet, probably need a new type of vuln because it deals with far too many variables
     }
 }
示例#3
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="args">args[0] type of vuln, args[1]? name of app</param>
    internal FirewallTemplate(params string[] args)
    {
        if (args.Length < 2)
        {
            Enabled = false;
            return;
        }

        try
        {
            Enum.TryParse(args[0], true, out FirewallVulnerabilityType checkType);
            VulnType           = checkType;
            FirewallInterface  = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwMgr"));
            FirewallInterface2 = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
        }
        catch
        {
            Enabled = false;
        }
        if (args.Length > 1)
        {
            ApplicationName = args[1];
        }
    }