Sorting out Nessus Messes

Private Sub Command1_Click()

Dim Line As String

‘Input Nessus Log / Open Output Files

Open App.Path & “” & Filename.Text & “.nbe” For Input As #1
If CheckXLS.Value = 1 Then Open App.Path & “” & Filename.Text & “.xls” For Append As #2
If CheckTXT.Value = 1 Then Open App.Path & “” & Filename.Text & “.txt” For Append As #3

Do While Not EOF(1)

Start:

Line Input #1, Line$

If CheckTime.Value = 1 Then
If Left$(Line$, 1) = “t” Then GoTo Start
End If

Line$ = Replace(Line$, “n”, ” “)
Line$ = Replace(Line$, “r”, ” “)
Line$ = Replace(Line$, ” “, ” “)
Line$ = Replace(Line$, “Description :”, “|Description :”)
Line$ = Replace(Line$, “Solution :”, “|Solution :”)
Line$ = Replace(Line$, “Risk factor :”, “|Risk factor :”)
Line$ = Replace(Line$, “Plugin output :”, “|Plugin output :”)
Line$ = Replace(Line$, ” |”, “|”)
Line$ = Replace(Line$, “| “, “|”)

If CheckXLS.Value = 1 Then
Print #2, Line$
Print #2, vbCrLf
End If

If CheckTXT.Value = 1 Then
SplitArray = Split(Line$, “|”)
For intx = 0 To UBound(SplitArray)
Print #3, SplitArray(intx)
If intx = UBound(SplitArray) Then Print #3, vbCrLf
Next
End If

If CheckTXT.Value = 0 And CheckXLS.Value = 0 Then
MsgBox (“You chose no output. There’s just not much I can do for you.”)
Close #1
Close #2
Close #3
Exit Sub
End If

Loop

Close #1
Close #2
Close #3

MsgBox (“Done!”)

End Sub

One thought on “Sorting out Nessus Messes

Comments are closed.