Skip to content

Commit

Permalink
login to Nessus before each scan export, rather than once at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Jul 27, 2017
1 parent 66cdaaf commit 262e9e5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions _meta/beat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

nessusbeat:
report_path: /opt/nessus/var/nessus/users/admin/reports
# Path to root certificates.
#cacert_path:
# The Nessus API URL.
#api_url:
#api_username:
#api_password:

name: nessusbeat
17 changes: 8 additions & 9 deletions beater/nessusbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,6 @@ func (bt *Nessusbeat) Run(b *beat.Beat) error {
bt.client = b.Publisher.Connect()
results := make(chan []byte)

nessus, err := bt.NewConnection()
if err != nil {
logp.WTF(err.Error())
}
if err = bt.Login(*nessus); err != nil {
logp.WTF(err.Error())
}
defer (*nessus).Logout()

go func() {
for {
select {
Expand All @@ -127,6 +118,14 @@ func (bt *Nessusbeat) Run(b *beat.Beat) error {
var csv []byte
err = backoff.RetryNotify(
func() error {
nessus, err := bt.NewConnection()
if err != nil {
logp.WTF(err.Error())
}
if err = bt.Login(*nessus); err != nil {
logp.WTF(err.Error())
}
defer (*nessus).Logout()
csv, err = bt.ExportScanCSV(*nessus, uuid)
return err
},
Expand Down
2 changes: 2 additions & 0 deletions nessusbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ nessusbeat:
#api_username:
#api_password:

name: nessusbeat

#================================ General ======================================

# The name of the shipper that publishes the network data. It can be used to group
Expand Down
2 changes: 2 additions & 0 deletions nessusbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ nessusbeat:
#api_username:
#api_password:

name: nessusbeat

#================================ General =====================================

# The name of the shipper that publishes the network data. It can be used to group
Expand Down

0 comments on commit 262e9e5

Please sign in to comment.