예제 #1
0
        public void DeleteNote(OpenVASNote note)
        {
            if (note.RemoteNoteID == Guid.Empty)
            {
                throw new Exception("Can't delete note that hasn't been created");
            }

            XmlDocument response = this.DeleteNote(note.RemoteNoteID.ToString());

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "status" && attr.Value != "200")
                {
                    throw new Exception("Deleting note failed.");
                }
            }
        }
예제 #2
0
        public OpenVASNote CreateNote(OpenVASNote note)
        {
            if (note.RemoteNoteID != Guid.Empty)
            {
                throw new Exception("This note has already been created.");
            }

            XmlDocument response = this.CreateNote(note.Content, note.NVT.OID, note.Comment, note.Hosts, note.Port.ToString(), note.Report.RemoteReportID.ToString(), note.Task.RemoteTaskID.ToString(), note.ThreatLevel);

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "id")
                {
                    note.RemoteNoteID = new Guid(attr.Value);
                }
            }

            return(note);
        }
        public void DeleteNote(OpenVASNote note)
        {
            if (note.RemoteNoteID == Guid.Empty)
                throw new Exception("Can't delete note that hasn't been created");

            XmlDocument response = this.DeleteNote(note.RemoteNoteID.ToString());

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "status" && attr.Value != "200")
                    throw new Exception("Deleting note failed.");
            }
        }
        public OpenVASNote CreateNote(OpenVASNote note)
        {
            if (note.RemoteNoteID != Guid.Empty)
                throw new Exception("This note has already been created.");

            XmlDocument response = this.CreateNote(note.Content, note.NVT.OID, note.Comment, note.Hosts, note.Port.ToString(), note.Report.RemoteReportID.ToString(), note.Task.RemoteTaskID.ToString(), note.ThreatLevel);

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "id")
                    note.RemoteNoteID = new Guid(attr.Value);
            }

            return note;
        }