
This is an initial import of the osel codebase. The osel tool is a tool that initiates external security scans (initially through Qualys) upon reciept of AMQP events that indicate certain sensitive events have occurred, like a security group rule change. The commit history had to be thrown away because it contained some non-public data, so I would like to call out the following contributors: This uses go 1.10 and vgo for dependency management. Co-Authored-By: Charles Bitter <Charles_Bitter@cable.comcast.com> Co-Authored-By: Olivier Gagnon <Olivier_Gagnon@cable.comcast.com> Co-Authored-By: Joseph Sleiman <Joseph_Sleiman@comcast.com> Change-Id: Ib6abe2024fd91978b783ceee4cff8bb4678d7b15
72 lines
1.3 KiB
Go
72 lines
1.3 KiB
Go
package qualys
|
|
|
|
import (
|
|
"net/http"
|
|
"net/url"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
var devCreds Credentials = Credentials{
|
|
Username: "cmcas_ae2",
|
|
Password: "D02debLYko",
|
|
}
|
|
|
|
func TestLiveScan(t *testing.T) {
|
|
// create client
|
|
c, clientErr := NewClient(&http.Client{}, &devCreds)
|
|
|
|
if clientErr != nil {
|
|
t.Error(clientErr)
|
|
}
|
|
|
|
if baseURL, err := url.Parse("https://qualysapi.qualys.com/api/2.0/fo/scan/"); err != nil {
|
|
t.Error(err)
|
|
} else {
|
|
c.BaseURL = baseURL
|
|
}
|
|
|
|
// create the options
|
|
opts := LaunchScanOptions{
|
|
ScanTitle: "hello_world",
|
|
ScannerName: "External",
|
|
// OptionID: 923922,
|
|
OptionTitle: "Elastic Cloud Option Profile with Password Guessing",
|
|
IP: []string{"96.119.99.178"},
|
|
}
|
|
|
|
// launch the request
|
|
|
|
launchScanResponse, err := c.LaunchScan(&opts)
|
|
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
// not sure if necessary
|
|
time.Sleep(time.Minute * 1)
|
|
|
|
//time to poll the scan results
|
|
pollOpts := PollScanOptions{
|
|
ScanRef: launchScanResponse.ScanReference,
|
|
}
|
|
|
|
_, pollRespErr := c.PollScanResults(&pollOpts)
|
|
|
|
if pollRespErr != nil {
|
|
t.Error(pollRespErr)
|
|
}
|
|
|
|
// now need to keep polling until the results are all in...
|
|
|
|
resultsOptions := CompletedScanOptions{
|
|
ScanRef: launchScanResponse.ScanReference,
|
|
}
|
|
|
|
_, resultsRespErr := c.GetScanResults(&resultsOptions)
|
|
|
|
if resultsRespErr != nil {
|
|
t.Error(resultsRespErr)
|
|
}
|
|
}
|