SoftLayer API Nessus扫描状态/通过PHP报告[英] SoftLayer API Nessus Scan Status / Report via PHP

本文是小编为大家收集整理的关于SoftLayer API Nessus扫描状态/通过PHP报告的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

要在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);

to

$reportstatus = $scanclient->getReport($scantemplate);

API响应了有关"对象不存在要执行方法"的错误.

根据文档,SoftLayer_network_security_security_scurity_scanner_requestinitparameters是否需要?如果是这样,如何定义这些"初始参数"并将其附加到状态请求或报告?

?

/a>

推荐答案

您需要使用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中获取您的漏洞扫描列表,您可以使用此方法: 对于裸金属服务器,您可以使用此:

问候

本文地址:https://www.itbaoku.cn/post/1937770.html

问题描述

To generate/initiate a new vulnerability scan at SoftLayer, this works (for every server in an account):

    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";
        }
    }

When changing

$reportstatus = $scanclient->createObject($scantemplate);

to

$reportstatus = $scanclient->getReport($scantemplate);

The API responds with an error concerning "Object does not exist to execute method on.".

Would SoftLayer_Network_Security_Scanner_RequestInitParameters be required as per the docs? If so how do you define these "init parameters" and attach to the request for status or report?

http://sldn.softlayer.com/reference/services/SoftLayer_Network_Security_Scanner_Request/getReport

推荐答案

You need to set the init parameter using the Softlayer PHP client you can do that like this:

When you are creating the client:

$virtualGuestService = SoftLayer_SoapClient::getClient('SoftLayer_Virtual_Guest', $initParemter, $username, $key);

Or after creating the client:

$virtualGuestService = SoftLayer_SoapClient::getClient('SoftLayer_Virtual_Guest', null, $username, $key);
# Setting the init parameter
$virtualGuestService->setInitParameter($virtualGuestId);

The init parameter is basically the id of the object you wish to get edit or delete, in this case the init parameter is the id of the vulnerability scan you wish to get the report.

You can try this code:

$scanclient = SoftLayer_SoapClient::getClient('SoftLayer_Network_Security_Scanner_Request', '', $apiUsername, $apiKey);
$scanclient->setInitParameter(15326); # The id of the vulnerability scan
$reportstatus = $scanclient->getReport();

To get the list of your vulnerabilities scans in a VSI you can use this method: http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getSecurityScanRequests and for bare metal servers you can use this one: http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/getSecurityScanRequests

Regards