test user
Change-Id: I89acf4256010e00c0d114a723cf87ee384bf6094
This commit is contained in:
parent
afe7bbf0ac
commit
b7a32d70dc
@ -1,71 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,7 +8,7 @@
|
|||||||
<REF>scan/1486045714.48615</REF>
|
<REF>scan/1486045714.48615</REF>
|
||||||
<TYPE>API</TYPE>
|
<TYPE>API</TYPE>
|
||||||
<TITLE><![CDATA[Elastic Cloud Automated Scan]]></TITLE>
|
<TITLE><![CDATA[Elastic Cloud Automated Scan]]></TITLE>
|
||||||
<USER_LOGIN>cmcas_at1</USER_LOGIN>
|
<USER_LOGIN>testuser</USER_LOGIN>
|
||||||
<LAUNCH_DATETIME>2017-02-02T14:28:34Z</LAUNCH_DATETIME>
|
<LAUNCH_DATETIME>2017-02-02T14:28:34Z</LAUNCH_DATETIME>
|
||||||
<DURATION>00:08:44</DURATION>
|
<DURATION>00:08:44</DURATION>
|
||||||
<PROCESSING_PRIORITY>0 - No Priority</PROCESSING_PRIORITY>
|
<PROCESSING_PRIORITY>0 - No Priority</PROCESSING_PRIORITY>
|
||||||
|
Loading…
Reference in New Issue
Block a user