![](/img/trans.png)
[英]Is it possible to add a ticket response as a specific user via the SoftLayer API using the PHP SOAP client?
[英]SoftLayer API Nessus Scan Status / Report via PHP
要在SoftLayer上生成/啟動新的漏洞掃描,此方法適用(對於帳戶中的每個服務器):
require_once('SoapClient.class.php');
$apiUsername = "omitted";
$apiKey = "omitted";
$client = SoftLayer_SoapClient::getClient('SoftLayer_Account', null, $apiUsername, $apiKey);
$accountInfo = $client->getObject();
$hardware = $client->getHardware();
foreach ($hardware as $server){
$scanclient = SoftLayer_SoapClient::getClient('SoftLayer_Network_Security_Scanner_Request', '', $apiUsername, $apiKey);
$scantemplate = new stdClass();
$scantemplate->accountId = $accountInfo->id;
$scantemplate->hardwareId = $server->id;
$scantemplate->ipAddress = $server->primaryIpAddress;
try{
// Successfully creates new scan
$scan = $scanclient->createObject($scantemplate);
} catch (Exception $e){
echo $e->getMessage() . "\n\r";
}
}
更換時
$reportstatus = $scanclient->createObject($scantemplate);
至
$reportstatus = $scanclient->getReport($scantemplate);
API響應有關“對象不存在以執行方法的錯誤”的響應。
根據文檔是否需要SoftLayer_Network_Security_Scanner_RequestInitParameters? 如果是這樣,您如何定義這些“初始參數”並附加到狀態或報告請求?
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Security_Scanner_Request/getReport
您需要使用Softlayer PHP客戶端設置init參數,您可以像這樣進行操作:
創建客戶端時:
$virtualGuestService = SoftLayer_SoapClient::getClient('SoftLayer_Virtual_Guest', $initParemter, $username, $key);
或在創建客戶端之后:
$virtualGuestService = SoftLayer_SoapClient::getClient('SoftLayer_Virtual_Guest', null, $username, $key);
# Setting the init parameter
$virtualGuestService->setInitParameter($virtualGuestId);
init參數基本上是您希望編輯或刪除的對象的ID,在這種情況下,init參數是您希望獲取報告的漏洞掃描的ID。
您可以嘗試以下代碼:
$scanclient = SoftLayer_SoapClient::getClient('SoftLayer_Network_Security_Scanner_Request', '', $apiUsername, $apiKey);
$scanclient->setInitParameter(15326); # The id of the vulnerability scan
$reportstatus = $scanclient->getReport();
為了獲得在VSI您的漏洞掃描的列表中,您可以使用此方法: http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getSecurityScanRequests和裸機服務器,您可以使用此一: HTTP:// SLDN .softlayer.com / reference / services / SoftLayer_Hardware_Server / getSecurityScanRequests
問候
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.