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

查看:82
本文介绍了SoftLayer API Nessus扫描状态/通过PHP报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在SoftLayer上生成/启动新的漏洞扫描,此方法(对于帐户中的每个服务器)都有效:

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

更改时

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

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

API响应有关对象不存在,无法在其上执行方法"的错误.

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

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

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

推荐答案

您需要使用Softlayer PHP客户端设置init参数,您可以这样做:

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

创建客户端时:

$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);

init参数基本上是您希望获得编辑或删除的对象的ID,在这种情况下,init参数是您希望获取报告的漏洞扫描的ID.

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.

您可以尝试以下代码:

$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

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

致谢

这篇关于SoftLayer API Nessus扫描状态/通过PHP报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆