SoftLayer API Nessus 扫描状态/报告通过 PHP
SoftLayer API Nessus Scan Status / Report via PHP
generate/initiate 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 响应有关 "Object does not exist to execute method on." 的错误。
根据文档需要 SoftLayer_Network_Security_Scanner_RequestInitParameters 吗?如果是这样,您如何定义这些 "init parameters" 并附加到状态或报告请求?
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Security_Scanner_Request/getReport
您需要使用 Softlayer PHP 客户端设置初始化参数,您可以这样做:
创建客户端时:
$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
此致
generate/initiate 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 响应有关 "Object does not exist to execute method on." 的错误。
根据文档需要 SoftLayer_Network_Security_Scanner_RequestInitParameters 吗?如果是这样,您如何定义这些 "init parameters" 并附加到状态或报告请求?
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Security_Scanner_Request/getReport
您需要使用 Softlayer PHP 客户端设置初始化参数,您可以这样做:
创建客户端时:
$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
此致