예제 #1
0
 // Main1 for NessusSession Class Testing
 public static void Main1(string[] args)
 {
     using (NessusSession session = new NessusSession("192.168.1.14", "admin", "password"))
     {
         Console.WriteLine("Your authentication token is: " + session.Token);
     }
 }
예제 #2
0
 public void Dispose()
 {
     if (_session.Authenticated)
     {
         _session.LogOut();
     }
     _session = null;
 }
예제 #3
0
        // Starting Nessus Scanning
        public static void Main(string[] args)
        {
            ServicePointManager.ServerCertificateValidationCallback = (Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) => true;

            using (NessusSession session = new NessusSession("192.168.1.14", "admin", "password"))
            {
                using (NessusManager manager = new NessusManager(session))
                {
                    JObject policies          = manager.GetScanPolicies();
                    string  discoveryPolicyID = string.Empty;
                    foreach (JObject template in policies["templates"])
                    {
                        if (template["name"].Value <string>() == "basic")
                        {
                            discoveryPolicyID = template["uuid"].Value <string>();
                        }
                    }

                    JObject scan   = manager.CreateScan(discoveryPolicyID, "192.168.1.31", "Network Scan", "A simple scan of a simple IP address.");
                    int     scanID = scan["scan"]["id"].Value <int>();
                    manager.StartScan(scanID);
                    JObject scanStatus = manager.GetScan(scanID);

                    while (scanStatus["info"]["status"].Value <string>() != "completed")
                    {
                        Console.WriteLine("Scan status: " + scanStatus["info"]["status"].Value <string>());
                        Thread.Sleep(5000);
                        scanStatus = manager.GetScan(scanID);
                    }

                    foreach (JObject vuln in scanStatus["vulnerabilities"])
                    {
                        Console.WriteLine(vuln.ToString());
                    }
                }
            }
        }
예제 #4
0
 public NessusManager(NessusSession session)
 {
     _session = session;
 }